{"library":"shexjsg","title":"ShExJSG","description":"ShExJSG is a Python library that provides an abstract syntax tree (AST) for the ShEx 2.0 schema language, built on PyJSG and Antlr. It is used for parsing, validating, and generating ShEx schemas. Current version is 0.8.2, with a history of adaptation to newer rdflib and Python versions.","language":"python","status":"active","last_verified":"Mon Apr 27","install":{"commands":["pip install shexjsg"],"cli":null},"imports":["from shexjsg import ShExJ","from shexjsg.schema import Schema"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from shexjsg import ShExJ\nfrom rdflib import Graph\nimport json\n\n# Create a simple schema\nschema_json = '''{\n  \"@context\": \"http://www.w3.org/ns/shex.jsonld\",\n  \"type\": \"Schema\",\n  \"shapes\": [\n    {\n      \"id\": \"http://example.org/FooShape\",\n      \"type\": \"Shape\",\n      \"expression\": {\n        \"type\": \"TripleConstraint\",\n        \"predicate\": \"http://example.org/p\",\n        \"valueExpr\": {\n          \"type\": \"NodeConstraint\",\n          \"datatype\": \"http://www.w3.org/2001/XMLSchema#string\"\n        }\n      }\n    }\n  ]\n}'''\n\n# Parse and load schema\nschema = ShExJ()\nschema.loads(schema_json)\nprint('Schema loaded successfully')\nprint(json.dumps(schema.as_dict(), indent=2))","lang":"python","description":"Parses a ShEx schema from a JSON string using ShExJSG.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}