-
Notifications
You must be signed in to change notification settings - Fork 2
/
skos.shacl.ttl
189 lines (178 loc) · 5.21 KB
/
skos.shacl.ttl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
@prefix : <http://skohub.io/skohub-shacl> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix sdo: <https://schema.org> .
# declare the skos prefix to use it in later SPARQL-based constraints
skos:
a owl:Ontology ;
sh:declare [
sh:prefix "skos" ;
sh:namespace "http://www.w3.org/2004/02/skos/core#"^^xsd:anyURI ;
] ,
[
sh:prefix "sh" ;
sh:namespace "https://www.w3.org/ns/shacl#"^^xsd:anyURI ;
] .
####################
# ConceptSchemes
####################
:DisjointConceptAndConceptScheme
a sh:NodeShape ;
sh:targetClass skos:Concept ;
sh:sparql [
sh:prefixes skos: ;
sh:message "S9: skos:ConceptScheme is disjoint with skos:Concept." ;
sh:select """
SELECT $this
WHERE {
$this a skos:ConceptScheme
}""" ;
] ;
.
:DisjointConceptSchemeAndConcept
a sh:NodeShape ;
sh:targetClass skos:ConceptScheme ;
sh:sparql [
sh:prefixes skos: ;
sh:message "S9: skos:ConceptScheme is disjoint with skos:Concept." ;
sh:select """
SELECT $this
WHERE {
$this a skos:Concept
}""" ;
] ;
.
###################
# Lexical Labels
###################
:LexicalLabels
a sh:NodeShape ;
sh:targetSubjectsOf skos:prefLabel ;
sh:targetSubjectsOf skos:altLabel ;
sh:targetSubjectsOf skos:hiddenLabel ;
sh:property [
sh:path skos:prefLabel ;
sh:message "S13: skos:prefLabel, skos:altLabel and skos:hiddenLabel are pairwise disjoint properties." ;
sh:disjoint skos:altLabel ;
sh:disjoint skos:hiddenLabel ;
] ;
sh:property [
sh:path skos:altLabel ;
sh:message "S13: skos:prefLabel, skos:altLabel and skos:hiddenLabel are pairwise disjoint properties." ;
sh:disjoint skos:hiddenLabel ;
sh:disjoint skos:prefLabel ;
] ;
sh:property [
sh:path skos:hiddenLabel ;
sh:message "S13: skos:prefLabel, skos:altLabel and skos:hiddenLabel are pairwise disjoint properties." ;
sh:disjoint skos:altLabel ;
sh:disjoint skos:prefLabel ;
] ;
sh:property [
sh:path skos:prefLabel ;
sh:message "S14: A resource has no more than one value of skos:prefLabel per language tag." ;
sh:datatype rdf:langString ;
sh:uniqueLang true ;
] ;
.
######################
# Semantic Relations
######################
:SemanticRelationsS27
a sh:NodeShape ;
sh:targetSubjectsOf skos:broader ;
sh:targetSubjectsOf skos:related ;
sh:property [
sh:path skos:related ;
sh:message "S27: skos:related is disjoint with the property skos:broaderTransitive." ;
sh:disjoint skos:broader ;
sh:disjoint skos:broaderTransitive ;
sh:disjoint skos:narrower ;
sh:disjoint skos:narrowerTransitive ;
] ;
.
:SemanticRelationsS19S20
a sh:NodeShape ;
sh:targetObjectsOf skos:broader ;
sh:targetObjectsOf skos:narrower ;
sh:targetObjectsOf skos:related ;
sh:targetSubjectsOf skos:broader ;
sh:targetSubjectsOf skos:narrower ;
sh:targetSubjectsOf skos:related ;
sh:sparql [
sh:prefixes skos: ;
sh:message "S19/S20: domain and range of SKOS semantic relations is the class skos:Concept. " ;
sh:select """
SELECT $this
WHERE {
FILTER NOT EXISTS { $this a skos:Concept .}
}""" ;
] ;
.
######################
# Concept Collections
######################
:DisjointConceptAndCollection
a sh:NodeShape ;
sh:targetSubjectsOf skos:narrower ;
sh:targetSubjectsOf skos:broader ;
sh:targetSubjectsOf skos:related ;
sh:sparql [
sh:prefixes skos: ;
sh:message "S37: skos:Concept is disjoint with skos:Collection." ;
sh:select """
SELECT $this
WHERE {
$this a skos:Collection .
}""" ;
] ;
.
:DisjointConceptSchemeAndCollection
a sh:NodeShape ;
sh:targetSubjectsOf skos:topConceptOf ;
sh:targetSubjectsOf skos:inScheme ;
sh:sparql [
sh:prefixes skos: ;
sh:message "S37: skos:ConceptScheme is disjoint with skos:Collection." ;
sh:select """
SELECT $this
WHERE {
$this a skos:Collection
}""" ;
] ;
.
#############################
# Mapping Properties
#############################
:DisjointMappingRelations
a sh:NodeShape ;
sh:property [
sh:path skos:exactMatch ;
sh:message "S46: skos:exactMatch is disjoint with each of the properties skos:broadMatch and skos:relatedMatch." ;
sh:disjoint skos:broadMatch ;
sh:disjoint skos:relatedMatch ;
sh:disjoint skos:narrowMatch ; #since broadMatch and narrowMatch are inverses
];
sh:property [
sh:path skos:relatedMatch ;
sh:class skos:Concept ;
sh:name "related match" ;
sh:nodeKind sh:IRI ;
] ;
sh:targetObjectsOf skos:broadMatch ;
sh:targetObjectsOf skos:closeMatch ;
sh:targetObjectsOf skos:exactMatch ;
sh:targetObjectsOf skos:narrowMatch ;
sh:targetObjectsOf skos:relatedMatch ;
sh:targetSubjectsOf skos:broadMatch ;
sh:targetSubjectsOf skos:closeMatch ;
sh:targetSubjectsOf skos:exactMatch ;
sh:targetSubjectsOf skos:narrowMatch ;
sh:targetSubjectsOf skos:relatedMatch ;
.