Holger Knublauch

First version of MPR SPIN constraints

1 -# baseURI: null
2 -
3 -@prefix composite: <http://www.topbraid.org/2007/05/composite.owl#> .
4 -@prefix forms: <http://www.topbraid.org/2007/01/forms.owl#> .
5 -@prefix inference: <http://www.topbraid.org/2007/06/inference.owl#> .
6 -@prefix owl: <http://www.w3.org/2002/07/owl#> .
7 -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
8 -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
9 -@prefix visual: <http://topbraid.org/visual#> .
10 -@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
11 -
12 -[] rdf:type inference:Configuration ;
13 - composite:child
14 - [ rdf:type <http://spinrdf.org/spin#TopSPIN> ;
15 - composite:index "0"^^xsd:int
16 - ] .
1 +# baseURI: http://www.reportinghub.no/ep/spin/mpr-proxy-constraints
2 +# imports: http://spinrdf.org/spin
3 +# imports: http://www.epim.no/schemas/mprml/1
4 +# imports: http://www.reportinghub.no/spin/rh
5 +
6 +@prefix afn: <http://jena.hpl.hp.com/ARQ/function#> .
7 +@prefix arg: <http://spinrdf.org/arg#> .
8 +@prefix fn: <http://www.w3.org/2005/xpath-functions#> .
9 +@prefix mpr-proxy-constraints: <http://www.reportinghub.no/ep/spin/mpr-proxy-constraints#> .
10 +@prefix owl: <http://www.w3.org/2002/07/owl#> .
11 +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
12 +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
13 +@prefix rhspin: <http://www.reportinghub.no/spin/rh#> .
14 +@prefix sp: <http://spinrdf.org/sp#> .
15 +@prefix spin: <http://spinrdf.org/spin#> .
16 +@prefix spl: <http://spinrdf.org/spl#> .
17 +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
18 +
19 +arg:kindRef
20 + rdf:type rdf:Property ;
21 + rdfs:label "kind ref"^^xsd:string ;
22 + rdfs:subPropertyOf sp:arg .
23 +
24 +<http://www.epim.no/schemas/mprml/1#Cs_businessAssociate>
25 + spin:constraint
26 + [ rdf:type sp:Construct ;
27 + sp:templates ([ sp:object spin:ConstraintViolation ;
28 + sp:predicate rdf:type ;
29 + sp:subject _:b1
30 + ] [ sp:object
31 + [ sp:varName "message"^^xsd:string
32 + ] ;
33 + sp:predicate rdfs:label ;
34 + sp:subject _:b1
35 + ]) ;
36 + sp:where ([ sp:object
37 + [ sp:varName "name"^^xsd:string
38 + ] ;
39 + sp:predicate <http://www.epim.no/schemas/mprml/1#name> ;
40 + sp:subject spin:_this
41 + ] [ rdf:type sp:TriplePath ;
42 + sp:object "Operating Company" ;
43 + sp:path [ rdf:type sp:SeqPath ;
44 + sp:path1 <http://www.epim.no/schemas/mprml/1#roleRef> ;
45 + sp:path2 <http://www.linkedmodel.org/schema/dtype#value>
46 + ] ;
47 + sp:subject spin:_this
48 + ] [ rdf:type sp:Bind ;
49 + sp:expression
50 + [ rdf:type rhspin:companyWithName ;
51 + arg:name
52 + [ sp:varName "name"^^xsd:string
53 + ]
54 + ] ;
55 + sp:variable
56 + [ sp:varName "company"^^xsd:string
57 + ]
58 + ] [ rdf:type sp:Filter ;
59 + sp:expression
60 + [ rdf:type sp:not ;
61 + sp:arg1 [ rdf:type sp:bound ;
62 + sp:arg1 [ sp:varName "company"^^xsd:string
63 + ]
64 + ]
65 + ]
66 + ] [ rdf:type sp:Bind ;
67 + sp:expression
68 + [ rdf:type fn:concat ;
69 + sp:arg1 "Invalid company name " ;
70 + sp:arg2 [ sp:varName "name"^^xsd:string
71 + ]
72 + ] ;
73 + sp:variable
74 + [ sp:varName "message"^^xsd:string
75 + ]
76 + ])
77 + ] .
78 +
79 +<http://www.epim.no/schemas/mprml/1#FacilityIdentifierStruct>
80 + spin:constraint
81 + [ rdf:type mpr-proxy-constraints:CheckId ;
82 + arg:kindRef <http://www.epim.no/schemas/mprml/1#RF_terminal> ;
83 + arg:type <http://www.reportinghub.no/ep/schema/facility#Facility>
84 + ] ;
85 + spin:constraint
86 + [ rdf:type mpr-proxy-constraints:CheckId ;
87 + arg:kindRef <http://www.epim.no/schemas/mprml/1#RF_field> ;
88 + arg:type <http://www.reportinghub.no/ep/schema/facility#Field>
89 + ] ;
90 + spin:constraint
91 + [ rdf:type mpr-proxy-constraints:CheckId ;
92 + arg:kindRef <http://www.epim.no/schemas/mprml/1#RF_field> ;
93 + arg:type <http://www.reportinghub.no/ep/schema/facility#Field>
94 + ] ;
95 + spin:constraint
96 + [ rdf:type mpr-proxy-constraints:CheckId ;
97 + arg:kindRef <http://www.epim.no/schemas/mprml/1#RF_platform> ;
98 + arg:type <http://www.reportinghub.no/ep/schema/facility#Platform>
99 + ] ;
100 + spin:constraint
101 + [ rdf:type mpr-proxy-constraints:CheckId ;
102 + arg:kindRef <http://www.epim.no/schemas/mprml/1#RF_wellbore> ;
103 + arg:type <http://www.reportinghub.no/ep/schema/well#WellBore>
104 + ] ;
105 + spin:constraint
106 + [ rdf:type mpr-proxy-constraints:CheckName ;
107 + arg:kindRef <http://www.epim.no/schemas/mprml/1#RF_terminal> ;
108 + arg:type <http://www.reportinghub.no/ep/schema/facility#Facility>
109 + ] ;
110 + spin:constraint
111 + [ rdf:type mpr-proxy-constraints:CheckName ;
112 + arg:kindRef <http://www.epim.no/schemas/mprml/1#RF_platform> ;
113 + arg:type <http://www.reportinghub.no/ep/schema/facility#Platform>
114 + ] ;
115 + spin:constraint
116 + [ rdf:type mpr-proxy-constraints:CheckName ;
117 + arg:kindRef <http://www.epim.no/schemas/mprml/1#RF_wellbore> ;
118 + arg:type <http://www.reportinghub.no/ep/schema/well#WellBore>
119 + ] ;
120 + spin:constraint
121 + [ rdf:type mpr-proxy-constraints:CheckIdAndNameMatch ;
122 + arg:kindRef <http://www.epim.no/schemas/mprml/1#RF_terminal> ;
123 + arg:type <http://www.reportinghub.no/ep/schema/facility#Facility>
124 + ] ;
125 + spin:constraint
126 + [ rdf:type mpr-proxy-constraints:CheckIdAndNameMatch ;
127 + arg:kindRef <http://www.epim.no/schemas/mprml/1#RF_field> ;
128 + arg:type <http://www.reportinghub.no/ep/schema/facility#Field>
129 + ] ;
130 + spin:constraint
131 + [ rdf:type mpr-proxy-constraints:CheckIdAndNameMatch ;
132 + arg:kindRef <http://www.epim.no/schemas/mprml/1#RF_platform> ;
133 + arg:type <http://www.reportinghub.no/ep/schema/facility#Platform>
134 + ] ;
135 + spin:constraint
136 + [ rdf:type mpr-proxy-constraints:CheckIdAndNameMatch ;
137 + arg:kindRef <http://www.epim.no/schemas/mprml/1#RF_wellbore> ;
138 + arg:type <http://www.reportinghub.no/ep/schema/well#WellBore>
139 + ] .
140 +
141 +<http://www.epim.no/schemas/mprml/1#Obj_productVolume>
142 + spin:constraint
143 + [ rdf:type sp:Construct ;
144 + sp:templates ([ sp:object spin:ConstraintViolation ;
145 + sp:predicate rdf:type ;
146 + sp:subject _:b2
147 + ] [ sp:object
148 + [ sp:varName "message"^^xsd:string
149 + ] ;
150 + sp:predicate rdfs:label ;
151 + sp:subject _:b2
152 + ]) ;
153 + sp:where ([ rdf:type sp:TriplePath ;
154 + sp:object
155 + [ sp:varName "name"^^xsd:string
156 + ] ;
157 + sp:path [ rdf:type sp:SeqPath ;
158 + sp:path1 <http://www.epim.no/schemas/mprml/1#nameRef> ;
159 + sp:path2 <http://www.linkedmodel.org/schema/dtype#value>
160 + ] ;
161 + sp:subject spin:_this
162 + ] [ rdf:type sp:Bind ;
163 + sp:expression
164 + [ rdf:type rhspin:npdIndividualByName ;
165 + arg:name
166 + [ sp:varName "name"^^xsd:string
167 + ] ;
168 + arg:type <http://www.reportinghub.no/ep/schema/facility#Field>
169 + ] ;
170 + sp:variable
171 + [ sp:varName "field"^^xsd:string
172 + ]
173 + ] [ rdf:type sp:Filter ;
174 + sp:expression
175 + [ rdf:type sp:not ;
176 + sp:arg1 [ rdf:type sp:bound ;
177 + sp:arg1 [ sp:varName "field"^^xsd:string
178 + ]
179 + ]
180 + ]
181 + ] [ rdf:type sp:Bind ;
182 + sp:expression
183 + [ rdf:type fn:concat ;
184 + sp:arg1 "Invalid Field name " ;
185 + sp:arg2 [ sp:varName "name"^^xsd:string
186 + ]
187 + ] ;
188 + sp:variable
189 + [ sp:varName "message"^^xsd:string
190 + ]
191 + ])
192 + ] .
193 +
194 +<http://www.reportinghub.no/ep/spin/mpr-proxy-constraints>
195 + rdf:type owl:Ontology ;
196 + rdfs:comment "Collection of constraints that are executed on the SXML proxy ontology for MPR schema based reports."^^xsd:string ;
197 + owl:imports <http://spinrdf.org/spin> , <http://www.epim.no/schemas/mprml/1> , <http://www.reportinghub.no/spin/rh> ;
198 + owl:versionInfo "0.1.0"^^xsd:string .
199 +
200 +mpr-proxy-constraints:CheckId
201 + rdf:type spin:ConstructTemplate ;
202 + rdfs:label "Check id"^^xsd:string ;
203 + rdfs:subClassOf mpr-proxy-constraints:ConstraintTemplates ;
204 + spin:body
205 + [ rdf:type sp:Construct ;
206 + sp:templates ([ sp:object spin:ConstraintViolation ;
207 + sp:predicate rdf:type ;
208 + sp:subject _:b3
209 + ] [ sp:object
210 + [ sp:varName "message"^^xsd:string
211 + ] ;
212 + sp:predicate rdfs:label ;
213 + sp:subject _:b3
214 + ]) ;
215 + sp:where ([ sp:object
216 + [ sp:varName "kindRef"^^xsd:string
217 + ] ;
218 + sp:predicate <http://www.epim.no/schemas/mprml/1#kindRef> ;
219 + sp:subject spin:_this
220 + ] [ sp:object "NPD" ;
221 + sp:predicate <http://www.epim.no/schemas/mprml/1#namingSystem> ;
222 + sp:subject spin:_this
223 + ] [ sp:object
224 + [ sp:varName "id"^^xsd:string
225 + ] ;
226 + sp:predicate <http://www.epim.no/schemas/mprml/1#uidRefValue> ;
227 + sp:subject spin:_this
228 + ] [ rdf:type sp:Bind ;
229 + sp:expression
230 + [ rdf:type rhspin:npdIndividualById ;
231 + arg:id [ sp:varName "id"^^xsd:string
232 + ] ;
233 + arg:type
234 + [ sp:varName "type"^^xsd:string
235 + ]
236 + ] ;
237 + sp:variable
238 + [ sp:varName "npd"^^xsd:string
239 + ]
240 + ] [ rdf:type sp:Filter ;
241 + sp:expression
242 + [ rdf:type sp:not ;
243 + sp:arg1 [ rdf:type sp:bound ;
244 + sp:arg1 [ sp:varName "npd"^^xsd:string
245 + ]
246 + ]
247 + ]
248 + ] [ rdf:type sp:Bind ;
249 + sp:expression
250 + [ rdf:type fn:concat ;
251 + sp:arg1 "[RH-19] Invalid " ;
252 + sp:arg2 [ rdf:type afn:localname ;
253 + sp:arg1 [ sp:varName "type"^^xsd:string
254 + ]
255 + ] ;
256 + sp:arg3 " id " ;
257 + sp:arg4 [ sp:varName "id"^^xsd:string
258 + ]
259 + ] ;
260 + sp:variable
261 + [ sp:varName "message"^^xsd:string
262 + ]
263 + ])
264 + ] ;
265 + spin:labelTemplate "Must be NPD id of {?type}/{?kindRef}"^^xsd:string .
266 +
267 +mpr-proxy-constraints:CheckIdAndNameMatch
268 + rdf:type spin:ConstructTemplate ;
269 + rdfs:label "NPD id and name must match"^^xsd:string ;
270 + rdfs:subClassOf mpr-proxy-constraints:ConstraintTemplates ;
271 + spin:body
272 + [ rdf:type sp:Construct ;
273 + sp:templates ([ sp:object spin:ConstraintViolation ;
274 + sp:predicate rdf:type ;
275 + sp:subject _:b4
276 + ] [ sp:object
277 + [ sp:varName "message"^^xsd:string
278 + ] ;
279 + sp:predicate rdfs:label ;
280 + sp:subject _:b4
281 + ]) ;
282 + sp:where ([ sp:object
283 + [ sp:varName "kindRef"^^xsd:string
284 + ] ;
285 + sp:predicate <http://www.epim.no/schemas/mprml/1#kindRef> ;
286 + sp:subject spin:_this
287 + ] [ sp:object "NPD" ;
288 + sp:predicate <http://www.epim.no/schemas/mprml/1#namingSystem> ;
289 + sp:subject spin:_this
290 + ] [ sp:object
291 + [ sp:varName "name"^^xsd:string
292 + ] ;
293 + sp:predicate <http://www.linkedmodel.org/schema/dtype#value> ;
294 + sp:subject spin:_this
295 + ] [ sp:object
296 + [ sp:varName "id"^^xsd:string
297 + ] ;
298 + sp:predicate <http://www.epim.no/schemas/mprml/1#uidRefValue> ;
299 + sp:subject spin:_this
300 + ] [ rdf:type sp:Bind ;
301 + sp:expression
302 + [ rdf:type rhspin:npdIndividualById ;
303 + arg:id [ sp:varName "id"^^xsd:string
304 + ] ;
305 + arg:type
306 + [ sp:varName "type"^^xsd:string
307 + ]
308 + ] ;
309 + sp:variable
310 + [ sp:varName "byId"^^xsd:string
311 + ]
312 + ] [ rdf:type sp:Bind ;
313 + sp:expression
314 + [ rdf:type rhspin:npdIndividualByName ;
315 + arg:name
316 + [ sp:varName "name"^^xsd:string
317 + ] ;
318 + arg:type
319 + [ sp:varName "type"^^xsd:string
320 + ]
321 + ] ;
322 + sp:variable
323 + [ sp:varName "byName"^^xsd:string
324 + ]
325 + ] [ rdf:type sp:Filter ;
326 + sp:expression
327 + [ rdf:type sp:or ;
328 + sp:arg1 [ rdf:type sp:or ;
329 + sp:arg1 [ rdf:type sp:bound ;
330 + sp:arg1 [ sp:varName "byId"^^xsd:string
331 + ]
332 + ] ;
333 + sp:arg2 [ rdf:type sp:bound ;
334 + sp:arg1 [ sp:varName "byName"^^xsd:string
335 + ]
336 + ]
337 + ] ;
338 + sp:arg2 [ rdf:type sp:ne ;
339 + sp:arg1 [ sp:varName "byId"^^xsd:string
340 + ] ;
341 + sp:arg2 [ sp:varName "byName"^^xsd:string
342 + ]
343 + ]
344 + ]
345 + ] [ rdf:type sp:Bind ;
346 + sp:expression
347 + [ rdf:type fn:concat ;
348 + sp:arg1 "[RH-19] Mismatching " ;
349 + sp:arg2 [ rdf:type afn:localname ;
350 + sp:arg1 [ sp:varName "type"^^xsd:string
351 + ]
352 + ] ;
353 + sp:arg3 " id: " ;
354 + sp:arg4 [ sp:varName "id"^^xsd:string
355 + ] ;
356 + sp:arg5 " is not the NPD id of " ;
357 + sp:arg6 [ sp:varName "name"^^xsd:string
358 + ]
359 + ] ;
360 + sp:variable
361 + [ sp:varName "message"^^xsd:string
362 + ]
363 + ])
364 + ] ;
365 + spin:labelTemplate "NPD name and id of {?type}/{?kindRef} must match"^^xsd:string .
366 +
367 +mpr-proxy-constraints:CheckName
368 + rdf:type spin:ConstructTemplate ;
369 + rdfs:label "Check name"^^xsd:string ;
370 + rdfs:subClassOf mpr-proxy-constraints:ConstraintTemplates ;
371 + spin:body
372 + [ rdf:type sp:Construct ;
373 + sp:templates ([ sp:object spin:ConstraintViolation ;
374 + sp:predicate rdf:type ;
375 + sp:subject _:b5
376 + ] [ sp:object
377 + [ sp:varName "message"^^xsd:string
378 + ] ;
379 + sp:predicate rdfs:label ;
380 + sp:subject _:b5
381 + ]) ;
382 + sp:where ([ sp:object
383 + [ sp:varName "kindRef"^^xsd:string
384 + ] ;
385 + sp:predicate <http://www.epim.no/schemas/mprml/1#kindRef> ;
386 + sp:subject spin:_this
387 + ] [ sp:object "NPD" ;
388 + sp:predicate <http://www.epim.no/schemas/mprml/1#namingSystem> ;
389 + sp:subject spin:_this
390 + ] [ sp:object
391 + [ sp:varName "name"^^xsd:string
392 + ] ;
393 + sp:predicate <http://www.linkedmodel.org/schema/dtype#value> ;
394 + sp:subject spin:_this
395 + ] [ rdf:type sp:Bind ;
396 + sp:expression
397 + [ rdf:type rhspin:npdIndividualByName ;
398 + arg:name
399 + [ sp:varName "name"^^xsd:string
400 + ] ;
401 + arg:type
402 + [ sp:varName "type"^^xsd:string
403 + ]
404 + ] ;
405 + sp:variable
406 + [ sp:varName "npd"^^xsd:string
407 + ]
408 + ] [ rdf:type sp:Filter ;
409 + sp:expression
410 + [ rdf:type sp:not ;
411 + sp:arg1 [ rdf:type sp:bound ;
412 + sp:arg1 [ sp:varName "npd"^^xsd:string
413 + ]
414 + ]
415 + ]
416 + ] [ rdf:type sp:Bind ;
417 + sp:expression
418 + [ rdf:type fn:concat ;
419 + sp:arg1 [ rdf:type sp:add ;
420 + sp:arg1 "[RH-19] Invalid " ;
421 + sp:arg2 [ rdf:type afn:localname ;
422 + sp:arg1 [ sp:varName "type"^^xsd:string
423 + ]
424 + ]
425 + ] ;
426 + sp:arg2 " name " ;
427 + sp:arg3 [ sp:varName "name"^^xsd:string
428 + ]
429 + ] ;
430 + sp:variable
431 + [ sp:varName "message"^^xsd:string
432 + ]
433 + ])
434 + ] ;
435 + spin:labelTemplate "Must be NPD name of {?type}/{?kindRef}"^^xsd:string .
436 +
437 +mpr-proxy-constraints:ConstraintTemplates
438 + rdf:type spin:ConstructTemplate ;
439 + rdfs:label "Constraint templates"^^xsd:string ;
440 + rdfs:subClassOf spin:ConstructTemplates ;
441 + spin:constraint
442 + [ rdf:type spl:Argument ;
443 + rdfs:comment "The kind reference value."^^xsd:string ;
444 + spl:predicate arg:kindRef ;
445 + spl:valueType <http://www.epim.no/schemas/mprml/1#ReportingFacility>
446 + ] ;
447 + spin:constraint
448 + [ rdf:type spl:Argument ;
449 + rdfs:comment "The NPD type that the individual needs to have."^^xsd:string ;
450 + spl:predicate arg:type ;
451 + spl:valueType rdfs:Class
452 + ] .