SPIN_EP-DDR-constraints.spin.ttl
15.2 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
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# baseURI: http://www.reportinghub.no/ep/spin/ddr-constraints
# imports: http://spinrdf.org/spin
# imports: http://topbraid.org/sxml
# imports: http://www.reportinghub.no/np/schema/1.0/npd
# imports: http://www.reportinghub.no/spin/rh
# imports: http://www.witsml.org/schemas/1series
@prefix : <http://www.reportinghub.no/ep/spin/ddr-constraints#> .
@prefix arg: <http://spinrdf.org/arg#> .
@prefix ddr: <http://www.witsml.org/schemas/1series#> .
@prefix fn: <http://www.w3.org/2005/xpath-functions#> .
@prefix normalization: <http://www.reportinghub.no/ep/transform/1.1/normalization#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rhspin: <http://www.reportinghub.no/spin/rh#> .
@prefix sp: <http://spinrdf.org/sp#> .
@prefix spif: <http://spinrdf.org/spif#> .
@prefix spin: <http://spinrdf.org/spin#> .
@prefix spl: <http://spinrdf.org/spl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://www.reportinghub.no/ep/spin/ddr-constraints>
rdf:type owl:Ontology ;
rdfs:comment "Constraints that need to be executed immediately after SXML import, i.e. not on the inferred triples."^^xsd:string ;
owl:imports <http://spinrdf.org/spin> , <http://topbraid.org/sxml> , <http://www.reportinghub.no/np/schema/1.0/npd> , <http://www.reportinghub.no/spin/rh> , <http://www.witsml.org/schemas/1series> ;
owl:versionInfo "0.2.0"^^xsd:string .
ddr:Cs_drillReportWellboreInfo
spin:constraint
[ rdf:type sp:Construct ;
sp:templates ([ sp:object spin:ConstraintViolation ;
sp:predicate rdf:type ;
sp:subject _:b1
] [ sp:object
[ sp:varName "message"^^xsd:string
] ;
sp:predicate rdfs:label ;
sp:subject _:b1
]) ;
sp:where ([ sp:object
[ sp:varName "nameRef"^^xsd:string
] ;
sp:predicate ddr:rigAliasRef ;
sp:subject spin:_this
] [ sp:object "NPD Name" ;
sp:predicate ddr:namingSystem ;
sp:subject
[ sp:varName "nameRef"^^xsd:string
]
] [ sp:object
[ sp:varName "name"^^xsd:string
] ;
sp:predicate ddr:name ;
sp:subject
[ sp:varName "nameRef"^^xsd:string
]
] [ sp:object
[ sp:varName "codeRef"^^xsd:string
] ;
sp:predicate ddr:rigAliasRef ;
sp:subject spin:_this
] [ sp:object "NPD code" ;
sp:predicate ddr:namingSystem ;
sp:subject
[ sp:varName "codeRef"^^xsd:string
]
] [ sp:object
[ sp:varName "code"^^xsd:string
] ;
sp:predicate ddr:name ;
sp:subject
[ sp:varName "codeRef"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:facilityById ;
arg:id [ sp:varName "code"^^xsd:string
]
] ;
sp:variable
[ sp:varName "facility"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:npdName ;
arg:resource
[ sp:varName "facility"^^xsd:string
]
] ;
sp:variable
[ sp:varName "npdName"^^xsd:string
]
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:ne ;
sp:arg1 [ rdf:type spif:lowerCase ;
sp:arg1 [ sp:varName "npdName"^^xsd:string
]
] ;
sp:arg2 [ rdf:type spif:lowerCase ;
sp:arg1 [ sp:varName "name"^^xsd:string
]
]
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "[RH-19] Mismatch for rig code " ;
sp:arg2 [ sp:varName "code"^^xsd:string
] ;
sp:arg3 ": The NPD name is " ;
sp:arg4 [ sp:varName "npdName"^^xsd:string
] ;
sp:arg5 " not " ;
sp:arg6 [ sp:varName "name"^^xsd:string
]
] ;
sp:variable
[ sp:varName "message"^^xsd:string
]
])
] .
ddr:Obj_drillReport
spin:constraint
[ rdf:type sp:Ask ;
rdfs:comment "[RH-10] DDRs can only be submitted if a user is logged in"^^xsd:string ;
sp:where ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:companyName
] ;
sp:variable
[ sp:varName "companyName"^^xsd:string
]
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:not ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 [ sp:varName "companyName"^^xsd:string
]
]
]
])
] ;
spin:constraint
[ rdf:type sp:Ask ;
rdfs:comment "[RH-10] DDRs can only be submitted if the logged-in user is from a registered company"^^xsd:string ;
sp:where ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:companyName
] ;
sp:variable
[ sp:varName "companyName"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:companyWithName ;
arg:name
[ sp:varName "companyName"^^xsd:string
]
] ;
sp:variable
[ sp:varName "company"^^xsd:string
]
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:not ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 [ sp:varName "company"^^xsd:string
]
]
]
])
] ;
spin:constraint
[ rdf:type sp:Construct ;
sp:templates ([ sp:object spin:ConstraintViolation ;
sp:predicate rdf:type ;
sp:subject _:b2
] [ sp:object spin:_this ;
sp:predicate spin:violationRoot ;
sp:subject _:b2
] [ sp:object ddr:nameWellbore ;
sp:predicate spin:violationPath ;
sp:subject _:b2
] [ sp:object
[ sp:varName "message"^^xsd:string
] ;
sp:predicate rdfs:label ;
sp:subject _:b2
]) ;
sp:where ([ sp:object
[ sp:varName "wellBoreName"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/ep/spin/lib#nameWellbore> ;
sp:subject spin:_this
] [ sp:object
[ sp:varName "wellBoreNumber"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/ep/spin/lib#numberWellbore> ;
sp:subject spin:_this
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:wellBoreByName ;
arg:wellBoreName
[ sp:varName "wellBoreName"^^xsd:string
]
] ;
sp:variable
[ sp:varName "wellBore"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:wellBoreById ;
arg:id [ sp:varName "wellBoreNumber"^^xsd:string
]
] ;
sp:variable
[ sp:varName "wellBore2"^^xsd:string
]
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:ne ;
sp:arg1 [ sp:varName "wellBore"^^xsd:string
] ;
sp:arg2 [ sp:varName "wellBore2"^^xsd:string
]
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "[RH-19] Well bore number " ;
sp:arg2 [ sp:varName "wellBoreNumber"^^xsd:string
] ;
sp:arg3 " mismatches well bore name " ;
sp:arg4 [ sp:varName "wellBoreName"^^xsd:string
]
] ;
sp:variable
[ sp:varName "message"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type sp:Construct ;
sp:templates ([ sp:object spin:ConstraintViolation ;
sp:predicate rdf:type ;
sp:subject _:b3
] [ sp:object spin:_this ;
sp:predicate spin:violationRoot ;
sp:subject _:b3
] [ sp:object ddr:nameWellbore ;
sp:predicate spin:violationPath ;
sp:subject _:b3
] [ sp:object
[ sp:varName "message"^^xsd:string
] ;
sp:predicate rdfs:label ;
sp:subject _:b3
]) ;
sp:where ([ sp:object
[ sp:varName "wellBoreName"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/ep/spin/lib#nameWellbore> ;
sp:subject spin:_this
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:wellBoreByName ;
arg:wellBoreName
[ sp:varName "wellBoreName"^^xsd:string
]
] ;
sp:variable
[ sp:varName "wellBore"^^xsd:string
]
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:not ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 [ sp:varName "wellBore"^^xsd:string
]
]
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "[RH-21] Unregistered well bore name " ;
sp:arg2 [ sp:varName "wellBoreName"^^xsd:string
]
] ;
sp:variable
[ sp:varName "message"^^xsd:string
]
])
] .