From 69700169ca5f67524fb14ceeace073ae65095270 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Mon, 30 Oct 2023 14:03:06 +0000 Subject: [PATCH] build based on 89754bb --- dev/.documenter-siteinfo.json | 2 +- dev/api/index.html | 6 +++--- dev/generated/composite_models_examples/index.html | 2 +- dev/generated/decapodes_examples/index.html | 2 +- dev/generated/uwd_examples/index.html | 2 +- dev/index.html | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index cd626c8..3d2bc01 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.9.3","generation_timestamp":"2023-10-30T13:39:17","documenter_version":"1.1.2"}} \ No newline at end of file +{"documenter":{"julia_version":"1.9.3","generation_timestamp":"2023-10-30T14:03:01","documenter_version":"1.1.2"}} \ No newline at end of file diff --git a/dev/api/index.html b/dev/api/index.html index e6d4129..b96542b 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -1,5 +1,5 @@ -Library Reference · SyntacticModels.jl

Library Reference

Base.DictMethod
Dict(x::AbstractTerm)

to register your type with JSON3, you need to overload JSON3.write to use this Dict approach. we only overload the Dict function for our type Formula, so this is not piracy.

source
SyntacticModels.SyntacticModelsBase.AbstractTermType
AbstractTerm

The super type for all SyntacticModels types. This abstract type exists so that we can write generic methods that work on any term in any of the domain specific syntaxes. For example, serializing to a Dictionary uses some reflection snippet that works for arbitrary types, but we only want to apply it to things that should be serialized like a Term.

source
JSON3.writeMethod
JSON3.write

Now JSON3.write(f) puts the type information in our reserved field.

source
StructTypes.subtypekeyMethod
StructTypes.subtypekey

This is how you tell StructTypes where to look for the name of a type when reading the type back in from JSON.

source
SyntacticModels.SyntacticModelsBase._dictMethod
_dict(x::T) where T <: AbstractTerm

We are going to convert our structs to Dict before we call JSON3.write and add the type information in a generic construction. This uses some reflection to ask the julia type for its fieldnames and then use those as the keys in the Dict. We use splatting, so don't make a struct with more than 32 fields if you want to go fast. We use this _dict function to avoid an "I'm the captain now" level of type piracy.

source

UWDs

SyntacticModels.ASKEMUWDs.UWDTermType
UWDTerm

Term specifying UWD.

Subtypes

  1. UWDModel: A header and UWD Expr
  2. UWDExpr: A Context of variables and a list of statements defining a UWD
  3. Statement: R(x,y,z) a relation that acts on its arguments (which are Vars)

Example

To specify the following relation macro:

@relation (x:X, z:Z) where y:Y begin
+Library Reference · SyntacticModels.jl

Library Reference

Base.DictMethod
Dict(x::AbstractTerm)

to register your type with JSON3, you need to overload JSON3.write to use this Dict approach. we only overload the Dict function for our type Formula, so this is not piracy.

source
SyntacticModels.SyntacticModelsBase.AbstractTermType
AbstractTerm

The super type for all SyntacticModels types. This abstract type exists so that we can write generic methods that work on any term in any of the domain specific syntaxes. For example, serializing to a Dictionary uses some reflection snippet that works for arbitrary types, but we only want to apply it to things that should be serialized like a Term.

source
JSON3.writeMethod
JSON3.write

Now JSON3.write(f) puts the type information in our reserved field.

source
StructTypes.subtypekeyMethod
StructTypes.subtypekey

This is how you tell StructTypes where to look for the name of a type when reading the type back in from JSON.

source
SyntacticModels.SyntacticModelsBase._dictMethod
_dict(x::T) where T <: AbstractTerm

We are going to convert our structs to Dict before we call JSON3.write and add the type information in a generic construction. This uses some reflection to ask the julia type for its fieldnames and then use those as the keys in the Dict. We use splatting, so don't make a struct with more than 32 fields if you want to go fast. We use this _dict function to avoid an "I'm the captain now" level of type piracy.

source

UWDs

SyntacticModels.ASKEMUWDs.UWDTermType
UWDTerm

Term specifying UWD.

Subtypes

  1. UWDModel: A header and UWD Expr
  2. UWDExpr: A Context of variables and a list of statements defining a UWD
  3. Statement: R(x,y,z) a relation that acts on its arguments (which are Vars)

Example

To specify the following relation macro:

@relation (x:X, z:Z) where y:Y begin
   R(x,y)
   S(y,z)
   T(z,y,u)
@@ -11,8 +11,8 @@
 s = [Statement(:R, [v1,v2]),
   Statement(:S, [v2,v3]),
   Statement(:T, [v3,v2, v4])]
-u = UWDExpr(c, s)
source
SyntacticModels.ASKEMUWDs.VarType
Var

Variables of a UWD. Types are the domain types, ScalarField, VectorField, Dual1Form, Primal2Form NOT Float64,Complex128

Subtypes include:

  1. Untyped(var::Symbol)
  2. Typed(var::Symbol, type::Symbol)

which are used for representing typed or untyped variables.

source
Base.showMethod
show(io::IO, s::UWDTerm)

generates a human readable string of the UWDTerm (or any sub-term).

source

Decapodes

Composites

SyntacticModels.ASKEMUWDs.VarType
Var

Variables of a UWD. Types are the domain types, ScalarField, VectorField, Dual1Form, Primal2Form NOT Float64,Complex128

Subtypes include:

  1. Untyped(var::Symbol)
  2. Typed(var::Symbol, type::Symbol)

which are used for representing typed or untyped variables.

source
Base.showMethod
show(io::IO, s::UWDTerm)

generates a human readable string of the UWDTerm (or any sub-term).

source

Decapodes

Composites

SyntacticModels.Composites.CompositeModelType
CompositeModel
@data CompositeModel <: AbstractTerm begin
   OpenModel(model::ASKEMDecapodes.ASKEMDecaExpr, interface::Vector{Symbol})
   OpenDecapode(model::ASKEMDecapodes.ASKEMDecapode, interface::Vector{Symbol})
   CompositeModelExpr(header::Header, composition_pattern::UWDExpr, components::Vector{CompositeModel})
-end
source
Catlab.WiringDiagrams.WiringDiagramAlgebras.oapplyMethod
Catlab.oapply(m::CompositeModel)

CompositeModels can be flattened into a single level of model with the oapply function.

Warning

Because the oapply algorithm operates on the compute graph representation of the equations, it does not produce syntactic equations. Calls to oapply produce instances of OpenDecapode and not DecaExpr. Software that expects to consume decapodes should plan to interact with both forms.

source
SyntacticModels.Composites.interfaceMethod
interface(m::CompositeModel)

Extract the interface of a composite model. If the model is open, then it is the feet of the cospan. If it is a Composite, then it is the context of the uwd.

source
+end
source
Catlab.WiringDiagrams.WiringDiagramAlgebras.oapplyMethod
Catlab.oapply(m::CompositeModel)

CompositeModels can be flattened into a single level of model with the oapply function.

Warning

Because the oapply algorithm operates on the compute graph representation of the equations, it does not produce syntactic equations. Calls to oapply produce instances of OpenDecapode and not DecaExpr. Software that expects to consume decapodes should plan to interact with both forms.

source
SyntacticModels.Composites.interfaceMethod
interface(m::CompositeModel)

Extract the interface of a composite model. If the model is open, then it is the feet of the cospan. If it is a Composite, then it is the context of the uwd.

source
diff --git a/dev/generated/composite_models_examples/index.html b/dev/generated/composite_models_examples/index.html index 8635377..4148baa 100644 --- a/dev/generated/composite_models_examples/index.html +++ b/dev/generated/composite_models_examples/index.html @@ -780,4 +780,4 @@ op1 : Op1 → Operator = [:∂ₜ, :∂ₜ, :λ] op2 : Op2 → Operator = [:*, :*, :*, :-] type : Var → Type = [:Form0, :Form0, :Constant, :infer, :infer, :Literal, :Form0, :Constant, :Form0, :Parameter, :Form0, :Constant, :infer, :Form0] - name : Var → Name = [:X, :V, :oscillator_k, :oscillator_mult_1, :oscillator_V̇, Symbol("-1"), :heating_Q₊, :heating_drag_κ, :heating_Q₋, :heating_cooling_Q₀, :Q, :heating_cooling_λ, Symbol("heating_cooling_•1"), :heating_Q̇]) + name : Var → Name = [:X, :V, :oscillator_k, :oscillator_mult_1, :oscillator_V̇, Symbol("-1"), :heating_Q₊, :heating_drag_κ, :heating_Q₋, :heating_cooling_Q₀, :Q, :heating_cooling_λ, Symbol("heating_cooling_•1"), :heating_Q̇]) diff --git a/dev/generated/decapodes_examples/index.html b/dev/generated/decapodes_examples/index.html index 2e98a63..362c8e6 100644 --- a/dev/generated/decapodes_examples/index.html +++ b/dev/generated/decapodes_examples/index.html @@ -479,4 +479,4 @@ ], "Name": [ ] -} +} diff --git a/dev/generated/uwd_examples/index.html b/dev/generated/uwd_examples/index.html index 5ceb549..6c80635 100644 --- a/dev/generated/uwd_examples/index.html +++ b/dev/generated/uwd_examples/index.html @@ -273,4 +273,4 @@ UWD: { R(x:X, y:Y) S(y:Y, z:Z) - T(z:Z, y:Y, u) } where {x:X, z:Z}

And write that model in JSON

s = JSON3.write(mexpr)
"{\"uwd\":{\"statements\":[{\"variables\":[{\"var\":\"x\",\"type\":\"X\",\"_type\":\"Typed\"},{\"var\":\"y\",\"type\":\"Y\",\"_type\":\"Typed\"}],\"_type\":\"Statement\",\"relation\":\"R\"},{\"variables\":[{\"var\":\"y\",\"type\":\"Y\",\"_type\":\"Typed\"},{\"var\":\"z\",\"type\":\"Z\",\"_type\":\"Typed\"}],\"_type\":\"Statement\",\"relati" ⋯ 216 bytes ⋯ "\"},{\"var\":\"z\",\"type\":\"Z\",\"_type\":\"Typed\"}],\"_type\":\"UWDExpr\"},\"header\":{\"description\":\"A demo UWD showing generic relation composition\",\"name\":\"rst_relation\",\"_type\":\"Header\",\"model_version\":\"v0.1\",\"schema\":\"modelreps.io/UWD\",\"schema_name\":\"UWDExpr\"},\"_type\":\"UWDModel\"}"

Just as check, the headers should be preserved.

@test JSON3.write(JSON3.read(s, UWDModel)) == JSON3.write(mexpr)
Test Passed
+ T(z:Z, y:Y, u) } where {x:X, z:Z}

And write that model in JSON

s = JSON3.write(mexpr)
"{\"uwd\":{\"statements\":[{\"variables\":[{\"var\":\"x\",\"type\":\"X\",\"_type\":\"Typed\"},{\"var\":\"y\",\"type\":\"Y\",\"_type\":\"Typed\"}],\"_type\":\"Statement\",\"relation\":\"R\"},{\"variables\":[{\"var\":\"y\",\"type\":\"Y\",\"_type\":\"Typed\"},{\"var\":\"z\",\"type\":\"Z\",\"_type\":\"Typed\"}],\"_type\":\"Statement\",\"relati" ⋯ 216 bytes ⋯ "\"},{\"var\":\"z\",\"type\":\"Z\",\"_type\":\"Typed\"}],\"_type\":\"UWDExpr\"},\"header\":{\"description\":\"A demo UWD showing generic relation composition\",\"name\":\"rst_relation\",\"_type\":\"Header\",\"model_version\":\"v0.1\",\"schema\":\"modelreps.io/UWD\",\"schema_name\":\"UWDExpr\"},\"_type\":\"UWDModel\"}"

Just as check, the headers should be preserved.

@test JSON3.write(JSON3.read(s, UWDModel)) == JSON3.write(mexpr)
Test Passed
diff --git a/dev/index.html b/dev/index.html index bf18e85..aaef763 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -SyntacticModels.jl · SyntacticModels.jl

SyntacticModels.jl

SyntacticModels.jl is a Julia library for representing models as syntactic expressions.

The driving example for this library is the need to interoperate models between programming languages in the DARPA ASKEM Program. The AlgebraicJulia ecosystem includes some great tools for specifying modeling languages, but they are deeply connected to the Julia language. This package aims to provide simple tools for specifying domain specific programming languages that can be used to exchange the specification of scientific models between host languages.

We heavily use the MLStyle.jl package for defining Algebraic Data Types so you should familiarize yourself with those concepts before reading on in this documentation.

+SyntacticModels.jl · SyntacticModels.jl

SyntacticModels.jl

SyntacticModels.jl is a Julia library for representing models as syntactic expressions.

The driving example for this library is the need to interoperate models between programming languages in the DARPA ASKEM Program. The AlgebraicJulia ecosystem includes some great tools for specifying modeling languages, but they are deeply connected to the Julia language. This package aims to provide simple tools for specifying domain specific programming languages that can be used to exchange the specification of scientific models between host languages.

We heavily use the MLStyle.jl package for defining Algebraic Data Types so you should familiarize yourself with those concepts before reading on in this documentation.