Holger Knublauch

Latest SPIN functions

1 -# baseURI: http://www.reportinghub.no/system/spin/reporting 1 +# baseURI: http://www.reportinghub.no/system/spin/reporting
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 -@prefix fn: <http://www.w3.org/2005/xpath-functions#> . 5 +# c14n-version: 3
6 -@prefix owl: <http://www.w3.org/2002/07/owl#> . 6 +@prefix arg: <http://spinrdf.org/arg#> .
7 -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . 7 +@prefix fn: <http://www.w3.org/2005/xpath-functions#> .
8 -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . 8 +@prefix owl: <http://www.w3.org/2002/07/owl#> .
9 -@prefix reportspin: <http://www.reportinghub.no/system/spin/reporting#> . 9 +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
10 -@prefix rhspin: <http://www.reportinghub.no/spin/rh#> . 10 +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
11 -@prefix sp: <http://spinrdf.org/sp#> . 11 +@prefix reportspin: <http://www.reportinghub.no/system/spin/reporting#> .
12 -@prefix spin: <http://spinrdf.org/spin#> . 12 +@prefix rhspin: <http://www.reportinghub.no/spin/rh#> .
13 -@prefix spl: <http://spinrdf.org/spl#> . 13 +@prefix sp: <http://spinrdf.org/sp#> .
14 -@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . 14 +@prefix spin: <http://spinrdf.org/spin#> .
15 - 15 +@prefix spl: <http://spinrdf.org/spl#> .
16 -<http://spinrdf.org/arg#date> 16 +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
17 - rdf:type rdf:Property ; 17 +arg:date
18 - rdfs:label "date"^^xsd:string ; 18 + rdf:type rdf:Property ;
19 - rdfs:subPropertyOf sp:arg . 19 + rdfs:label "date"^^xsd:string ;
20 - 20 + rdfs:subPropertyOf sp:arg ;
21 -<http://spinrdf.org/arg#fieldName> 21 +.
22 - rdf:type rdf:Property ; 22 +arg:fieldName
23 - rdfs:label "field name"^^xsd:string ; 23 + rdf:type rdf:Property ;
24 - rdfs:subPropertyOf sp:arg . 24 + rdfs:label "field name"^^xsd:string ;
25 - 25 + rdfs:subPropertyOf sp:arg ;
26 -<http://spinrdf.org/arg#id> 26 +.
27 - rdf:type rdf:Property ; 27 +arg:id
28 - rdfs:label "id"^^xsd:string ; 28 + rdf:type rdf:Property ;
29 - rdfs:subPropertyOf sp:arg . 29 + rdfs:label "id"^^xsd:string ;
30 - 30 + rdfs:subPropertyOf sp:arg ;
31 -<http://spinrdf.org/arg#month> 31 +.
32 - rdf:type rdf:Property ; 32 +arg:month
33 - rdfs:label "month"^^xsd:string ; 33 + rdf:type rdf:Property ;
34 - rdfs:subPropertyOf sp:arg . 34 + rdfs:label "month"^^xsd:string ;
35 - 35 + rdfs:subPropertyOf sp:arg ;
36 -<http://spinrdf.org/arg#owner> 36 +.
37 - rdf:type rdf:Property ; 37 +arg:owner
38 - rdfs:label "owner"^^xsd:string ; 38 + rdf:type rdf:Property ;
39 - rdfs:subPropertyOf sp:arg . 39 + rdfs:label "owner"^^xsd:string ;
40 - 40 + rdfs:subPropertyOf sp:arg ;
41 -<http://spinrdf.org/arg#wellBoreId> 41 +.
42 - rdf:type rdf:Property ; 42 +arg:parts
43 - rdfs:label "well bore id"^^xsd:string ; 43 + rdf:type rdf:Property ;
44 - rdfs:subPropertyOf sp:arg . 44 + rdfs:label "parts"^^xsd:string ;
45 - 45 + rdfs:subPropertyOf sp:arg ;
46 +.
47 +arg:wellBoreId
48 + rdf:type rdf:Property ;
49 + rdfs:label "well bore id"^^xsd:string ;
50 + rdfs:subPropertyOf sp:arg ;
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 + [
69 - ] ; 76 + sp:varName "wellBoreName"^^xsd:string ;
70 - sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ; 77 + ]
71 - sp:subject 78 + [
72 - [ sp:varName "ddr"^^xsd:string 79 + sp:varName "date"^^xsd:string ;
73 - ] 80 + ]
74 - ] [ sp:object 81 + [
75 - [ sp:varName "created"^^xsd:string 82 + sp:varName "created"^^xsd:string ;
76 - ] ; 83 + ]
77 - sp:predicate <http://purl.org/dc/terms/created> ; 84 + [
78 - sp:subject 85 + sp:varName "id"^^xsd:string ;
79 - [ sp:varName "ddr"^^xsd:string 86 + ]
80 - ] 87 + ) ;
81 - ] [ sp:object 88 + sp:where (
82 - [ sp:varName "date"^^xsd:string 89 + [
83 - ] ; 90 + sp:object [
84 - sp:predicate <http://purl.org/dc/terms/date> ; 91 + sp:varName "wellBoreId"^^xsd:string ;
85 - sp:subject 92 + ] ;
86 - [ sp:varName "ddr"^^xsd:string 93 + sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ;
87 - ] 94 + sp:subject [
88 - ] [ sp:object 95 + sp:varName "ddr"^^xsd:string ;
89 - [ sp:varName "id"^^xsd:string 96 + ] ;
90 - ] ; 97 + ]
91 - sp:predicate <http://rdfs.org/sioc/ns#id> ; 98 + [
92 - sp:subject 99 + sp:object [
93 - [ sp:varName "ddr"^^xsd:string 100 + sp:varName "created"^^xsd:string ;
94 - ] 101 + ] ;
95 - ] [ rdf:type sp:Bind ; 102 + sp:predicate <http://purl.org/dc/terms/created> ;
96 - sp:expression 103 + sp:subject [
97 - [ rdf:type rhspin:wellBoreById ; 104 + sp:varName "ddr"^^xsd:string ;
98 - sp:arg1 [ sp:varName "wellBoreId"^^xsd:string 105 + ] ;
99 - ] 106 + ]
100 - ] ; 107 + [
101 - sp:variable 108 + sp:object [
102 - [ sp:varName "wellBore"^^xsd:string 109 + sp:varName "date"^^xsd:string ;
103 - ] 110 + ] ;
104 - ] [ rdf:type sp:Bind ; 111 + sp:predicate <http://purl.org/dc/terms/date> ;
105 - sp:expression 112 + sp:subject [
106 - [ rdf:type rhspin:npdName ; 113 + sp:varName "ddr"^^xsd:string ;
107 - sp:arg1 [ sp:varName "wellBore"^^xsd:string 114 + ] ;
108 - ] 115 + ]
109 - ] ; 116 + [
110 - sp:variable 117 + sp:object [
111 - [ sp:varName "wellBoreName"^^xsd:string 118 + sp:varName "id"^^xsd:string ;
112 - ] 119 + ] ;
113 - ]) 120 + sp:predicate <http://rdfs.org/sioc/ns#id> ;
114 - ] . 121 + sp:subject [
115 - 122 + sp:varName "ddr"^^xsd:string ;
123 + ] ;
124 + ]
125 + [
126 + rdf:type sp:Bind ;
127 + sp:expression [
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 + ] ;
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 ;
147 + ] ;
148 + ]
149 + ) ;
150 + ] ;
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 + [
133 - ] ; 171 + sp:varName "ownerName"^^xsd:string ;
134 - sp:predicate <http://rdfs.org/sioc/ns#id> ; 172 + ]
135 - sp:subject 173 + [
136 - [ sp:varName "dpr"^^xsd:string 174 + sp:varName "date"^^xsd:string ;
137 - ] 175 + ]
138 - ] [ sp:object 176 + [
139 - [ sp:varName "created"^^xsd:string 177 + sp:varName "created"^^xsd:string ;
140 - ] ; 178 + ]
141 - sp:predicate <http://purl.org/dc/terms/created> ; 179 + [
142 - sp:subject 180 + sp:varName "id"^^xsd:string ;
143 - [ sp:varName "dpr"^^xsd:string 181 + ]
144 - ] 182 + ) ;
145 - ] [ sp:object 183 + sp:where (
146 - [ sp:varName "date"^^xsd:string 184 + [
147 - ] ; 185 + sp:object [
148 - sp:predicate <http://purl.org/dc/terms/date> ; 186 + sp:varName "id"^^xsd:string ;
149 - sp:subject 187 + ] ;
150 - [ sp:varName "dpr"^^xsd:string 188 + sp:predicate <http://rdfs.org/sioc/ns#id> ;
151 - ] 189 + sp:subject [
152 - ] [ sp:object 190 + sp:varName "dpr"^^xsd:string ;
153 - [ sp:varName "owner"^^xsd:string 191 + ] ;
154 - ] ; 192 + ]
155 - sp:predicate <http://www.reportinghub.no/system/schema/reporting#owner> ; 193 + [
156 - sp:subject 194 + sp:object [
157 - [ sp:varName "dpr"^^xsd:string 195 + sp:varName "created"^^xsd:string ;
158 - ] 196 + ] ;
159 - ] [ rdf:type sp:Bind ; 197 + sp:predicate <http://purl.org/dc/terms/created> ;
160 - sp:expression 198 + sp:subject [
161 - [ rdf:type rhspin:npdName ; 199 + sp:varName "dpr"^^xsd:string ;
162 - sp:arg1 [ sp:varName "owner"^^xsd:string 200 + ] ;
163 - ] 201 + ]
164 - ] ; 202 + [
165 - sp:variable 203 + sp:object [
166 - [ sp:varName "ownerName"^^xsd:string 204 + sp:varName "date"^^xsd:string ;
167 - ] 205 + ] ;
168 - ]) 206 + sp:predicate <http://purl.org/dc/terms/date> ;
169 - ] . 207 + sp:subject [
170 - 208 + sp:varName "dpr"^^xsd:string ;
209 + ] ;
210 + ]
211 + [
212 + sp:object [
213 + sp:varName "owner"^^xsd:string ;
214 + ] ;
215 + sp:predicate <http://www.reportinghub.no/system/schema/reporting#owner> ;
216 + sp:subject [
217 + sp:varName "dpr"^^xsd:string ;
218 + ] ;
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 ;
230 + ] ;
231 + ]
232 + ) ;
233 + ] ;
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 + [
185 - sp:arg1 "http://www.reportinghub.no/system/ddr/" ; 251 + rdf:type sp:Bind ;
186 - sp:arg2 [ sp:varName "id"^^xsd:string 252 + sp:expression [
187 - ] 253 + rdf:type fn:concat ;
188 - ] ; 254 + sp:arg1 "http://www.reportinghub.no/system/ddr/" ;
189 - sp:variable 255 + sp:arg2 [
190 - [ sp:varName "uri"^^xsd:string 256 + sp:varName "id"^^xsd:string ;
191 - ] 257 + ] ;
192 - ]) 258 + ] ;
193 - ] ; 259 + sp:variable [
194 - spin:constraint 260 + sp:varName "uri"^^xsd:string ;
195 - [ rdf:type spl:Argument ; 261 + ] ;
196 - rdfs:comment "The id of the DDR metadata."^^xsd:string ; 262 + ]
197 - spl:predicate <http://spinrdf.org/arg#id> ; 263 + ) ;
198 - spl:valueType xsd:string 264 + ] ;
199 - ] ; 265 + spin:constraint [
200 - spin:returnType rdfs:Resource . 266 + rdf:type spl:Argument ;
201 - 267 + spl:predicate arg:id ;
268 + spl:valueType xsd:string ;
269 + rdfs:comment "The id of the DDR metadata."^^xsd:string ;
270 + ] ;
271 + spin:returnType rdfs:Resource ;
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 + [
216 - sp:arg1 "http://www.reportinghub.no/system/dpr/" ; 290 + rdf:type sp:Bind ;
217 - sp:arg2 [ sp:varName "id"^^xsd:string 291 + sp:expression [
218 - ] 292 + rdf:type fn:concat ;
219 - ] ; 293 + sp:arg1 "http://www.reportinghub.no/system/dpr/" ;
220 - sp:variable 294 + sp:arg2 [
221 - [ sp:varName "uri"^^xsd:string 295 + sp:varName "id"^^xsd:string ;
222 - ] 296 + ] ;
223 - ]) 297 + ] ;
224 - ] ; 298 + sp:variable [
225 - spin:constraint 299 + sp:varName "uri"^^xsd:string ;
226 - [ rdf:type spl:Argument ; 300 + ] ;
227 - rdfs:comment "The id of the DPR metadata."^^xsd:string ; 301 + ]
228 - spl:predicate <http://spinrdf.org/arg#id> ; 302 + ) ;
229 - spl:valueType xsd:string 303 + ] ;
230 - ] ; 304 + spin:constraint [
231 - spin:returnType rdfs:Resource . 305 + rdf:type spl:Argument ;
232 - 306 + spl:predicate arg:id ;
307 + spl:valueType xsd:string ;
308 + rdfs:comment "The id of the DPR metadata."^^xsd:string ;
309 + ] ;
310 + spin:returnType rdfs:Resource ;
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 + [
247 - sp:arg1 "http://www.reportinghub.no/system/report/" ; 329 + rdf:type sp:Bind ;
248 - sp:arg2 [ sp:varName "id"^^xsd:string 330 + sp:expression [
249 - ] 331 + rdf:type fn:concat ;
250 - ] ; 332 + sp:arg1 "http://www.reportinghub.no/system/report/" ;
251 - sp:variable 333 + sp:arg2 [
252 - [ sp:varName "uri"^^xsd:string 334 + sp:varName "id"^^xsd:string ;
253 - ] 335 + ] ;
254 - ]) 336 + ] ;
255 - ] ; 337 + sp:variable [
256 - spin:constraint 338 + sp:varName "uri"^^xsd:string ;
257 - [ rdf:type spl:Argument ; 339 + ] ;
258 - rdfs:comment "The id of the DDR metadata."^^xsd:string ; 340 + ]
259 - spl:predicate <http://spinrdf.org/arg#id> ; 341 + ) ;
260 - spl:valueType xsd:string 342 + ] ;
261 - ] ; 343 + spin:constraint [
262 - spin:returnType rdfs:Resource . 344 + rdf:type spl:Argument ;
263 - 345 + spl:predicate arg:id ;
346 + spl:valueType xsd:string ;
347 + rdfs:comment "The id of the DDR metadata."^^xsd:string ;
348 + ] ;
349 + spin:returnType rdfs:Resource ;
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 + ]
280 - ] ; 370 + ) ;
281 - sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ; 371 + sp:where (
282 - sp:subject 372 + [
283 - [ sp:varName "report"^^xsd:string 373 + sp:object [
284 - ] 374 + sp:varName "wellBoreId"^^xsd:string ;
285 - ] [ sp:object 375 + ] ;
286 - [ sp:varName "date"^^xsd:string 376 + sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ;
287 - ] ; 377 + sp:subject [
288 - sp:predicate <http://purl.org/dc/terms/date> ; 378 + sp:varName "report"^^xsd:string ;
289 - sp:subject 379 + ] ;
290 - [ sp:varName "report"^^xsd:string 380 + ]
291 - ] 381 + [
292 - ] [ sp:object 382 + sp:object [
293 - [ sp:varName "created"^^xsd:string 383 + sp:varName "date"^^xsd:string ;
294 - ] ; 384 + ] ;
295 - sp:predicate <http://purl.org/dc/terms/created> ; 385 + sp:predicate <http://purl.org/dc/terms/date> ;
296 - sp:subject 386 + sp:subject [
297 - [ sp:varName "report"^^xsd:string 387 + sp:varName "report"^^xsd:string ;
298 - ] 388 + ] ;
299 - ] [ sp:object 389 + ]
300 - [ sp:varName "id"^^xsd:string 390 + [
301 - ] ; 391 + sp:object [
302 - sp:predicate <http://rdfs.org/sioc/ns#id> ; 392 + sp:varName "created"^^xsd:string ;
303 - sp:subject 393 + ] ;
304 - [ sp:varName "report"^^xsd:string 394 + sp:predicate <http://purl.org/dc/terms/created> ;
305 - ] 395 + sp:subject [
306 - ]) 396 + sp:varName "report"^^xsd:string ;
307 - ] ; 397 + ] ;
308 - spin:constraint 398 + ]
309 - [ rdf:type spl:Argument ; 399 + [
310 - rdfs:comment "The date of the DDR (not the submission date, but the start date of the report)."^^xsd:string ; 400 + sp:object [
311 - spl:predicate <http://spinrdf.org/arg#date> ; 401 + sp:varName "id"^^xsd:string ;
312 - spl:valueType xsd:date 402 + ] ;
313 - ] ; 403 + sp:predicate <http://rdfs.org/sioc/ns#id> ;
314 - spin:constraint 404 + sp:subject [
315 - [ rdf:type spl:Argument ; 405 + sp:varName "report"^^xsd:string ;
316 - rdfs:comment "The id of the well bore."^^xsd:string ; 406 + ] ;
317 - spl:predicate <http://spinrdf.org/arg#wellBoreId> ; 407 + ]
318 - spl:valueType xsd:string 408 + ) ;
319 - ] ; 409 + ] ;
320 - spin:returnType xsd:string . 410 + spin:constraint [
321 - 411 + rdf:type spl:Argument ;
412 + spl:predicate arg:date ;
413 + spl:valueType xsd:date ;
414 + rdfs:comment "The date of the DDR (not the submission date, but the start date of the report)."^^xsd:string ;
415 + ] ;
416 + spin:constraint [
417 + rdf:type spl:Argument ;
418 + spl:predicate arg:wellBoreId ;
419 + spl:valueType xsd:string ;
420 + rdfs:comment "The id of the well bore."^^xsd:string ;
421 + ] ;
422 + spin:returnType xsd:string ;
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 + ]
338 - ] ; 443 + ) ;
339 - sp:predicate <http://www.reportinghub.no/system/schema/reporting#owner> ; 444 + sp:where (
340 - sp:subject 445 + [
341 - [ sp:varName "report"^^xsd:string 446 + sp:object [
342 - ] 447 + sp:varName "owner"^^xsd:string ;
343 - ] [ sp:object 448 + ] ;
344 - [ sp:varName "date"^^xsd:string 449 + sp:predicate <http://www.reportinghub.no/system/schema/reporting#owner> ;
345 - ] ; 450 + sp:subject [
346 - sp:predicate <http://purl.org/dc/terms/date> ; 451 + sp:varName "report"^^xsd:string ;
347 - sp:subject 452 + ] ;
348 - [ sp:varName "report"^^xsd:string 453 + ]
349 - ] 454 + [
350 - ] [ sp:object 455 + sp:object [
351 - [ sp:varName "created"^^xsd:string 456 + sp:varName "date"^^xsd:string ;
352 - ] ; 457 + ] ;
353 - sp:predicate <http://purl.org/dc/terms/created> ; 458 + sp:predicate <http://purl.org/dc/terms/date> ;
354 - sp:subject 459 + sp:subject [
355 - [ sp:varName "report"^^xsd:string 460 + sp:varName "report"^^xsd:string ;
356 - ] 461 + ] ;
357 - ] [ sp:object 462 + ]
358 - [ sp:varName "id"^^xsd:string 463 + [
359 - ] ; 464 + sp:object [
360 - sp:predicate <http://rdfs.org/sioc/ns#id> ; 465 + sp:varName "created"^^xsd:string ;
361 - sp:subject 466 + ] ;
362 - [ sp:varName "report"^^xsd:string 467 + sp:predicate <http://purl.org/dc/terms/created> ;
363 - ] 468 + sp:subject [
364 - ]) 469 + sp:varName "report"^^xsd:string ;
365 - ] ; 470 + ] ;
366 - spin:constraint 471 + ]
367 - [ rdf:type spl:Argument ; 472 + [
368 - rdfs:comment "The date of the DDR (not the submission date, but the start date of the report)."^^xsd:string ; 473 + sp:object [
369 - spl:predicate <http://spinrdf.org/arg#date> ; 474 + sp:varName "id"^^xsd:string ;
370 - spl:valueType xsd:date 475 + ] ;
371 - ] ; 476 + sp:predicate <http://rdfs.org/sioc/ns#id> ;
372 - spin:constraint 477 + sp:subject [
373 - [ rdf:type spl:Argument ; 478 + sp:varName "report"^^xsd:string ;
374 - rdfs:comment "The Licence or BAA."^^xsd:string ; 479 + ] ;
375 - spl:predicate <http://spinrdf.org/arg#owner> ; 480 + ]
376 - spl:valueType <http://www.reportinghub.no/np/schema/npd#Owner> 481 + ) ;
377 - ] ; 482 + ] ;
378 - spin:returnType xsd:string . 483 + spin:constraint [
379 - 484 + rdf:type spl:Argument ;
380 -reportspin:idOfMPRGByFieldAndMonth 485 + spl:predicate arg:date ;
381 - rdf:type spin:Function ; 486 + spl:valueType xsd:date ;
382 - rdfs:label "id of MPRG by field and month"^^xsd:string ; 487 + rdfs:comment "The date of the DDR (not the submission date, but the start date of the report)."^^xsd:string ;
383 - rdfs:subClassOf spin:Functions ; 488 + ] ;
384 - spin:body 489 + spin:constraint [
385 - [ rdf:type sp:Select ; 490 + rdf:type spl:Argument ;
386 - sp:orderBy ([ rdf:type sp:Desc ; 491 + spl:predicate arg:owner ;
387 - sp:expression 492 + spl:valueType <http://www.reportinghub.no/np/schema/npd#Owner> ;
388 - [ sp:varName "created"^^xsd:string 493 + rdfs:comment "The Licence or BAA."^^xsd:string ;
389 - ] 494 + ] ;
390 - ]) ; 495 + spin:returnType xsd:string ;
391 - sp:resultVariables ([ sp:varName "id"^^xsd:string 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 ;
392 - ]) ; 497 + rdfs:label "id of DPR by date and owner"^^xsd:string ;
393 - sp:where ([ sp:object 498 + rdfs:subClassOf spin:Functions ;
394 - [ sp:varName "fieldName"^^xsd:string 499 +.
395 - ] ; 500 +reportspin:idOfMPRGByFieldMonthAndParts
396 - sp:predicate <http://www.reportinghub.no/system/schema/reporting#fieldName> ; 501 + rdf:type spin:Function ;
397 - sp:subject 502 + spin:body [
398 - [ sp:varName "report"^^xsd:string 503 + rdf:type sp:Select ;
399 - ] 504 + sp:orderBy (
400 - ] [ sp:object 505 + [
401 - [ sp:varName "month"^^xsd:string 506 + rdf:type sp:Desc ;
402 - ] ; 507 + sp:expression [
403 - sp:predicate <http://www.reportinghub.no/system/schema/reporting#month> ; 508 + sp:varName "created"^^xsd:string ;
404 - sp:subject 509 + ] ;
405 - [ sp:varName "report"^^xsd:string 510 + ]
406 - ] 511 + ) ;
407 - ] [ sp:object 512 + sp:resultVariables (
408 - [ sp:varName "created"^^xsd:string 513 + [
409 - ] ; 514 + sp:varName "id"^^xsd:string ;
410 - sp:predicate <http://purl.org/dc/terms/created> ; 515 + ]
411 - sp:subject 516 + ) ;
412 - [ sp:varName "report"^^xsd:string 517 + sp:where (
413 - ] 518 + [
414 - ] [ sp:object 519 + sp:object [
415 - [ sp:varName "id"^^xsd:string 520 + sp:varName "fieldName"^^xsd:string ;
416 - ] ; 521 + ] ;
417 - sp:predicate <http://rdfs.org/sioc/ns#id> ; 522 + sp:predicate <http://www.reportinghub.no/system/schema/reporting#fieldName> ;
418 - sp:subject 523 + sp:subject [
419 - [ sp:varName "report"^^xsd:string 524 + sp:varName "report"^^xsd:string ;
420 - ] 525 + ] ;
421 - ]) 526 + ]
422 - ] ; 527 + [
423 - spin:constraint 528 + sp:object [
424 - [ rdf:type spl:Argument ; 529 + sp:varName "month"^^xsd:string ;
425 - rdfs:comment "The field name."^^xsd:string ; 530 + ] ;
426 - spl:predicate <http://spinrdf.org/arg#fieldName> ; 531 + sp:predicate <http://www.reportinghub.no/system/schema/reporting#month> ;
427 - spl:valueType xsd:string 532 + sp:subject [
428 - ] ; 533 + sp:varName "report"^^xsd:string ;
429 - spin:constraint 534 + ] ;
430 - [ rdf:type spl:Argument ; 535 + ]
431 - rdfs:comment "The month, e.g. \"2011-04\""^^xsd:string ; 536 + [
432 - spl:predicate <http://spinrdf.org/arg#month> ; 537 + sp:object [
433 - spl:valueType xsd:string 538 + sp:varName "parts"^^xsd:string ;
434 - ] ; 539 + ] ;
435 - spin:returnType xsd:string . 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 ;
548 + ] ;
549 + sp:predicate <http://purl.org/dc/terms/created> ;
550 + sp:subject [
551 + sp:varName "report"^^xsd:string ;
552 + ] ;
553 + ]
554 + [
555 + sp:object [
556 + sp:varName "id"^^xsd:string ;
557 + ] ;
558 + sp:predicate <http://rdfs.org/sioc/ns#id> ;
559 + sp:subject [
560 + sp:varName "report"^^xsd:string ;
561 + ] ;
562 + ]
563 + ) ;
564 + ] ;
565 + spin:constraint [
566 + rdf:type spl:Argument ;
567 + spl:predicate arg:fieldName ;
568 + spl:valueType xsd:string ;
569 + rdfs:comment "The field name."^^xsd:string ;
570 + ] ;
571 + spin:constraint [
572 + rdf:type spl:Argument ;
573 + spl:predicate arg:month ;
574 + spl:valueType xsd:string ;
575 + rdfs:comment "The month, e.g. \"2011-04\""^^xsd:string ;
576 + ] ;
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 +.
......