Skip to content

Instantly share code, notes, and snippets.

@VladimirAlexiev
Last active April 21, 2022 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VladimirAlexiev/ec6ea0878d7813c1d2cd4d7a0c696564 to your computer and use it in GitHub Desktop.
Save VladimirAlexiev/ec6ea0878d7813c1d2cd4d7a0c696564 to your computer and use it in GitHub Desktop.
@prefix nomo: <https://nomenclature.info/nom/ontology/> .
@prefix nomShape: <https://nomenclature.info/nom/shape/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix skosxl: <http://www.w3.org/2008/05/skos-xl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix nom: <https://nomenclature.info/nom/> .
nomShape:parentConcept
a sh:NodeShape ;
sh:class skos:Concept ;
sh:property [] .
nomShape:concept a sh:NodeShape ;
sh:class skos:Concept ;
sh:property [ sh:maxCount 1 ;
sh:message "Concepts must either have skos:topConcept pointing to the nom: scheme, or have a parent that's in the same scheme" ;
sh:minCount 1 ;
sh:or ( [ sh:hasValue nom: ]
[ sh:node nomShape:parentConcept ]
) ;
sh:path [ sh:alternativePath ( skos:topConceptOf skos:broader ) ]
] ;
sh:property [ sh:datatype rdf:langString ;
sh:languageIn ( "fr" ) ;
sh:maxCount 1 ;
sh:message "There must be a preferred label in French" ;
sh:minCount 1 ;
sh:path skos:prefLabel
] ;
sh:property [ sh:datatype rdf:langString ;
sh:message "Concepts can have only one preferred label per language" ;
sh:minCount 1 ;
sh:path skos:prefLabel ;
sh:uniqueLang true
] ;
sh:property [ sh:datatype xsd:integer ;
sh:maxCount 1 ;
sh:maxInclusive 6 ;
sh:message "(Non-top) concepts must have level that is greater than its parent's level" ;
sh:minCount 1 ;
sh:minInclusive 1 ;
sh:not [ sh:lessThanOrEquals ( skos:broader nomo:level ) ] ;
sh:path nomo:level
] ;
sh:property [ sh:hasValue nom: ;
sh:maxCount 1 ;
sh:message "All concepts must be in the nom: concept scheme" ;
sh:minCount 1 ;
sh:path skos:inScheme
] ;
sh:property [ sh:datatype rdf:langString ;
sh:languageIn ( "en" ) ;
sh:maxCount 1 ;
sh:message "There must be a preferred label in English" ;
sh:minCount 1 ;
sh:path skos:prefLabel
] ;
sh:property [ sh:datatype rdf:langString ;
sh:path skos:altLabel
] ;
sh:targetSubjectsOf skos:inScheme .
PREFIX nom: <https://nomenclature.info/nom/>
PREFIX nomo: <https://nomenclature.info/nom/ontology/>
PREFIX nomShape: <https://nomenclature.info/nom/shape/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX skosxl: <http://www.w3.org/2008/05/skos-xl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
shape nomShape:concept {
class = skos:Concept
targetSubjectsOf = skos:inScheme.
skos:inScheme hasValue=nom:
message="All concepts must be in the nom: concept scheme" [1..1].
nomo:level xsd:integer minInclusive=1 maxInclusive=6 !lessThanOrEquals=[skos:broader nomo:level]
message="(Non-top) concepts must have level that is greater than its parent's level" [1..1].
skos:topConceptOf|skos:broader hasValue=nom:|@nomShape:parentConcept
message="Concepts must either have skos:topConcept pointing to the nom: scheme, or have a parent that's in the same scheme" [1..1].
skos:prefLabel rdf:langString uniqueLang=true
message="Concepts can have only one preferred label per language" [1..*].
skos:prefLabel rdf:langString languageIn=["en"]
message="There must be a preferred label in English" [1..1].
skos:prefLabel rdf:langString languageIn=["fr"]
message="There must be a preferred label in French" [1..1].
skos:altLabel rdf:langString.
}
shape nomShape:parentConcept {
class = skos:Concept.
skos:inScheme hasValue=nom: [1..1].
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment