-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathno_multiple_parents.sparql
More file actions
43 lines (37 loc) · 1.04 KB
/
no_multiple_parents.sparql
File metadata and controls
43 lines (37 loc) · 1.04 KB
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
# Title:
# No multiple inheritance
# Constraint Description:
# Classes have at most one immediate asserted parent.
# Severity:
# Error
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT ?class ?label
(COUNT(DISTINCT ?parent) AS ?parentCount)
(GROUP_CONCAT(DISTINCT STR(?parentLabel); separator=" | ") AS ?parentLabels)
?warningMessage
WHERE {
?class a owl:Class ;
rdfs:label ?label ;
rdfs:subClassOf ?parent .
FILTER (!ISBLANK(?class)) .
FILTER (!ISBLANK(?parent)) .
FILTER (?parent != owl:Thing) .
FILTER (?parent != owl:Nothing) .
FILTER (?parent != ?class) .
?parent a owl:Class .
OPTIONAL {
?parent rdfs:label ?parentLabel .
}
BIND (
CONCAT(
"Warning: Class ",
STR(?label),
" has too many direct asserted superclass parents."
)
AS ?warningMessage
)
}
GROUP BY ?class ?label ?warningMessage
HAVING (COUNT(DISTINCT ?parent) > 2)