psychoinformatics-de / shacl-vue

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

Linkml range does not always propagate to `shacl` #9

Closed jsheunis closed 1 month ago

jsheunis commented 3 months ago

Many property shapes in gen-shacl output do not have any of these attributes:sh:datatype, sh:nodeKind, or sh:class. This makes it impossible to select the correct property-editor during the automatic form generation process, instead having to rely on a default text-field-editor.

Some digging shows that this is a known issue in LinkML: https://github.com/linkml/linkml/issues/1299 And there's an open PR: https://github.com/linkml/linkml/pull/1300

jsheunis commented 3 months ago

For example, we have the slot:

email:
    slot_uri: dlco:email
    description: Email address associated with an entity.
    exact_mappings:
      - schema:email
      - obo:IAO_0000429
    range: EmailAddress

where EmailAddress is a type:

types:
  EmailAddress:
    uri: dlco:EmailAddress
    base: str
    description: RFC 5322 compliant email address
    pattern: '(?:[a-z0-9!#$%&''*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&''*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])'
    notes:
      - The validation regex is taken from https://stackoverflow.com/a/201378
      - The regex is single-quoted for YAML encoding, hence all inner "'" have been doubled

and the resulting shacl property shape is a mere:

[ sh:description "Email address associated with an entity." ;
      sh:maxCount 1 ;
      sh:order 1 ;
      sh:path dlco:email ],

Note also that apart from the missing datatype or nodekind attributes, the pattern is also missing, as are the exact_mappings from email slot.

jsheunis commented 1 month ago

This is fixed by https://github.com/linkml/linkml/pull/2102