Generate a JSON-LD context

This utility generates a JSON-LD context document from a SHACL specification. Detailed documentation is available below.

  Shapes

Remove Select file Change
You can select multiple files. Supported extensions : .rdf, .ttl, .n3, .trig, or .zip. You can also upload Excel files (see SHACL in Excel).
URL of an RDF file. Same extensions as file upload are supported.
Supported syntaxes : Turtle, RDF/XML, JSON-LD, TriG, TriX, N-Quads. We recommend Turtle.

Documentation

JSON-LD context document generation algorithm

The algorithm follow these steps to generate the JSON-LD context:

  1. Always add a mapping from id, type and graph to @id, @type and @graph respectively.
  2. Add prefix mappings for each known prefixes in the SHACL file.
  3. Add mappings with the URI of targets of NodeShapes in the SHACL (reading sh:targetClass, or for shapes that are themselves classes), using the local part of the URI as JSON key.
  4. Add mappings with the URI of properties referred to in 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 :
    1. Determine the @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.)
    2. Determine the @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
    3. If the sh:datatype is rdf:langString, add @container with value @language
    4. If no max cardinality is specified, or if max cardinality is greater than 1, and no other @container was set, add @container with value @set
    5. If an 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.