This utility generates a JSON-LD context document from a SHACL specification. Detailed documentation is available below.
The algorithm follow these steps to generate the JSON-LD context:
id, type and graph
to @id, @type and @graph respectively.sh:targetClass, or for shapes that are themselves classes), using the local part of the URI as JSON key.
sh:path in the SHACL. SHACL property paths are not supported.
By default, the local part of the property URI is used as key, but a different JSON key can be specified by annotating the property shape
with the property https://shacl-play.sparna.fr/ontology#shortname (if the same property is referred to by multiple property shapes
annotated with different shortname, the first one is used). Then :
@type from datatypes : read the sh:datatype on property shapes referring to the property.
If there is one, use it as the value of @type (if the same property is referred to by multiple property shapes
with different sh:datatype, the first one is used.)
@type from URI reference : if there are sh:class, sh:node, or if
sh:nodeKind = sh:IRI or sh:BlankNodeOrIRI, set the @type to @id
sh:datatype is rdf:langString, add @container with value @language
@container was set, add @container with value @set
sh:pattern is specified on the property shape, and the property is an IRI property, and this pattern specifies the beginning of URIs,
add a scoped context for this property with a @base indication using the pattern value.