-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrules.ttl
More file actions
131 lines (121 loc) · 3.77 KB
/
rules.ttl
File metadata and controls
131 lines (121 loc) · 3.77 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
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
@prefix dc: <http://purl.org/dc/terms/> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix shacl: <http://www.w3.org/ns/shacl#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix vcard: <http://www.w3.org/2006/vcard/ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix pg: <http://semic.eu/profileguard/ns#> .
#[] a shacl:NodeShape ;
# shacl:target [
# a pg:nodeShapeByTargetClass ;
# pg:hasTargetClass dcat:Dataset ;
# ] ;
# shacl:property [
# a shacl:PropertyShape ;
# shacl:path shacl:closed ;
# shacl:hasValue true
# ] .
#[] a shacl:NodeShape ;
# shacl:target [
# a pg:properyShapeByTargetAndPath ;
# pg:hasTargetClass dcat:Dataset ;
# pg:hasPath dc:spatial
# ] ;
# shacl:property [
# a shacl:PropertyShape ;
# shacl:path shacl:closed ;
# shacl:hasValue true
# ] .
[] a shacl:NodeShape ;
shacl:target [
a pg:properyShapeByTargetAndPathAndPredicate ;
pg:hasTargetClass dcat:Dataset ;
pg:hasPath dcat:temporalResolution ;
pg:hasPredicate shacl:maxCount ;
] ;
shacl:property [
pg:hasIdentifier "e73b7a1d-98e2-47dc-8c24-daa5b600e990" ;
shacl:path shacl:maxCount ;
shacl:minCount 1 ; # static, property should always be there.
shacl:maxInclusive 1 ;
] .
pg:
shacl:declare [
shacl:prefix "pg" ;
shacl:namespace "http://semic.eu/profileguard/ns#" ;
] .
pg:nodeShapeByTargetClass
a shacl:SPARQLTargetType ;
rdfs:subClassOf shacl:Target ;
shacl:labelTemplate "All NodeShapes targetting {$target}" ;
shacl:parameter [
shacl:path pg:hasTargetClass ;
shacl:description "The targetClass of the NodeShape." ;
shacl:nodeKind shacl:IRI ;
] ;
shacl:prefixes pg: ;
shacl:select """
SELECT distinct ?this
WHERE {
?this a shacl:NodeShape .
?this shacl:targetClass $hasTargetClass .
}
""" .
pg:properyShapeByTargetAndPath
a shacl:SPARQLTargetType ;
rdfs:subClassOf shacl:Target ;
shacl:labelTemplate "All NodeShapes targetting {$target}" ;
shacl:parameter [
shacl:path pg:hasTargetClass ;
shacl:description "The targetClass of the NodeShape." ;
shacl:nodeKind shacl:IRI ;
] ;
shacl:parameter [
shacl:path pg:hasPath ;
shacl:description "The propertypath from the NodeShape to the PropertyShape" ;
shacl:nodeKind shacl:IRI ;
] ;
shacl:prefixes pg: ;
shacl:select """
SELECT distinct (COALESCE(SAMPLE(?property), <required-property-not-found>) AS ?this)
WHERE {
?node a shacl:NodeShape .
?node shacl:targetClass $hasTargetClass .
?node shacl:property ?property .
?property shacl:path $hasPath .
}
""" .
pg:properyShapeByTargetAndPathAndPredicate
a shacl:SPARQLTargetType ;
rdfs:subClassOf shacl:Target ;
shacl:labelTemplate "All NodeShapes targetting {$target}" ;
shacl:parameter [
shacl:path pg:hasTargetClass ;
shacl:description "The targetClass of the NodeShape." ;
shacl:nodeKind shacl:IRI ;
] ;
shacl:parameter [
shacl:path pg:hasPath ;
shacl:description "The propertypath from the NodeShape to the PropertyShape" ;
shacl:nodeKind shacl:IRI ;
] ;
shacl:parameter [
shacl:path pg:hasPredicate ;
shacl:description "The PropertyShape needs a triple with this predicate" ;
shacl:nodeKind shacl:IRI ;
] ;
shacl:prefixes pg: ;
shacl:select """
SELECT distinct (COALESCE(SAMPLE(?property), pg:required-property-not-found) AS ?this)
WHERE {
?node a shacl:NodeShape .
?node shacl:targetClass $hasTargetClass .
?node shacl:property ?property .
?property shacl:path $hasPath .
?property $hasPredicate ?obj .
}
""" .