-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create SummationDecapode.json * Update SummationDecapode.json fill in title and description fields * use ty key in SummationDecapode.json * Export to jsonschema * Update setup.cfg * Update conf.py * Update conf.py * Update --------- Co-authored-by: Charles Tapley Hoyt <[email protected]>
- Loading branch information
1 parent
8f35a6a
commit 8571a09
Showing
5 changed files
with
344 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
{ | ||
"version": { | ||
"ACSets": "0.0.0", | ||
"Catlab": "0.0.0", | ||
"ACSetSchema": "0.0.1" | ||
}, | ||
"Ob": [ | ||
{ | ||
"name": "Var", | ||
"description": null, | ||
"title": "Variable" | ||
}, | ||
{ | ||
"name": "TVar", | ||
"description": null, | ||
"title": "Tangent Variable" | ||
}, | ||
{ | ||
"name": "Op1", | ||
"description": null, | ||
"title": "Unary Operation" | ||
}, | ||
{ | ||
"name": "Op2", | ||
"description": null, | ||
"title": "Bianry Operation" | ||
}, | ||
{ | ||
"name": "Σ", | ||
"description": null, | ||
"title": "Summation" | ||
}, | ||
{ | ||
"name": "Summand", | ||
"description": null, | ||
"title": "Summand" | ||
} | ||
], | ||
"Hom": [ | ||
{ | ||
"name": "src", | ||
"codom": "Var", | ||
"dom": "Op1", | ||
"description": null, | ||
"title": "Source" | ||
}, | ||
{ | ||
"name": "tgt", | ||
"codom": "Var", | ||
"dom": "Op1", | ||
"description": null, | ||
"title": "Target" | ||
}, | ||
{ | ||
"name": "proj1", | ||
"codom": "Var", | ||
"dom": "Op2", | ||
"description": null, | ||
"title": "First Argument" | ||
}, | ||
{ | ||
"name": "proj2", | ||
"codom": "Var", | ||
"dom": "Op2", | ||
"description": null, | ||
"title": "Second Argument" | ||
}, | ||
{ | ||
"name": "res", | ||
"codom": "Var", | ||
"dom": "Op2", | ||
"description": null, | ||
"title": "Result" | ||
}, | ||
{ | ||
"name": "incl", | ||
"codom": "Var", | ||
"dom": "TVar", | ||
"description": null, | ||
"title": "Inclusion of Tangent Variables" | ||
}, | ||
{ | ||
"name": "summand", | ||
"codom": "Var", | ||
"dom": "Summand", | ||
"description": null, | ||
"title": "summand" | ||
}, | ||
{ | ||
"name": "summation", | ||
"codom": "Σ", | ||
"dom": "Summand", | ||
"description": null, | ||
"title": "summation" | ||
}, | ||
{ | ||
"name": "sum", | ||
"codom": "Var", | ||
"dom": "Σ", | ||
"description": null, | ||
"title": "result of summation" | ||
} | ||
], | ||
"AttrType": [ | ||
{ | ||
"name": "Type", | ||
"description": "The DEC type of a variable, not a python type", | ||
"title": "Variable Type", | ||
"ty": "str" | ||
}, | ||
{ | ||
"name": "Operator", | ||
"description": "The DEC operator name", | ||
"title": "Operator", | ||
"ty": "str" | ||
}, | ||
{ | ||
"name": "Name", | ||
"description": null, | ||
"title": "Name", | ||
"ty": "str" | ||
} | ||
], | ||
"Attr": [ | ||
{ | ||
"name": "op1", | ||
"codom": "Operator", | ||
"dom": "Op1", | ||
"description": null, | ||
"title": "Operation" | ||
}, | ||
{ | ||
"name": "op2", | ||
"codom": "Operator", | ||
"dom": "Op2", | ||
"description": null, | ||
"title": "Binary Operation" | ||
}, | ||
{ | ||
"name": "type", | ||
"codom": "Type", | ||
"dom": "Var", | ||
"description": null, | ||
"title": "Variable Type" | ||
}, | ||
{ | ||
"name": "name", | ||
"codom": "Name", | ||
"dom": "Var", | ||
"description": null, | ||
"title": "Variable Name" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"""This script turns all the catlab schemata into json schemata""" | ||
|
||
from pathlib import Path | ||
from acsets import ( | ||
CATLAB_SCHEMAS_DIRECTORY, | ||
ACSet, | ||
Attr, | ||
AttrType, | ||
CatlabSchema, | ||
Hom, | ||
Ob, | ||
petris, | ||
Schema, | ||
) | ||
|
||
HERE = Path(__file__).parent.resolve() | ||
CATLAB = HERE.joinpath("catlab") | ||
JSONSCHEMA = HERE.joinpath("jsonschema") | ||
|
||
|
||
def main(): | ||
"""Convert any Catlab schemas into JSON schemas""" | ||
for catlab_path in CATLAB.glob("*.json"): | ||
jsonschema_path = JSONSCHEMA.joinpath(catlab_path.name) | ||
if jsonschema_path.is_file(): | ||
continue | ||
print(f"Parsing Catlab Schema from {catlab_path}") | ||
catlab_schema = CatlabSchema.parse_file(catlab_path) | ||
print("Getting Schema from Catlab schema") | ||
schema = Schema.from_catlab(catlab_path.name, catlab_schema) | ||
schema.write_schema( | ||
jsonschema_path, | ||
uri="https://raw.githubusercontent.com/AlgebraicJulia/py-acsets/main/src/acsets/{}".format( | ||
Path(jsonschema_path).relative_to(HERE) | ||
), | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
{ | ||
"$id": "https://raw.githubusercontent.com/AlgebraicJulia/py-acsets/main/src/acsets/jsonschema/SummationDecapode.json", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"definitions": { | ||
"Op1": { | ||
"properties": { | ||
"op1": { | ||
"title": "Op1", | ||
"type": "string" | ||
}, | ||
"src": { | ||
"title": "Src", | ||
"type": "integer" | ||
}, | ||
"tgt": { | ||
"title": "Tgt", | ||
"type": "integer" | ||
} | ||
}, | ||
"title": "Op1", | ||
"type": "object" | ||
}, | ||
"Op2": { | ||
"properties": { | ||
"op2": { | ||
"title": "Op2", | ||
"type": "string" | ||
}, | ||
"proj1": { | ||
"title": "Proj1", | ||
"type": "integer" | ||
}, | ||
"proj2": { | ||
"title": "Proj2", | ||
"type": "integer" | ||
}, | ||
"res": { | ||
"title": "Res", | ||
"type": "integer" | ||
} | ||
}, | ||
"title": "Op2", | ||
"type": "object" | ||
}, | ||
"Summand": { | ||
"properties": { | ||
"summand": { | ||
"title": "Summand", | ||
"type": "integer" | ||
}, | ||
"summation": { | ||
"title": "Summation", | ||
"type": "integer" | ||
} | ||
}, | ||
"title": "Summand", | ||
"type": "object" | ||
}, | ||
"TVar": { | ||
"properties": { | ||
"incl": { | ||
"title": "Incl", | ||
"type": "integer" | ||
} | ||
}, | ||
"title": "TVar", | ||
"type": "object" | ||
}, | ||
"Var": { | ||
"properties": { | ||
"name": { | ||
"title": "Name", | ||
"type": "string" | ||
}, | ||
"type": { | ||
"title": "Type", | ||
"type": "string" | ||
} | ||
}, | ||
"title": "Var", | ||
"type": "object" | ||
}, | ||
"_": { | ||
"properties": { | ||
"sum": { | ||
"title": "Sum", | ||
"type": "integer" | ||
} | ||
}, | ||
"title": "Σ", | ||
"type": "object" | ||
} | ||
}, | ||
"properties": { | ||
"Op1": { | ||
"items": { | ||
"$ref": "#/definitions/Op1" | ||
}, | ||
"title": "Op1", | ||
"type": "array" | ||
}, | ||
"Op2": { | ||
"items": { | ||
"$ref": "#/definitions/Op2" | ||
}, | ||
"title": "Op2", | ||
"type": "array" | ||
}, | ||
"Summand": { | ||
"items": { | ||
"$ref": "#/definitions/Summand" | ||
}, | ||
"title": "Summand", | ||
"type": "array" | ||
}, | ||
"TVar": { | ||
"items": { | ||
"$ref": "#/definitions/TVar" | ||
}, | ||
"title": "Tvar", | ||
"type": "array" | ||
}, | ||
"Var": { | ||
"items": { | ||
"$ref": "#/definitions/Var" | ||
}, | ||
"title": "Var", | ||
"type": "array" | ||
}, | ||
"Σ": { | ||
"items": { | ||
"$ref": "#/definitions/_" | ||
}, | ||
"title": "Σ", | ||
"type": "array" | ||
} | ||
}, | ||
"required": [ | ||
"Var", | ||
"TVar", | ||
"Op1", | ||
"Op2", | ||
"Σ", | ||
"Summand" | ||
], | ||
"title": "SummationDecapode.json", | ||
"type": "object" | ||
} |