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

Improve SHACL schema #421

Open
8 tasks
Tracked by #384
VladimirAlexiev opened this issue Apr 23, 2024 · 0 comments
Open
8 tasks
Tracked by #384

Improve SHACL schema #421

VladimirAlexiev opened this issue Apr 23, 2024 · 0 comments
Labels
bug Something isn't working RDF impact to RDF

Comments

@VladimirAlexiev
Copy link

VladimirAlexiev commented Apr 23, 2024

https://github.com/admin-shell-io/aas-specs/blob/master/schemas/rdf/shacl-schema.ttl

  • remove owl:imports <http://datashapes.org/dash> since it doesn't use DASH shape constructs
  • remove owl:imports sh: since it doesn't use shapes from that URL (see https://book.validatingrdf.com/bookHtml011.html#sec126)
  • remove ^^xs:string since that's default therefore redundant
  • maybe rename the ontology URL from aas: to a different one (eg aas-sh:). I personally like the practice to conflate the ontology and shape namespace
  • Simplify aas:AbstractLangStringShape as per enable the use of lang tags for langString #382 (comment) (will become sh:datatype rdf:langString in 2 prop shapes). In particular:
    • I doubt this is 100% correct, and there's no need to specify what a lang tag is
      sh:pattern "^(([a-zA-Z]{2,3}(-[a-zA-Z]{3}(-[a-zA-Z]{3}){2})?|[a-zA-Z]{4}|[a-zA-Z]{5,8})(-[a-zA-Z]{4})?(-([a-zA-Z]{2}|[0-9]{3}))?(-(([a-zA-Z0-9]){5,8}|[0-9]([a-zA-Z0-9]){3}))*(-[0-9A-WY-Za-wy-z](-([a-zA-Z0-9]){2,8})+)*(-[xX](-([a-zA-Z0-9]){1,8})+)?|[xX](-([a-zA-Z0-9]){1,8})+|((en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang)))$" ;
    • This is wrong, since if a node doesn't ever have aas:AbstractLangString, that node shape won't have any effect
      FILTER (?type = aas:AbstractLangString)
  • Don't use SHACL Advanced because it's more expensive. You can use a single SHACL standard shape for all "abstract class. Please use one of the subclasses". But if you want to target by these abstract classes (aas:AbstractLangString, aas:HasDataSpecificationShape etc), you need to mandate RDFS subclass reasoning, and complicate the shape to look for some rdf:type outside of the list:
aas:NoAbstractClassShape a sh:NodeShape ;
  sh:targetClass aas:DataElement,  aas:DataSpecificationContent, aas:EventElement, ...;
  sh:not [sh:path rdf:type; sh:in (aas:DataElement aas:DataSpecificationContent aas:EventElement ...)];
  sh:message "This is an abstract class. Please use one of the subclasses for the generation of instances."@en.
  • Remove this first pattern wherever possible. It says "only printable Unicode chars" and most of the time is redundant (eg digits are printable chars)
    sh:pattern "^[\\x09\\x0A\\x0D\\x20-\\uD7FF\\uE000-\\uFFFD\\U00010000-\\U0010FFFF]*$" ;
    sh:pattern "^(0|[1-9][0-9]*)$" ;
  • Declaring a shape subClassOf another shape is questionable at best (a Shape is not a Class, so it cannot be a subClass). What is the purpose of this? (shapes are not inherited this way)
    rdfs:subClassOf aas:HasDataSpecificationShape ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working RDF impact to RDF
Projects
None yet
Development

No branches or pull requests

2 participants