-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObserveInheritance.rq
81 lines (71 loc) · 2.56 KB
/
ObserveInheritance.rq
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
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xmlsn: <http://xmlns.com/foaf/0.1/familyName>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX jolux: <http://data.legilux.lu/resource/ontology/jolux#>
select ?class ?label ?property ?propertyType (group_concat(distinct COALESCE(?sup, '') ; separator = ", ") AS ?superPropNames) (?inheritedFrom as ?domainFrom) ?restrictionFrom ?rangeName ?cardinality ?comment ?scopeNote ?editorialNote
where
{
{
VALUES ?propertyType {owl:DatatypeAnnotation owl:DatatypeProperty owl:ObjectProperty }
?class rdfs:subClassOf* ?inheritedFrom.
?property rdfs:domain ?inheritedFrom.
?property a ?propertyType.
OPTIONAL {
?property rdfs:subPropertyOf* ?sup.
?sup rdfs:range ?range.
BIND(REPLACE(STR(?range),".*(#|/)","") as ?rangeName).
}
OPTIONAL {
?property rdfs:label ?label
FILTER langMatches(lang(?label), ?wantedLang)
}
OPTIONAL {
?property rdfs:comment ?d.
FILTER langMatches(lang(?d), ?wantedLang)
BIND(REPLACE(REPLACE(?d, ',', ' '), '\n', ' ') AS ?comment).
}
OPTIONAL {
?property skos:scopeNote ?n.
BIND(REPLACE(REPLACE(?n, ',', ' '), '\n', ' ') AS ?scopeNote).
}
OPTIONAL {
?property skos:editorialNote ?e.
BIND(REPLACE(REPLACE(?e, ',', ' '), '\n', ' ') AS ?editorialNote).
}
}
UNION
{
VALUES ?propertyType {owl:DatatypeAnnotation owl:DatatypeProperty owl:ObjectProperty }
?class rdfs:subClassOf* ?restrictionFrom.
?restrictionFrom rdfs:subClassOf ?r .
?r a owl:Restriction .
?r owl:onProperty ?property .
?property a ?propertyType.
OPTIONAL {
?property rdfs:label ?label
FILTER langMatches(lang(?label), ?wantedLang)
}
OPTIONAL {
?property rdfs:subPropertyOf* ?sup.
?sup rdfs:range ?range.
BIND(REPLACE(STR(?range),".*(#|/)","") as ?rangeName).
}
OPTIONAL {
?property rdfs:comment ?d.
FILTER langMatches(lang(?d), ?wantedLang)
BIND(REPLACE(REPLACE(?d, ',', ' '), '\n', ' ') AS ?comment).
}
OPTIONAL {
?property skos:scopeNote ?n.
BIND(REPLACE(REPLACE(?n, ',', ' '), '\n', ' ') AS ?scopeNote).
}
OPTIONAL {
?property skos:editorialNote ?e.
BIND(REPLACE(REPLACE(?e, ',', ' '), '\n', ' ') AS ?editorialNote).
}
}
}
GROUP BY ?class ?property ?propertyType ?inheritedFrom ?domainFrom ?restrictionFrom ?rangeName ?cardinality ?comment ?scopeNote ?editorialNote
ORDER BY ?class ?property