Closed jsheunis closed 1 month ago
could this all be done via LinkML? i.e. creating a class to represent a PropertyGroup and then a slot annotation representing sh:group that is added for each slot that one wants to add to a specific group? I haven't thought this through well enough...
In its current state, shaclgen.py
exports a ttl file with only sh:nodeShape
s and associated sh:propertyShape
s. It would not currently be able to export sh:PropertyGroup
s. It would be possible to change the code to do that, e.g. also include a list of sh:PropertyGroup
s from some source (tbd if that would also be linkml schemas or a sidecar ttl file for example).
Note: I am not sure whether this would be a general enough feature for a merge into upstream. It pertains mainly (only?) to schemas that are used to generate user interfaces, and would have no benefit (that I can think of) for validation e.g..
An idea could be to have a separate LinkML schema for the property groups. Then someone authoring a schema for the auto-generation of a UI should also provide a yaml data file with the property groups. A wrapping script, e.g. gen-shacl-ui
could be called with arguments:
which will then:
gen-shacl
on the main schema
With work being done on https://github.com/psychoinformatics-de/shacl-vue/issues/11, it's becoming clearer (to me) that a mechanism is necessary for providing structure to the rendering of a viewer or editor of metadata, such that users will find it intuitive to interact with. So far, the use of SHACL's
PropertyGroup
s andsh:order
(on the level of property groups, and on the level of properties themselves, whether they are associated with a group or not) has proved to be a practical way to achieve such intuitive structure. See for example this screenshot of a local prototype:Properties of a
Distribution
are grouped into topical categories (Basic
,Data
,Parts
,Provenance
, etc) which are ordered, and in turn specificDistribution
properties are associated with these categories and ordered within categories. This already provides more structure than a flat list of unorderedDistribution
properties.The question is, though, where and how should this structure be provided?
In the example, the relevant
PropertyGroup
s and their linkage (viash:group
) to specific property shapes have been injected into the turtle file that contains all SHACL node shapes for the LinkML authoredDistribution
schema, exported usinggen-shacl
. But this doesn't seem like a portable way to author a form structure.Some thoughts:
PropertyGroup
and then a slot annotation representingsh:group
that is added for each slot that one wants to add to a specific group? I haven't thought this through well enough...Distribution
) will have properties and relationships to other classes that are imported into said schema, and also exported to e.g. SHACL. Therefore a form based on e.g. theDistribution
schema will necessarily also be a form for imported classes, e.g. aResource
or anEntity
. It would be suboptimal if structure were only provided to the root-level schema, and not to others. OTOH, this would imply a lot of work to provide structure to all classes that are imported into and referenced by a specific schema and therefore present in a SHACL export.