Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP update to use InterTypes #29

Closed
wants to merge 35 commits into from
Closed

WIP update to use InterTypes #29

wants to merge 35 commits into from

Conversation

p-stokes
Copy link
Contributor

@p-stokes p-stokes commented Dec 1, 2023

This is to make the InterType form of the various structures currently in SyntacticModels.

Resolves #28

… a corresponding test script intertype_examples.jl
@p-stokes p-stokes marked this pull request as draft December 1, 2023 15:34
Copy link

codecov bot commented Dec 1, 2023

Codecov Report

Attention: 16 lines in your changes are missing coverage. Please review.

Comparison is base (0ea6f64) 81.74% compared to head (e07fb29) 87.11%.

Files Patch % Lines
src/amr.jl 86.44% 8 Missing ⚠️
src/decapodes.jl 96.73% 5 Missing ⚠️
src/composite_models.jl 87.50% 2 Missing ⚠️
src/uwd.jl 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #29      +/-   ##
==========================================
+ Coverage   81.74%   87.11%   +5.37%     
==========================================
  Files           6        6              
  Lines         378      489     +111     
==========================================
+ Hits          309      426     +117     
+ Misses         69       63       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…amr.it version. Changed amr module name to AMR.
…model and readback in core_it.jl. readback currently won't work because intertypes parsing doesn't recognize the typeof variant sum types.
…. Can now construct from an intertype version of DecaExpr. Still need to add SummationDecapode schema so it can be a field type for an ASKEMDecapode.
…type module but the SummationDecapode formation function is not yet producing an intertype one.
…r uses Decapodes.jl. Copied in a few utilities from there. Edited readback function in core_it.jl
…pdating the module and runtest files accordingly. Had to change the amr.it name within uwd.it from AMR to amr.
…me to amr. Changed my_parse_decapode function name as well.
Copy link
Member

@jpfairbanks jpfairbanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unnecessary rename of these file makes the diffs unreviewable. Please put them back and confirm that the diffs are useful. I can review again at that time.


[compat]
ACSets = "0.2"
Catlab = "0.15, 0.16"
Decapodes = "0.5"
Decapodes = "0.4, 0.5"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since code is moved here, do we still need to depend on Decapodes?

src/SyntacticModels.jl Outdated Show resolved Hide resolved
src/amr_it.jl Outdated
@@ -0,0 +1,391 @@
module AMR
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because of the rename of this file, the diff is useless. See above comment.

src/amr_it.jl Outdated
using ACSets.ACSetInterface
using StructTypes

# using ..SyntacticModelsBase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete commented out code

src/amr_it.jl Outdated
return Base.Meta.parse(distro_string(d))
end

#=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete block comments.

@@ -0,0 +1,85 @@
module Composites
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, I can't review this diff because of the file rename.

using ..AMR

using StructTypes
# using Decapodes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is anything using Decapodes now that you copied code over here? Should we upgrade Decapodes to use InterTypes and then just use InterType inteheritance here?

return d
end

function recognize_types(d::decapodes.AbstractNamedDecapode)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should SynacticModels be doing decapodes operations like recognize_types? What do you think the scope boundary is?

end
end

function parse_decapode(expr::Expr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should SynacticModels be doing decapodes operations like parse_decapode? What do you think the scope boundary is?

src/uwd_it.jl Outdated
@@ -0,0 +1,191 @@
module ASKEMUWDs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't review this diff because the file was renamed unnecessarily.

@p-stokes
Copy link
Contributor Author

p-stokes commented Dec 7, 2023

The unnecessary rename of these file makes the diffs unreviewable. Please put them back and confirm that the diffs are useful. I can review again at that time.

I've updated the file names for the PR, and the diffs look ok now. Regarding the included decapodes functions, I think the longer-term plan is for Decapodes and other structures to be defined directly upstream with InterTypes. But for the short-term, it seemed easier to develop locally within SyntacticModels.

I do think it would be helpful to have a discussion about the design/scope plan for SyntacticModels because it relates to the current points of development for the AMR and Composites functionality as well.

@p-stokes p-stokes requested a review from jpfairbanks December 7, 2023 02:43
src/uwd.jl Outdated
varname(v::Var) = @match v begin
Untyped(v) => v
Typed(v, t) => v
varname(v::uwd.Var) = @match v begin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@p-stokes, is there a problem with doing

const Var = uwd.Var

and then not needing to do all these qualified names?

Copy link
Contributor Author

@p-stokes p-stokes Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even that might not really be necessary. It might be possible to just use Var in this case. I'll check.
The qualification of names was somewhat inconsistent as I was developing, so I do plan to go through and do a standardization once the functionality is set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've cleaned up the name qualifications.

using Test
using OrderedCollections
import JSON
import JSON3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What functionality are you using from all these additional imports?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the name qualifications, I was a bit lax with the imports during development.
I have already begun going through and cleaning up some of the unnecessary imports.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've cleaned up the imports.




h = AMR.Header("harmonic_oscillator",
h = Header("","harmonic_oscillator",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fields of the Header are changing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Model-Representations repo, I noticed Five had added an extra id field to the Header there, so I incorporated it here. I can go through and take it out if you want?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That upgrade for compatibility with Model-Representations should be a separate issue and PR because it is not related to "update to use InterTypes"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I'll undo that and make a separate issue and PR after.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the id field.


using MLStyle
using Catlab
using Decapodes
using Decapodes # : SummationDecapode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you don't need it delete the import.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was deleted in the imports cleanup.

@p-stokes p-stokes requested a review from jpfairbanks December 8, 2023 06:38
@p-stokes
Copy link
Contributor Author

p-stokes commented Dec 8, 2023

I cleaned up and standardized the imports and name qualifications. Still working on the remaining composite oapply example and amr acsetspec examples

@jpfairbanks
Copy link
Member

I do think it would be helpful to have a discussion about the design/scope plan for SyntacticModels because it relates to the current points of development for the AMR and Composites functionality as well.

I think the first part of that discussion is understanding your expectations for the scope. What are your thoughts?

element::Vector{Args}
end

#=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this?

@@ -0,0 +1,102 @@

@sum Args begin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this being copied from https://github.com/AlgebraicJulia/ACSets.jl/blob/main/src/ADTs.jl#L14?

We should upgrade that code to use InterTypes and then import that usage here.

@p-stokes
Copy link
Contributor Author

p-stokes commented Dec 8, 2023

I do think it would be helpful to have a discussion about the design/scope plan for SyntacticModels because it relates to the current points of development for the AMR and Composites functionality as well.

I think the first part of that discussion is understanding your expectations for the scope. What are your thoughts?

Summarizing our in-person discussion about this:
The short-term scope is to convert the functionality and test examples to use InterTypes locally within SyntacticModels.jl (as best makes sense and is possible). Longer-term, the .it files and functions will be upstreamed to their respective repositories.
There are several blocking issues with InterTypes' capabilities and integration with some other upstream functionality (e.g., ADTs and Open). I will make issues for those and tag them below.

…decapode to a Decapodes one, then Decapodes.Open can be used to compose. Still need to add reverse conversion.
… Updated remaining OpenDecapode function to oapply composite model and convert back to intertype.
… uses in examples. jsonwrite in first method still not working for empty annotations, so those examples are still commented.
… needed to make write_json_model and readback work.
…es in .it as needed. Load to AMR from expression examples now work. Need to update amr_to_string (and check other functions) to match current intertypes.
…eNode. Need to update load from dict for ASKEModel and Typing and amr_to_string.
…s of Strings for some examples. Also still need to fix amr_to_string and amr_to_expr.
…relates to intertype version of ACSetSpec is different format from ADTs. May want to convert back for expr or string. amr_to_string runs but doesn't look good.
@olynch olynch closed this Jan 17, 2024
@olynch
Copy link
Member

olynch commented Jan 17, 2024

Some of the work here ends up duplicating work merged into DiagrammaticEquations, so it makes sense to make a new PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InterTypes Refactor
3 participants