Open jsheunis opened 3 months ago
While json-schema allows the ability to define required properties of a given object on the object itself, shacl doesn't provide this. Rather, sh:minCount 1;
(or a higher integer value) specified on a property(Shape)
of a given NodeShape
will imply that that is a required property for the node.
IIUC
for a property, a combination of sh:nodeKind sh:IRI ;
and sh:class <class> ;
should be interpreted (by a form renderer) as the linkml equivalent of inlined: false
that is combined with a class as the range
. On the form side, this should likely be rendered as two components: a entry component for the class (which should be defined by its own sh:NodeShape
) AND a dropdown (or similar) component where the user can select from all local instances of the class.
for a property, a combination of sh:nodeKind sh:BlankNode ;
and sh:class <class> ;
should be interpreted (by a form renderer) as the linkml equivalent of inlined: true
that is combined with a class as the range
. On the form side, this should likely be rendered as an in-place entry component for the class (which should be defined by its own sh:NodeShape
). Possibly, this could imply that the relevant nodeshape
should not be editable elsewhere, i.e. that the only place where a user can enter data for said nodeshape is within the context of the mentioned property.
How to get the form hierarchy from shacl shapes graph?
SHACL works with a graph of
NodeShape
s and doesn't impose a hierarchy of nodes in the way that jsonschema might do. E.g. with linkml'sgen-json-schema
, one can supply the following option (see: https://linkml.io/linkml/generators/json-schema.html#docs):which provides the root for the data validation hierarchy. AFAIK, shacl doesn't have this. It's not necessary when validating all nodes of a data graph, but it is important for the human-level interpretability of a form generated from shacl. This will need to be figured out.