SHACL documentation

  Shapes

Remove Select file Change
You can select multiple files. Supported extensions : .rdf, .ttl, .n3, .trig. Other extensions will be treated as RDF/XML
To have your Shapes in the catalog, add it to the catalog Github repository.
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.

  Options

Check if you want the UML diagram to be included in the generated documentation. Not all structure of Shapes file can produce a nice UML diagram.
The logo must be accessible at a URL. SVG is not supported if printed in PDF.
The diagram is never included in the PDF

Documentation

This documentation generation utility prints an application profile specified in SHACL. It supports a subset of SHACL constraints.

The generated documentation describes all the properties allowed on each class/shape of the application profile, and includes a diagram, namespace table, introduction, and some metadata at the top of the document.

Sample file

To test, and to better understand how the documentation generation works you can download this turtle example of an application profile specified in SHACL , or the corresponding Excel file This Excel file can be converted in SHACL using the SKOS Play xls2rdf conversion tool. All the details about the conversion rules are documented in the converter page. This documentation focuses on which SHACL constraints are used to produce the documentation.

owl:Ontology header

The documentation generation reads the following properties on a owl:Ontology entity in the SHACL file.

Property Type Required Description
dcterms:title if present, or rdfs:label xsd:string Yes Generates the title of the document
rdfs:comment xsd:string No Generates an Abstract section in the documentation, if present.
dcterms:description xsd:string No Generates a Description section in the generated documentation, if present.
dcterms:modified xsd:dateTime No Shown in the header of the generated documentation
dcterms:created xsd:dateTime No Shown in the header of the generated documentation
dcterms:creator (+ rdfs:label) IRI or Literal No Shown in the header of the generated documentation. If the value is an IRI, and if it has an rdfs:label, use this as the label of the link; otherwise the URI will be shown.
dcterms:dateCopyrighted xsd:dateTime No Shown in the header of the generated documentation
dcterms:issued xsd:dateTime No Shown in the header of the generated documentation
dcterms:license (+ rdfs:label) IRI or Literal No Shown in the header of the generated documentation. If the value is an IRI, and if it has an rdfs:label, use this as the label of the link; otherwise the URI will be shown.
dcterms:publisher (+ rdfs:label) IRI or Literal No Shown in the header of the generated documentation. If the value is an IRI, and if it has an rdfs:label, use this as the label of the link; otherwise the URI will be shown.
dcterms:rightsHolder (+ rdfs:label) IRI or Literal No Shown in the header of the generated documentation. If the value is an IRI, and if it has an rdfs:label, use this as the label of the link; otherwise the URI will be shown.
owl:versionInfo xsd:string No Shown in the header of the generated documentation

This is an example of such a header:




This generates the following output:


Prefixes table

The prefixes of the SHACL file are inserted in a ""Namespaces section at the top of the documentation. For example the following prefixes:



Will generate the corresponding output table:

Documentation of Node Shapes

The following properties are read on each sh:NodeShape to populate the header of each section of the generated documentation.

Property Type Required Description
rdfs:label xsd:string Yes Label of the NodeShape used as the label of the section in the documentation.
rdfs:comment xsd:string No Small descriptive paragraph under the section title.
sh:targetClass sh:IRI No Declare all nodes that are instances of some class.
sh:closed xsd:boolean No Indicates if the shape is closed.
sh:pattern xsd:string No Regex specifying the URI pattern that the targets of the NodeShape must conform to.
skos:example IRI or xsd:string No Example of an IRI for a target of this NodeShape. Can be given as an IRI reference or a string.
sh:order xsd:integer No Sections of the generated documentation are sorted according to sh:order on sh:NodeShape, or by label if not present.

This is how it can typically look like in SHACL:



This generates the following output:









Documentation of Property Shapes

The following properties are read on each sh:PropertyShape to populate the properties table in the generated documentation.

Property Expected value Required Description
sh:path IRI Yes Property or property path - each property shape generates one line in the table.
sh:name xsd:string No Used to display the name of the property. If not provided, and if sh:path points to a URI, then an rdfs:label is searched on the property URI indicated in the sh:path. This implies the SHACL file also contains the OWL definition. Otherwise, the column will be empty.
sh:description xsd:string No Populates the Description column of the table. If not provided, and if sh:path points to a URI, then an rdfs:comment is searched on the property URI indicated in the sh:path. This implies the SHACL file also contains the OWL definition. Otherwise the column will be empty.
sh:minCount / sh:maxCount xsd:integer No Used to populate the Cardinality column of the table
sh:node IRI of a NodeShape One of sh:node, sh:class, sh:nodeKind, sh:datatype, sh:or, sh:hasValue must be provided Used to populate the Expected value column, see below.
sh:class IRI of a class One of sh:node, sh:class, sh:nodeKind, sh:datatype, sh:or, sh:hasValue must be provided. Used to populate the Expected value column, see below.
sh:nodeKind Value can be either sh:IRI or sh:Literal One of sh:node, sh:class, sh:nodeKind, sh:datatype, sh:or, sh:hasValue must be provided. Used to populate the Expected value column, see below.
sh:datatype IRI of a datatype One of sh:node, sh:class, sh:nodeKind, sh:datatype, sh:or, sh:hasValue must be provided. Used to populate the Expected value column, see below.
sh:hasValue RDF List of values One of sh:node, sh:class, sh:nodeKind, sh:datatype, sh:or, sh:hasValue must be provided. Used to populate the Expected value column, see below.
sh:or RDF List of blank nodes with a sh:node One of sh:node, sh:class, sh:nodeKind, sh:datatype, sh:or, sh:hasValue must be provided. Used to populate the Expected value column, see below.
sh:in RDF List of values No Used to indicate the possible list of values, as an additionnal information in the Expected value column.
sh:order xsd:integer No Lines of the generated table are sorted according to sh:order.

The Expected value column is generated by looking at the following properties in order of precedence :

  • Use sh:hasValue if present.
  • Otherwise use sh:class
  • Otherwise use sh:node
  • Otherwise use sh:datatype
  • Otherwise use sh:nodeKind
  • Otherwise use sh:or; in this case, get the list items and read sh:node on each of them.
  • Otherwise the column is left empty.

Additionally, if sh:in is present, it is inserted as an additional information in the Expected value column.

This generates the following output: