ShExJSG - Astract Syntax Tree Definition for the ShEx 2.0 language
Low maintenance activity. Last release 7 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install shexjsgThis repository was originally developed by Harold Solbrig and was kindly contributed to the LinkML organization because of his retirement. All credit for the original development of this repository goes to him.
ShExJSG -
Python representation of the ShEx AST(ish) specification.
Use:
from ShExJSG import Schema, ShExJ
from PyShExC import ShExC
from pyjsg.jsglib.loader import is_valid
schema = Schema()
schema.start = ShExJ.Shape()
print(is_valid(schema))
print(schema._as_json_dumps())
print(str(ShExC(schema)))
True
{
"@context": "http://www.w3.org/ns/shex.jsonld",
"start": {
"type": "Shape"
},
"type": "Schema"
}
start= { }
ShExJ.jsg
This file is derived from the ShEx JSG specification. The differences are as follows:
labeledShapeExpr- The official JSG implemention specifies a strange pattern where the objects with atypeof"ShapeOr","ShapeAnd", ... are recognized as instances ofShapeOr,ShapeAnd, ... if they lack anidelement and aslabeledShapeOr,labeledShapeAnd, ... if theidelement exists. We simplify this construct, leavingidoptional. This potentially allows the parser to accept some highly unlikely invalid constructs, but these can be checked in a post-parse step if you feel deeply about it. (Note also that the ShEx semantics document does not include thelabeledShapeExprbranch)- This uses the revised jsg syntax.