psychoinformatics-de / shacl-vue

https://psychoinformatics-de.github.io/shacl-vue/
MIT License
0 stars 0 forks source link

Some random notes #8

Open jsheunis opened 3 months ago

jsheunis commented 3 months ago

How to get the form hierarchy from shacl shapes graph?

SHACL works with a graph of NodeShapes and doesn't impose a hierarchy of nodes in the way that jsonschema might do. E.g. with linkml's gen-json-schema, one can supply the following option (see: https://linkml.io/linkml/generators/json-schema.html#docs):

-t, --top-class <top_class>
Top level class; slots of this class will become top level properties in the json-schema

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.

jsheunis commented 3 months ago

Required properties

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.

jsheunis commented 3 months ago

Inlining/referencing in terms of shacl

IIUC

  1. 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.

  2. 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.