validationontologyknowledge-graphshacl

Using SHACL to validate if one specific language tag is present in repeated annotation properties


we would like to specify for our ontology, that each class must at least have a skos:definition in English, but translations (also described as skos:definition with a different language tag) are welcome. I would like to specify a SHACL-Shape to check if that condition is met.

A simple valid example of a class definition:

ex:ExampleClass a owl:Class ;
  skos:definition "An example Class"@en, "Eine Beispielklasse"@de .

The only thing I found which seemed helpful in that area is sh:languageIn. Unfortunately, as I understand it, it only checks if all language tags are part of a given set.

ex:Pattern1 a sh:NodeShape ;
  sh:targetClass owl:Class ;
  sh:property [
    sh:path skos:definition ;
    sh:datatype rdf:langString ;
    sh:languageIn (
      "en"
    ) ;
  ] .

Unfortunately, stackoverflows spam filter seems to hinder me from posting the ttl blocks with prefixes. Therefore, I provide that in a gist: https://gist.github.com/MattTJung/8739566f550c85d9ab3c862267a7675b

How can I alter this, to make sure there is at least one occurence of @en, but still allow for other language tags?


Solution

  • The hint given by @HolgerKnublauch pushed me on the right path, thank you.

    ex:Pattern1 a sh:NodeShape ;
        sh:targetClass owl:Class ;
        sh:property [
          sh:path skos:definition ;
          sh:qualifiedMinCount 1;
          sh:qualifiedValueShape [
            sh:datatype rdf:langString ;
            sh:languageIn ( "en" ) ;
          ] ;
        ] .