Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate form editor objects from targetClass and not shape name #38

Open
jsheunis opened this issue Jul 29, 2024 · 0 comments
Open

Generate form editor objects from targetClass and not shape name #38

jsheunis opened this issue Jul 29, 2024 · 0 comments

Comments

@jsheunis
Copy link
Collaborator

The current implementation of gen-shacl gives a sh:nodeShape the same name as the LinkML class that it was generated from; and then assigns the same as the targetClass

e.g.:

dldist:Person a sh:NodeShape ;
    sh:closed true ;
    ...
    sh:targetClass dldist:Person .

For SHACL-based validation purposes, the sh:targetClass specifies the target, and not the name of the nodeshape. The example could just as well have been:

dldist:MyPersonShape a sh:NodeShape ;
    sh:closed true ;
    ...
    sh:targetClass dldist:Person .

The form should show the name of the field as "dldist:Person" and not "dldist:MyPersonShape". The current shacl-vue code in https://github.com/psychoinformatics-de/shacl-vue/blob/main/src/composables/shapedata.js uses the nodeshape name, i.e. this has to be corrected to use sh:targetClass

Relevant LinkML issue: linkml/linkml#2084, which suggests using a shape annotation to redefine the name of the nodeshape in the exported shacl. This is strictly not necessary here, since a shift to using the sh:targetClass will in any case ignore the nodeshape name.

An important additional aspect to note from the SHACL standard is Implicit Class targets:

Informally, if a shape is also declared to be a class in the shapes graph then all SHACL instances of this class are a target for the shape.

I interpret this to mean the following

  • a sh:nodeshape might not always have sh:targetclass defined (the target is actually orthogonal to class, since there are different types of shacl targets: https://www.w3.org/TR/shacl/#targets (TODO: shacl-vue code needs to take this into account))
  • if a sh:nodeshape does not have a target defined (and here, more concretely a sh:targetclass), then see if the same nodeshape is also defined as a rdfs:Class in the same shapes graph: if true, use the shape name as the sh:targetclass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant