Holger Knublauch

Latest SPIN functions

...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
2 # imports: http://spinrdf.org/spin 2 # imports: http://spinrdf.org/spin
3 # imports: http://www.reportinghub.no/system/schema/reporting 3 # imports: http://www.reportinghub.no/system/schema/reporting
4 4
5 +# c14n-version: 3
6 +@prefix arg: <http://spinrdf.org/arg#> .
5 @prefix fn: <http://www.w3.org/2005/xpath-functions#> . 7 @prefix fn: <http://www.w3.org/2005/xpath-functions#> .
6 @prefix owl: <http://www.w3.org/2002/07/owl#> . 8 @prefix owl: <http://www.w3.org/2002/07/owl#> .
7 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . 9 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
...@@ -12,424 +14,700 @@ ...@@ -12,424 +14,700 @@
12 @prefix spin: <http://spinrdf.org/spin#> . 14 @prefix spin: <http://spinrdf.org/spin#> .
13 @prefix spl: <http://spinrdf.org/spl#> . 15 @prefix spl: <http://spinrdf.org/spl#> .
14 @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . 16 @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
15 - 17 +arg:date
16 -<http://spinrdf.org/arg#date>
17 rdf:type rdf:Property ; 18 rdf:type rdf:Property ;
18 rdfs:label "date"^^xsd:string ; 19 rdfs:label "date"^^xsd:string ;
19 - rdfs:subPropertyOf sp:arg . 20 + rdfs:subPropertyOf sp:arg ;
20 - 21 +.
21 -<http://spinrdf.org/arg#fieldName> 22 +arg:fieldName
22 rdf:type rdf:Property ; 23 rdf:type rdf:Property ;
23 rdfs:label "field name"^^xsd:string ; 24 rdfs:label "field name"^^xsd:string ;
24 - rdfs:subPropertyOf sp:arg . 25 + rdfs:subPropertyOf sp:arg ;
25 - 26 +.
26 -<http://spinrdf.org/arg#id> 27 +arg:id
27 rdf:type rdf:Property ; 28 rdf:type rdf:Property ;
28 rdfs:label "id"^^xsd:string ; 29 rdfs:label "id"^^xsd:string ;
29 - rdfs:subPropertyOf sp:arg . 30 + rdfs:subPropertyOf sp:arg ;
30 - 31 +.
31 -<http://spinrdf.org/arg#month> 32 +arg:month
32 rdf:type rdf:Property ; 33 rdf:type rdf:Property ;
33 rdfs:label "month"^^xsd:string ; 34 rdfs:label "month"^^xsd:string ;
34 - rdfs:subPropertyOf sp:arg . 35 + rdfs:subPropertyOf sp:arg ;
35 - 36 +.
36 -<http://spinrdf.org/arg#owner> 37 +arg:owner
37 rdf:type rdf:Property ; 38 rdf:type rdf:Property ;
38 rdfs:label "owner"^^xsd:string ; 39 rdfs:label "owner"^^xsd:string ;
39 - rdfs:subPropertyOf sp:arg . 40 + rdfs:subPropertyOf sp:arg ;
40 - 41 +.
41 -<http://spinrdf.org/arg#wellBoreId> 42 +arg:parts
43 + rdf:type rdf:Property ;
44 + rdfs:label "parts"^^xsd:string ;
45 + rdfs:subPropertyOf sp:arg ;
46 +.
47 +arg:wellBoreId
42 rdf:type rdf:Property ; 48 rdf:type rdf:Property ;
43 rdfs:label "well bore id"^^xsd:string ; 49 rdfs:label "well bore id"^^xsd:string ;
44 - rdfs:subPropertyOf sp:arg . 50 + rdfs:subPropertyOf sp:arg ;
45 - 51 +.
46 <http://www.reportinghub.no/system/spin/reporting> 52 <http://www.reportinghub.no/system/spin/reporting>
47 rdf:type owl:Ontology ; 53 rdf:type owl:Ontology ;
48 rdfs:comment "SPIN functions and templates to support querying report metadata."^^xsd:string ; 54 rdfs:comment "SPIN functions and templates to support querying report metadata."^^xsd:string ;
49 - owl:imports <http://spinrdf.org/spin> , <http://www.reportinghub.no/system/schema/reporting> ; 55 + owl:imports <http://spinrdf.org/spin> ;
50 - owl:versionInfo "0.1.0"^^xsd:string . 56 + owl:imports <http://www.reportinghub.no/system/schema/reporting> ;
51 - 57 + owl:versionInfo "0.1.0"^^xsd:string ;
58 +.
52 reportspin:DDRsOverview 59 reportspin:DDRsOverview
53 rdf:type spin:SelectTemplate ; 60 rdf:type spin:SelectTemplate ;
54 - rdfs:label "DDRs overview"^^xsd:string ; 61 + spin:body [
55 - rdfs:subClassOf spin:SelectTemplates ; 62 + rdf:type sp:Select ;
56 - spin:body 63 + sp:orderBy (
57 - [ rdf:type sp:Select ; 64 + [
58 - sp:orderBy ([ sp:varName "wellBoreName"^^xsd:string 65 + sp:varName "wellBoreName"^^xsd:string ;
59 - ] [ sp:varName "date"^^xsd:string 66 + ]
60 - ] [ sp:varName "created"^^xsd:string 67 + [
61 - ]) ; 68 + sp:varName "date"^^xsd:string ;
62 - sp:resultVariables ([ sp:varName "wellBoreName"^^xsd:string 69 + ]
63 - ] [ sp:varName "date"^^xsd:string 70 + [
64 - ] [ sp:varName "created"^^xsd:string 71 + sp:varName "created"^^xsd:string ;
65 - ] [ sp:varName "id"^^xsd:string 72 + ]
66 - ]) ; 73 + ) ;
67 - sp:where ([ sp:object 74 + sp:resultVariables (
68 - [ sp:varName "wellBoreId"^^xsd:string 75 + [
76 + sp:varName "wellBoreName"^^xsd:string ;
77 + ]
78 + [
79 + sp:varName "date"^^xsd:string ;
80 + ]
81 + [
82 + sp:varName "created"^^xsd:string ;
83 + ]
84 + [
85 + sp:varName "id"^^xsd:string ;
86 + ]
87 + ) ;
88 + sp:where (
89 + [
90 + sp:object [
91 + sp:varName "wellBoreId"^^xsd:string ;
69 ] ; 92 ] ;
70 sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ; 93 sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ;
71 - sp:subject 94 + sp:subject [
72 - [ sp:varName "ddr"^^xsd:string 95 + sp:varName "ddr"^^xsd:string ;
96 + ] ;
73 ] 97 ]
74 - ] [ sp:object 98 + [
75 - [ sp:varName "created"^^xsd:string 99 + sp:object [
100 + sp:varName "created"^^xsd:string ;
76 ] ; 101 ] ;
77 sp:predicate <http://purl.org/dc/terms/created> ; 102 sp:predicate <http://purl.org/dc/terms/created> ;
78 - sp:subject 103 + sp:subject [
79 - [ sp:varName "ddr"^^xsd:string 104 + sp:varName "ddr"^^xsd:string ;
105 + ] ;
80 ] 106 ]
81 - ] [ sp:object 107 + [
82 - [ sp:varName "date"^^xsd:string 108 + sp:object [
109 + sp:varName "date"^^xsd:string ;
83 ] ; 110 ] ;
84 sp:predicate <http://purl.org/dc/terms/date> ; 111 sp:predicate <http://purl.org/dc/terms/date> ;
85 - sp:subject 112 + sp:subject [
86 - [ sp:varName "ddr"^^xsd:string 113 + sp:varName "ddr"^^xsd:string ;
114 + ] ;
87 ] 115 ]
88 - ] [ sp:object 116 + [
89 - [ sp:varName "id"^^xsd:string 117 + sp:object [
118 + sp:varName "id"^^xsd:string ;
90 ] ; 119 ] ;
91 sp:predicate <http://rdfs.org/sioc/ns#id> ; 120 sp:predicate <http://rdfs.org/sioc/ns#id> ;
92 - sp:subject 121 + sp:subject [
93 - [ sp:varName "ddr"^^xsd:string 122 + sp:varName "ddr"^^xsd:string ;
94 - ]
95 - ] [ rdf:type sp:Bind ;
96 - sp:expression
97 - [ rdf:type rhspin:wellBoreById ;
98 - sp:arg1 [ sp:varName "wellBoreId"^^xsd:string
99 - ]
100 ] ; 123 ] ;
101 - sp:variable
102 - [ sp:varName "wellBore"^^xsd:string
103 ] 124 ]
104 - ] [ rdf:type sp:Bind ; 125 + [
105 - sp:expression 126 + rdf:type sp:Bind ;
106 - [ rdf:type rhspin:npdName ; 127 + sp:expression [
107 - sp:arg1 [ sp:varName "wellBore"^^xsd:string 128 + rdf:type rhspin:wellBoreById ;
129 + sp:arg1 [
130 + sp:varName "wellBoreId"^^xsd:string ;
131 + ] ;
132 + ] ;
133 + sp:variable [
134 + sp:varName "wellBore"^^xsd:string ;
135 + ] ;
108 ] 136 ]
137 + [
138 + rdf:type sp:Bind ;
139 + sp:expression [
140 + rdf:type rhspin:npdName ;
141 + sp:arg1 [
142 + sp:varName "wellBore"^^xsd:string ;
143 + ] ;
144 + ] ;
145 + sp:variable [
146 + sp:varName "wellBoreName"^^xsd:string ;
109 ] ; 147 ] ;
110 - sp:variable
111 - [ sp:varName "wellBoreName"^^xsd:string
112 ] 148 ]
113 - ]) 149 + ) ;
114 - ] . 150 + ] ;
115 - 151 + rdfs:label "DDRs overview"^^xsd:string ;
152 + rdfs:subClassOf spin:SelectTemplates ;
153 +.
116 reportspin:DPRsOverview 154 reportspin:DPRsOverview
117 rdf:type spin:SelectTemplate ; 155 rdf:type spin:SelectTemplate ;
118 - rdfs:label "DPRs overview"^^xsd:string ; 156 + spin:body [
119 - rdfs:subClassOf spin:SelectTemplates ; 157 + rdf:type sp:Select ;
120 - spin:body 158 + sp:orderBy (
121 - [ rdf:type sp:Select ; 159 + [
122 - sp:orderBy ([ sp:varName "ownerName"^^xsd:string 160 + sp:varName "ownerName"^^xsd:string ;
123 - ] [ sp:varName "date"^^xsd:string 161 + ]
124 - ] [ sp:varName "created"^^xsd:string 162 + [
125 - ]) ; 163 + sp:varName "date"^^xsd:string ;
126 - sp:resultVariables ([ sp:varName "ownerName"^^xsd:string 164 + ]
127 - ] [ sp:varName "date"^^xsd:string 165 + [
128 - ] [ sp:varName "created"^^xsd:string 166 + sp:varName "created"^^xsd:string ;
129 - ] [ sp:varName "id"^^xsd:string 167 + ]
130 - ]) ; 168 + ) ;
131 - sp:where ([ sp:object 169 + sp:resultVariables (
132 - [ sp:varName "id"^^xsd:string 170 + [
171 + sp:varName "ownerName"^^xsd:string ;
172 + ]
173 + [
174 + sp:varName "date"^^xsd:string ;
175 + ]
176 + [
177 + sp:varName "created"^^xsd:string ;
178 + ]
179 + [
180 + sp:varName "id"^^xsd:string ;
181 + ]
182 + ) ;
183 + sp:where (
184 + [
185 + sp:object [
186 + sp:varName "id"^^xsd:string ;
133 ] ; 187 ] ;
134 sp:predicate <http://rdfs.org/sioc/ns#id> ; 188 sp:predicate <http://rdfs.org/sioc/ns#id> ;
135 - sp:subject 189 + sp:subject [
136 - [ sp:varName "dpr"^^xsd:string 190 + sp:varName "dpr"^^xsd:string ;
191 + ] ;
137 ] 192 ]
138 - ] [ sp:object 193 + [
139 - [ sp:varName "created"^^xsd:string 194 + sp:object [
195 + sp:varName "created"^^xsd:string ;
140 ] ; 196 ] ;
141 sp:predicate <http://purl.org/dc/terms/created> ; 197 sp:predicate <http://purl.org/dc/terms/created> ;
142 - sp:subject 198 + sp:subject [
143 - [ sp:varName "dpr"^^xsd:string 199 + sp:varName "dpr"^^xsd:string ;
200 + ] ;
144 ] 201 ]
145 - ] [ sp:object 202 + [
146 - [ sp:varName "date"^^xsd:string 203 + sp:object [
204 + sp:varName "date"^^xsd:string ;
147 ] ; 205 ] ;
148 sp:predicate <http://purl.org/dc/terms/date> ; 206 sp:predicate <http://purl.org/dc/terms/date> ;
149 - sp:subject 207 + sp:subject [
150 - [ sp:varName "dpr"^^xsd:string 208 + sp:varName "dpr"^^xsd:string ;
209 + ] ;
151 ] 210 ]
152 - ] [ sp:object 211 + [
153 - [ sp:varName "owner"^^xsd:string 212 + sp:object [
213 + sp:varName "owner"^^xsd:string ;
154 ] ; 214 ] ;
155 sp:predicate <http://www.reportinghub.no/system/schema/reporting#owner> ; 215 sp:predicate <http://www.reportinghub.no/system/schema/reporting#owner> ;
156 - sp:subject 216 + sp:subject [
157 - [ sp:varName "dpr"^^xsd:string 217 + sp:varName "dpr"^^xsd:string ;
158 - ] 218 + ] ;
159 - ] [ rdf:type sp:Bind ;
160 - sp:expression
161 - [ rdf:type rhspin:npdName ;
162 - sp:arg1 [ sp:varName "owner"^^xsd:string
163 ] 219 ]
220 + [
221 + rdf:type sp:Bind ;
222 + sp:expression [
223 + rdf:type rhspin:npdName ;
224 + sp:arg1 [
225 + sp:varName "owner"^^xsd:string ;
226 + ] ;
227 + ] ;
228 + sp:variable [
229 + sp:varName "ownerName"^^xsd:string ;
164 ] ; 230 ] ;
165 - sp:variable
166 - [ sp:varName "ownerName"^^xsd:string
167 ] 231 ]
168 - ]) 232 + ) ;
169 - ] . 233 + ] ;
170 - 234 + rdfs:label "DPRs overview"^^xsd:string ;
235 + rdfs:subClassOf spin:SelectTemplates ;
236 +.
171 reportspin:graphByDDRId 237 reportspin:graphByDDRId
172 rdf:type spin:Function ; 238 rdf:type spin:Function ;
173 - rdfs:comment "Gets the URI of the named graph containing the triples submitted by a report:DDR (metadata) with a given id."^^xsd:string ; 239 + spin:body [
174 - rdfs:label "graph by DDR id"^^xsd:string ; 240 + rdf:type sp:Select ;
175 - rdfs:subClassOf spin:Functions ; 241 + sp:resultVariables (
176 - spin:body 242 + [
177 - [ rdf:type sp:Select ; 243 + rdf:type sp:iri ;
178 - sp:resultVariables ([ rdf:type sp:iri ; 244 + sp:arg1 [
179 - sp:arg1 [ sp:varName "uri"^^xsd:string 245 + sp:varName "uri"^^xsd:string ;
180 - ] 246 + ] ;
181 - ]) ; 247 + ]
182 - sp:where ([ rdf:type sp:Bind ; 248 + ) ;
183 - sp:expression 249 + sp:where (
184 - [ rdf:type fn:concat ; 250 + [
251 + rdf:type sp:Bind ;
252 + sp:expression [
253 + rdf:type fn:concat ;
185 sp:arg1 "http://www.reportinghub.no/system/ddr/" ; 254 sp:arg1 "http://www.reportinghub.no/system/ddr/" ;
186 - sp:arg2 [ sp:varName "id"^^xsd:string 255 + sp:arg2 [
187 - ] 256 + sp:varName "id"^^xsd:string ;
257 + ] ;
258 + ] ;
259 + sp:variable [
260 + sp:varName "uri"^^xsd:string ;
188 ] ; 261 ] ;
189 - sp:variable
190 - [ sp:varName "uri"^^xsd:string
191 ] 262 ]
192 - ]) 263 + ) ;
193 ] ; 264 ] ;
194 - spin:constraint 265 + spin:constraint [
195 - [ rdf:type spl:Argument ; 266 + rdf:type spl:Argument ;
267 + spl:predicate arg:id ;
268 + spl:valueType xsd:string ;
196 rdfs:comment "The id of the DDR metadata."^^xsd:string ; 269 rdfs:comment "The id of the DDR metadata."^^xsd:string ;
197 - spl:predicate <http://spinrdf.org/arg#id> ;
198 - spl:valueType xsd:string
199 ] ; 270 ] ;
200 - spin:returnType rdfs:Resource . 271 + spin:returnType rdfs:Resource ;
201 - 272 + rdfs:comment "Gets the URI of the named graph containing the triples submitted by a report:DDR (metadata) with a given id."^^xsd:string ;
273 + rdfs:label "graph by DDR id"^^xsd:string ;
274 + rdfs:subClassOf spin:Functions ;
275 +.
202 reportspin:graphByDPRId 276 reportspin:graphByDPRId
203 rdf:type spin:Function ; 277 rdf:type spin:Function ;
204 - rdfs:comment "Gets the URI of the named graph containing the triples submitted by a report:DPR (metadata) with a given id."^^xsd:string ; 278 + spin:body [
205 - rdfs:label "graph by DPR id"^^xsd:string ; 279 + rdf:type sp:Select ;
206 - rdfs:subClassOf spin:Functions ; 280 + sp:resultVariables (
207 - spin:body 281 + [
208 - [ rdf:type sp:Select ; 282 + rdf:type sp:iri ;
209 - sp:resultVariables ([ rdf:type sp:iri ; 283 + sp:arg1 [
210 - sp:arg1 [ sp:varName "uri"^^xsd:string 284 + sp:varName "uri"^^xsd:string ;
211 - ] 285 + ] ;
212 - ]) ; 286 + ]
213 - sp:where ([ rdf:type sp:Bind ; 287 + ) ;
214 - sp:expression 288 + sp:where (
215 - [ rdf:type fn:concat ; 289 + [
290 + rdf:type sp:Bind ;
291 + sp:expression [
292 + rdf:type fn:concat ;
216 sp:arg1 "http://www.reportinghub.no/system/dpr/" ; 293 sp:arg1 "http://www.reportinghub.no/system/dpr/" ;
217 - sp:arg2 [ sp:varName "id"^^xsd:string 294 + sp:arg2 [
218 - ] 295 + sp:varName "id"^^xsd:string ;
296 + ] ;
297 + ] ;
298 + sp:variable [
299 + sp:varName "uri"^^xsd:string ;
219 ] ; 300 ] ;
220 - sp:variable
221 - [ sp:varName "uri"^^xsd:string
222 ] 301 ]
223 - ]) 302 + ) ;
224 ] ; 303 ] ;
225 - spin:constraint 304 + spin:constraint [
226 - [ rdf:type spl:Argument ; 305 + rdf:type spl:Argument ;
306 + spl:predicate arg:id ;
307 + spl:valueType xsd:string ;
227 rdfs:comment "The id of the DPR metadata."^^xsd:string ; 308 rdfs:comment "The id of the DPR metadata."^^xsd:string ;
228 - spl:predicate <http://spinrdf.org/arg#id> ;
229 - spl:valueType xsd:string
230 ] ; 309 ] ;
231 - spin:returnType rdfs:Resource . 310 + spin:returnType rdfs:Resource ;
232 - 311 + rdfs:comment "Gets the URI of the named graph containing the triples submitted by a report:DPR (metadata) with a given id."^^xsd:string ;
312 + rdfs:label "graph by DPR id"^^xsd:string ;
313 + rdfs:subClassOf spin:Functions ;
314 +.
233 reportspin:graphByReportId 315 reportspin:graphByReportId
234 rdf:type spin:Function ; 316 rdf:type spin:Function ;
235 - rdfs:comment "Gets the URI of the named graph containing the triples submitted by a report with a given id."^^xsd:string ; 317 + spin:body [
236 - rdfs:label "graph by report id"^^xsd:string ; 318 + rdf:type sp:Select ;
237 - rdfs:subClassOf spin:Functions ; 319 + sp:resultVariables (
238 - spin:body 320 + [
239 - [ rdf:type sp:Select ; 321 + rdf:type sp:iri ;
240 - sp:resultVariables ([ rdf:type sp:iri ; 322 + sp:arg1 [
241 - sp:arg1 [ sp:varName "uri"^^xsd:string 323 + sp:varName "uri"^^xsd:string ;
242 - ] 324 + ] ;
243 - ]) ; 325 + ]
244 - sp:where ([ rdf:type sp:Bind ; 326 + ) ;
245 - sp:expression 327 + sp:where (
246 - [ rdf:type fn:concat ; 328 + [
329 + rdf:type sp:Bind ;
330 + sp:expression [
331 + rdf:type fn:concat ;
247 sp:arg1 "http://www.reportinghub.no/system/report/" ; 332 sp:arg1 "http://www.reportinghub.no/system/report/" ;
248 - sp:arg2 [ sp:varName "id"^^xsd:string 333 + sp:arg2 [
249 - ] 334 + sp:varName "id"^^xsd:string ;
335 + ] ;
336 + ] ;
337 + sp:variable [
338 + sp:varName "uri"^^xsd:string ;
250 ] ; 339 ] ;
251 - sp:variable
252 - [ sp:varName "uri"^^xsd:string
253 ] 340 ]
254 - ]) 341 + ) ;
255 ] ; 342 ] ;
256 - spin:constraint 343 + spin:constraint [
257 - [ rdf:type spl:Argument ; 344 + rdf:type spl:Argument ;
345 + spl:predicate arg:id ;
346 + spl:valueType xsd:string ;
258 rdfs:comment "The id of the DDR metadata."^^xsd:string ; 347 rdfs:comment "The id of the DDR metadata."^^xsd:string ;
259 - spl:predicate <http://spinrdf.org/arg#id> ;
260 - spl:valueType xsd:string
261 ] ; 348 ] ;
262 - spin:returnType rdfs:Resource . 349 + spin:returnType rdfs:Resource ;
263 - 350 + rdfs:comment "Gets the URI of the named graph containing the triples submitted by a report with a given id."^^xsd:string ;
351 + rdfs:label "graph by report id"^^xsd:string ;
352 + rdfs:subClassOf spin:Functions ;
353 +.
264 reportspin:idOfDDRByDateAndWellBoreId 354 reportspin:idOfDDRByDateAndWellBoreId
265 rdf:type spin:Function ; 355 rdf:type spin:Function ;
266 - rdfs:comment "Gets the id of a DDR defined by date and well bore id. If preliminary reports have been created, this will return the most recent one only."^^xsd:string ; 356 + spin:body [
267 - rdfs:label "id of DDR by date and well bore id"^^xsd:string ; 357 + rdf:type sp:Select ;
268 - rdfs:subClassOf spin:Functions ; 358 + sp:orderBy (
269 - spin:body 359 + [
270 - [ rdf:type sp:Select ; 360 + rdf:type sp:Desc ;
271 - sp:orderBy ([ rdf:type sp:Desc ; 361 + sp:expression [
272 - sp:expression 362 + sp:varName "created"^^xsd:string ;
273 - [ sp:varName "created"^^xsd:string 363 + ] ;
274 - ] 364 + ]
275 - ]) ; 365 + ) ;
276 - sp:resultVariables ([ sp:varName "id"^^xsd:string 366 + sp:resultVariables (
277 - ]) ; 367 + [
278 - sp:where ([ sp:object 368 + sp:varName "id"^^xsd:string ;
279 - [ sp:varName "wellBoreId"^^xsd:string 369 + ]
370 + ) ;
371 + sp:where (
372 + [
373 + sp:object [
374 + sp:varName "wellBoreId"^^xsd:string ;
280 ] ; 375 ] ;
281 sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ; 376 sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ;
282 - sp:subject 377 + sp:subject [
283 - [ sp:varName "report"^^xsd:string 378 + sp:varName "report"^^xsd:string ;
379 + ] ;
284 ] 380 ]
285 - ] [ sp:object 381 + [
286 - [ sp:varName "date"^^xsd:string 382 + sp:object [
383 + sp:varName "date"^^xsd:string ;
287 ] ; 384 ] ;
288 sp:predicate <http://purl.org/dc/terms/date> ; 385 sp:predicate <http://purl.org/dc/terms/date> ;
289 - sp:subject 386 + sp:subject [
290 - [ sp:varName "report"^^xsd:string 387 + sp:varName "report"^^xsd:string ;
388 + ] ;
291 ] 389 ]
292 - ] [ sp:object 390 + [
293 - [ sp:varName "created"^^xsd:string 391 + sp:object [
392 + sp:varName "created"^^xsd:string ;
294 ] ; 393 ] ;
295 sp:predicate <http://purl.org/dc/terms/created> ; 394 sp:predicate <http://purl.org/dc/terms/created> ;
296 - sp:subject 395 + sp:subject [
297 - [ sp:varName "report"^^xsd:string 396 + sp:varName "report"^^xsd:string ;
397 + ] ;
298 ] 398 ]
299 - ] [ sp:object 399 + [
300 - [ sp:varName "id"^^xsd:string 400 + sp:object [
401 + sp:varName "id"^^xsd:string ;
301 ] ; 402 ] ;
302 sp:predicate <http://rdfs.org/sioc/ns#id> ; 403 sp:predicate <http://rdfs.org/sioc/ns#id> ;
303 - sp:subject 404 + sp:subject [
304 - [ sp:varName "report"^^xsd:string 405 + sp:varName "report"^^xsd:string ;
406 + ] ;
305 ] 407 ]
306 - ]) 408 + ) ;
307 ] ; 409 ] ;
308 - spin:constraint 410 + spin:constraint [
309 - [ rdf:type spl:Argument ; 411 + rdf:type spl:Argument ;
412 + spl:predicate arg:date ;
413 + spl:valueType xsd:date ;
310 rdfs:comment "The date of the DDR (not the submission date, but the start date of the report)."^^xsd:string ; 414 rdfs:comment "The date of the DDR (not the submission date, but the start date of the report)."^^xsd:string ;
311 - spl:predicate <http://spinrdf.org/arg#date> ;
312 - spl:valueType xsd:date
313 ] ; 415 ] ;
314 - spin:constraint 416 + spin:constraint [
315 - [ rdf:type spl:Argument ; 417 + rdf:type spl:Argument ;
418 + spl:predicate arg:wellBoreId ;
419 + spl:valueType xsd:string ;
316 rdfs:comment "The id of the well bore."^^xsd:string ; 420 rdfs:comment "The id of the well bore."^^xsd:string ;
317 - spl:predicate <http://spinrdf.org/arg#wellBoreId> ;
318 - spl:valueType xsd:string
319 ] ; 421 ] ;
320 - spin:returnType xsd:string . 422 + spin:returnType xsd:string ;
321 - 423 + rdfs:comment "Gets the id of a DDR defined by date and well bore id. If preliminary reports have been created, this will return the most recent one only."^^xsd:string ;
424 + rdfs:label "id of DDR by date and well bore id"^^xsd:string ;
425 + rdfs:subClassOf spin:Functions ;
426 +.
322 reportspin:idOfDPRByDateAndOwner 427 reportspin:idOfDPRByDateAndOwner
323 rdf:type spin:Function ; 428 rdf:type spin:Function ;
324 - rdfs:comment "Gets the id of a DPR defined by date and licence or BAA. If preliminary reports have been created, this will return the most recent one only."^^xsd:string ; 429 + spin:body [
325 - rdfs:label "id of DPR by date and owner"^^xsd:string ; 430 + rdf:type sp:Select ;
326 - rdfs:subClassOf spin:Functions ; 431 + sp:orderBy (
327 - spin:body 432 + [
328 - [ rdf:type sp:Select ; 433 + rdf:type sp:Desc ;
329 - sp:orderBy ([ rdf:type sp:Desc ; 434 + sp:expression [
330 - sp:expression 435 + sp:varName "created"^^xsd:string ;
331 - [ sp:varName "created"^^xsd:string 436 + ] ;
332 - ] 437 + ]
333 - ]) ; 438 + ) ;
334 - sp:resultVariables ([ sp:varName "id"^^xsd:string 439 + sp:resultVariables (
335 - ]) ; 440 + [
336 - sp:where ([ sp:object 441 + sp:varName "id"^^xsd:string ;
337 - [ sp:varName "owner"^^xsd:string 442 + ]
443 + ) ;
444 + sp:where (
445 + [
446 + sp:object [
447 + sp:varName "owner"^^xsd:string ;
338 ] ; 448 ] ;
339 sp:predicate <http://www.reportinghub.no/system/schema/reporting#owner> ; 449 sp:predicate <http://www.reportinghub.no/system/schema/reporting#owner> ;
340 - sp:subject 450 + sp:subject [
341 - [ sp:varName "report"^^xsd:string 451 + sp:varName "report"^^xsd:string ;
452 + ] ;
342 ] 453 ]
343 - ] [ sp:object 454 + [
344 - [ sp:varName "date"^^xsd:string 455 + sp:object [
456 + sp:varName "date"^^xsd:string ;
345 ] ; 457 ] ;
346 sp:predicate <http://purl.org/dc/terms/date> ; 458 sp:predicate <http://purl.org/dc/terms/date> ;
347 - sp:subject 459 + sp:subject [
348 - [ sp:varName "report"^^xsd:string 460 + sp:varName "report"^^xsd:string ;
461 + ] ;
349 ] 462 ]
350 - ] [ sp:object 463 + [
351 - [ sp:varName "created"^^xsd:string 464 + sp:object [
465 + sp:varName "created"^^xsd:string ;
352 ] ; 466 ] ;
353 sp:predicate <http://purl.org/dc/terms/created> ; 467 sp:predicate <http://purl.org/dc/terms/created> ;
354 - sp:subject 468 + sp:subject [
355 - [ sp:varName "report"^^xsd:string 469 + sp:varName "report"^^xsd:string ;
470 + ] ;
356 ] 471 ]
357 - ] [ sp:object 472 + [
358 - [ sp:varName "id"^^xsd:string 473 + sp:object [
474 + sp:varName "id"^^xsd:string ;
359 ] ; 475 ] ;
360 sp:predicate <http://rdfs.org/sioc/ns#id> ; 476 sp:predicate <http://rdfs.org/sioc/ns#id> ;
361 - sp:subject 477 + sp:subject [
362 - [ sp:varName "report"^^xsd:string 478 + sp:varName "report"^^xsd:string ;
479 + ] ;
363 ] 480 ]
364 - ]) 481 + ) ;
365 ] ; 482 ] ;
366 - spin:constraint 483 + spin:constraint [
367 - [ rdf:type spl:Argument ; 484 + rdf:type spl:Argument ;
485 + spl:predicate arg:date ;
486 + spl:valueType xsd:date ;
368 rdfs:comment "The date of the DDR (not the submission date, but the start date of the report)."^^xsd:string ; 487 rdfs:comment "The date of the DDR (not the submission date, but the start date of the report)."^^xsd:string ;
369 - spl:predicate <http://spinrdf.org/arg#date> ;
370 - spl:valueType xsd:date
371 ] ; 488 ] ;
372 - spin:constraint 489 + spin:constraint [
373 - [ rdf:type spl:Argument ; 490 + rdf:type spl:Argument ;
491 + spl:predicate arg:owner ;
492 + spl:valueType <http://www.reportinghub.no/np/schema/npd#Owner> ;
374 rdfs:comment "The Licence or BAA."^^xsd:string ; 493 rdfs:comment "The Licence or BAA."^^xsd:string ;
375 - spl:predicate <http://spinrdf.org/arg#owner> ;
376 - spl:valueType <http://www.reportinghub.no/np/schema/npd#Owner>
377 ] ; 494 ] ;
378 - spin:returnType xsd:string . 495 + spin:returnType xsd:string ;
379 - 496 + rdfs:comment "Gets the id of a DPR defined by date and licence or BAA. If preliminary reports have been created, this will return the most recent one only."^^xsd:string ;
380 -reportspin:idOfMPRGByFieldAndMonth 497 + rdfs:label "id of DPR by date and owner"^^xsd:string ;
381 - rdf:type spin:Function ;
382 - rdfs:label "id of MPRG by field and month"^^xsd:string ;
383 rdfs:subClassOf spin:Functions ; 498 rdfs:subClassOf spin:Functions ;
384 - spin:body 499 +.
385 - [ rdf:type sp:Select ; 500 +reportspin:idOfMPRGByFieldMonthAndParts
386 - sp:orderBy ([ rdf:type sp:Desc ; 501 + rdf:type spin:Function ;
387 - sp:expression 502 + spin:body [
388 - [ sp:varName "created"^^xsd:string 503 + rdf:type sp:Select ;
389 - ] 504 + sp:orderBy (
390 - ]) ; 505 + [
391 - sp:resultVariables ([ sp:varName "id"^^xsd:string 506 + rdf:type sp:Desc ;
392 - ]) ; 507 + sp:expression [
393 - sp:where ([ sp:object 508 + sp:varName "created"^^xsd:string ;
394 - [ sp:varName "fieldName"^^xsd:string 509 + ] ;
510 + ]
511 + ) ;
512 + sp:resultVariables (
513 + [
514 + sp:varName "id"^^xsd:string ;
515 + ]
516 + ) ;
517 + sp:where (
518 + [
519 + sp:object [
520 + sp:varName "fieldName"^^xsd:string ;
395 ] ; 521 ] ;
396 sp:predicate <http://www.reportinghub.no/system/schema/reporting#fieldName> ; 522 sp:predicate <http://www.reportinghub.no/system/schema/reporting#fieldName> ;
397 - sp:subject 523 + sp:subject [
398 - [ sp:varName "report"^^xsd:string 524 + sp:varName "report"^^xsd:string ;
525 + ] ;
399 ] 526 ]
400 - ] [ sp:object 527 + [
401 - [ sp:varName "month"^^xsd:string 528 + sp:object [
529 + sp:varName "month"^^xsd:string ;
402 ] ; 530 ] ;
403 sp:predicate <http://www.reportinghub.no/system/schema/reporting#month> ; 531 sp:predicate <http://www.reportinghub.no/system/schema/reporting#month> ;
404 - sp:subject 532 + sp:subject [
405 - [ sp:varName "report"^^xsd:string 533 + sp:varName "report"^^xsd:string ;
534 + ] ;
406 ] 535 ]
407 - ] [ sp:object 536 + [
408 - [ sp:varName "created"^^xsd:string 537 + sp:object [
538 + sp:varName "parts"^^xsd:string ;
539 + ] ;
540 + sp:predicate <http://www.reportinghub.no/system/schema/reporting#containsParts> ;
541 + sp:subject [
542 + sp:varName "report"^^xsd:string ;
543 + ] ;
544 + ]
545 + [
546 + sp:object [
547 + sp:varName "created"^^xsd:string ;
409 ] ; 548 ] ;
410 sp:predicate <http://purl.org/dc/terms/created> ; 549 sp:predicate <http://purl.org/dc/terms/created> ;
411 - sp:subject 550 + sp:subject [
412 - [ sp:varName "report"^^xsd:string 551 + sp:varName "report"^^xsd:string ;
552 + ] ;
413 ] 553 ]
414 - ] [ sp:object 554 + [
415 - [ sp:varName "id"^^xsd:string 555 + sp:object [
556 + sp:varName "id"^^xsd:string ;
416 ] ; 557 ] ;
417 sp:predicate <http://rdfs.org/sioc/ns#id> ; 558 sp:predicate <http://rdfs.org/sioc/ns#id> ;
418 - sp:subject 559 + sp:subject [
419 - [ sp:varName "report"^^xsd:string 560 + sp:varName "report"^^xsd:string ;
561 + ] ;
420 ] 562 ]
421 - ]) 563 + ) ;
422 ] ; 564 ] ;
423 - spin:constraint 565 + spin:constraint [
424 - [ rdf:type spl:Argument ; 566 + rdf:type spl:Argument ;
567 + spl:predicate arg:fieldName ;
568 + spl:valueType xsd:string ;
425 rdfs:comment "The field name."^^xsd:string ; 569 rdfs:comment "The field name."^^xsd:string ;
426 - spl:predicate <http://spinrdf.org/arg#fieldName> ;
427 - spl:valueType xsd:string
428 ] ; 570 ] ;
429 - spin:constraint 571 + spin:constraint [
430 - [ rdf:type spl:Argument ; 572 + rdf:type spl:Argument ;
573 + spl:predicate arg:month ;
574 + spl:valueType xsd:string ;
431 rdfs:comment "The month, e.g. \"2011-04\""^^xsd:string ; 575 rdfs:comment "The month, e.g. \"2011-04\""^^xsd:string ;
432 - spl:predicate <http://spinrdf.org/arg#month> ;
433 - spl:valueType xsd:string
434 ] ; 576 ] ;
435 - spin:returnType xsd:string . 577 + spin:constraint [
578 + rdf:type spl:Argument ;
579 + spl:predicate arg:parts ;
580 + spl:valueType xsd:string ;
581 + rdfs:comment "The parts value that the report must have (at report:containsParts)."^^xsd:string ;
582 + ] ;
583 + spin:returnType xsd:string ;
584 + rdfs:label "id of MPRG by field, month and parts"^^xsd:string ;
585 + rdfs:subClassOf spin:Functions ;
586 +.
587 +reportspin:idsOfMPRGsByFieldAndMonth
588 + rdf:type spin:MagicProperty ;
589 + spin:body [
590 + rdf:type sp:Select ;
591 + sp:resultVariables (
592 + [
593 + sp:varName "id"^^xsd:string ;
594 + ]
595 + ) ;
596 + sp:where (
597 + [
598 + rdf:type sp:SubQuery ;
599 + sp:query [
600 + rdf:type sp:Select ;
601 + sp:distinct "true"^^xsd:boolean ;
602 + sp:resultVariables (
603 + [
604 + sp:varName "parts"^^xsd:string ;
605 + ]
606 + ) ;
607 + sp:where (
608 + [
609 + sp:object [
610 + sp:varName "fieldName"^^xsd:string ;
611 + ] ;
612 + sp:predicate <http://www.reportinghub.no/system/schema/reporting#fieldName> ;
613 + sp:subject [
614 + sp:varName "report"^^xsd:string ;
615 + ] ;
616 + ]
617 + [
618 + sp:object [
619 + sp:varName "month"^^xsd:string ;
620 + ] ;
621 + sp:predicate <http://www.reportinghub.no/system/schema/reporting#month> ;
622 + sp:subject [
623 + sp:varName "report"^^xsd:string ;
624 + ] ;
625 + ]
626 + [
627 + sp:object [
628 + sp:varName "parts"^^xsd:string ;
629 + ] ;
630 + sp:predicate <http://www.reportinghub.no/system/schema/reporting#containsParts> ;
631 + sp:subject [
632 + sp:varName "report"^^xsd:string ;
633 + ] ;
634 + ]
635 + ) ;
636 + ] ;
637 + ]
638 + [
639 + rdf:type sp:Bind ;
640 + sp:expression [
641 + rdf:type reportspin:idOfMPRGByFieldMonthAndParts ;
642 + arg:fieldName [
643 + sp:varName "fieldName"^^xsd:string ;
644 + ] ;
645 + arg:month [
646 + sp:varName "month"^^xsd:string ;
647 + ] ;
648 + arg:parts [
649 + sp:varName "parts"^^xsd:string ;
650 + ] ;
651 + ] ;
652 + sp:variable [
653 + sp:varName "id"^^xsd:string ;
654 + ] ;
655 + ]
656 + ) ;
657 + ] ;
658 + spin:constraint [
659 + rdf:type spl:Argument ;
660 + spl:predicate arg:fieldName ;
661 + spl:valueType xsd:string ;
662 + rdfs:comment "The field name."^^xsd:string ;
663 + ] ;
664 + spin:constraint [
665 + rdf:type spl:Argument ;
666 + spl:predicate arg:month ;
667 + spl:valueType xsd:string ;
668 + rdfs:comment "The month, e.g. \"2011-04\""^^xsd:string ;
669 + ] ;
670 + rdfs:comment "Gets the ids of all MPRGs for a given field/month combination, iterating through all used parts combinations."^^xsd:string ;
671 + rdfs:label "ids of MPRGs by field and month"^^xsd:string ;
672 + rdfs:subClassOf spin:MagicProperties ;
673 +.
674 +reportspin:isPreliminaryById
675 + rdf:type spin:Function ;
676 + spin:body [
677 + rdf:type sp:Select ;
678 + sp:resultVariables (
679 + [
680 + sp:varName "result"^^xsd:string ;
681 + ]
682 + ) ;
683 + sp:where (
684 + [
685 + sp:object [
686 + sp:varName "id"^^xsd:string ;
687 + ] ;
688 + sp:predicate <http://rdfs.org/sioc/ns#id> ;
689 + sp:subject [
690 + sp:varName "report"^^xsd:string ;
691 + ] ;
692 + ]
693 + [
694 + sp:object [
695 + sp:varName "result"^^xsd:string ;
696 + ] ;
697 + sp:predicate <http://www.reportinghub.no/system/schema/reporting#preliminary> ;
698 + sp:subject [
699 + sp:varName "report"^^xsd:string ;
700 + ] ;
701 + ]
702 + ) ;
703 + ] ;
704 + spin:constraint [
705 + rdf:type spl:Argument ;
706 + spl:predicate arg:id ;
707 + spl:valueType xsd:string ;
708 + rdfs:comment "The of the report to check."^^xsd:string ;
709 + ] ;
710 + spin:returnType xsd:boolean ;
711 + rdfs:label "is preliminary by id"^^xsd:string ;
712 + rdfs:subClassOf spin:Functions ;
713 +.
......