SPIN-reporting.spin.ttl
15.8 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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# baseURI: http://www.reportinghub.no/system/spin/reporting
# imports: http://spinrdf.org/spin
# imports: http://www.reportinghub.no/system/schema/reporting
@prefix fn: <http://www.w3.org/2005/xpath-functions#> .
@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 reportspin: <http://www.reportinghub.no/system/spin/reporting#> .
@prefix rhspin: <http://www.reportinghub.no/spin/rh#> .
@prefix sp: <http://spinrdf.org/sp#> .
@prefix spin: <http://spinrdf.org/spin#> .
@prefix spl: <http://spinrdf.org/spl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://spinrdf.org/arg#date>
rdf:type rdf:Property ;
rdfs:label "date"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
<http://spinrdf.org/arg#id>
rdf:type rdf:Property ;
rdfs:label "id"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
<http://spinrdf.org/arg#owner>
rdf:type rdf:Property ;
rdfs:label "owner"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
<http://spinrdf.org/arg#wellBoreId>
rdf:type rdf:Property ;
rdfs:label "well bore id"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
<http://www.reportinghub.no/system/spin/reporting>
rdf:type owl:Ontology ;
rdfs:comment "SPIN functions and templates to support querying report metadata."^^xsd:string ;
owl:imports <http://spinrdf.org/spin> , <http://www.reportinghub.no/system/schema/reporting> ;
owl:versionInfo "0.1.0"^^xsd:string .
reportspin:DDRsOverview
rdf:type spin:SelectTemplate ;
rdfs:label "DDRs overview"^^xsd:string ;
rdfs:subClassOf spin:SelectTemplates ;
spin:body
[ rdf:type sp:Select ;
sp:orderBy ([ sp:varName "wellBoreName"^^xsd:string
] [ sp:varName "date"^^xsd:string
] [ sp:varName "created"^^xsd:string
]) ;
sp:resultVariables ([ sp:varName "wellBoreName"^^xsd:string
] [ sp:varName "date"^^xsd:string
] [ sp:varName "created"^^xsd:string
] [ sp:varName "id"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "wellBoreId"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ;
sp:subject
[ sp:varName "ddr"^^xsd:string
]
] [ sp:object
[ sp:varName "created"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject
[ sp:varName "ddr"^^xsd:string
]
] [ sp:object
[ sp:varName "date"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/date> ;
sp:subject
[ sp:varName "ddr"^^xsd:string
]
] [ sp:object
[ sp:varName "id"^^xsd:string
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject
[ sp:varName "ddr"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:wellBoreById ;
sp:arg1 [ sp:varName "wellBoreId"^^xsd:string
]
] ;
sp:variable
[ sp:varName "wellBore"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:npdName ;
sp:arg1 [ sp:varName "wellBore"^^xsd:string
]
] ;
sp:variable
[ sp:varName "wellBoreName"^^xsd:string
]
])
] .
reportspin:DPRsOverview
rdf:type spin:SelectTemplate ;
rdfs:label "DPRs overview"^^xsd:string ;
rdfs:subClassOf spin:SelectTemplates ;
spin:body
[ rdf:type sp:Select ;
sp:orderBy ([ sp:varName "ownerName"^^xsd:string
] [ sp:varName "date"^^xsd:string
] [ sp:varName "created"^^xsd:string
]) ;
sp:resultVariables ([ sp:varName "ownerName"^^xsd:string
] [ sp:varName "date"^^xsd:string
] [ sp:varName "created"^^xsd:string
] [ sp:varName "id"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "id"^^xsd:string
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject
[ sp:varName "dpr"^^xsd:string
]
] [ sp:object
[ sp:varName "created"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject
[ sp:varName "dpr"^^xsd:string
]
] [ sp:object
[ sp:varName "date"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/date> ;
sp:subject
[ sp:varName "dpr"^^xsd:string
]
] [ sp:object
[ sp:varName "owner"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#owner> ;
sp:subject
[ sp:varName "dpr"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:npdName ;
sp:arg1 [ sp:varName "owner"^^xsd:string
]
] ;
sp:variable
[ sp:varName "ownerName"^^xsd:string
]
])
] .
reportspin:graphByDDRId
rdf:type spin:Function ;
rdfs:comment "Gets the URI of the named graph containing the triples submitted by a report:DDR (metadata) with a given id."^^xsd:string ;
rdfs:label "graph by DDR id"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables ([ rdf:type sp:iri ;
sp:arg1 [ sp:varName "uri"^^xsd:string
]
]) ;
sp:where ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "http://www.reportinghub.no/system/ddr/" ;
sp:arg2 [ sp:varName "id"^^xsd:string
]
] ;
sp:variable
[ sp:varName "uri"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The id of the DDR metadata."^^xsd:string ;
spl:predicate <http://spinrdf.org/arg#id> ;
spl:valueType xsd:string
] ;
spin:returnType rdfs:Resource .
reportspin:graphByDPRId
rdf:type spin:Function ;
rdfs:comment "Gets the URI of the named graph containing the triples submitted by a report:DPR (metadata) with a given id."^^xsd:string ;
rdfs:label "graph by DPR id"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables ([ rdf:type sp:iri ;
sp:arg1 [ sp:varName "uri"^^xsd:string
]
]) ;
sp:where ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "http://www.reportinghub.no/system/dpr/" ;
sp:arg2 [ sp:varName "id"^^xsd:string
]
] ;
sp:variable
[ sp:varName "uri"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The id of the DPR metadata."^^xsd:string ;
spl:predicate <http://spinrdf.org/arg#id> ;
spl:valueType xsd:string
] ;
spin:returnType rdfs:Resource .
reportspin:idOfDDRByDateAndWellBoreId
rdf:type spin:Function ;
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 ;
rdfs:label "id of DDR by date and well bore id"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:orderBy ([ rdf:type sp:Desc ;
sp:expression
[ sp:varName "created"^^xsd:string
]
]) ;
sp:resultVariables ([ sp:varName "id"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "wellBoreId"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "date"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/date> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "created"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "id"^^xsd:string
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The id of the well bore."^^xsd:string ;
spl:predicate <http://spinrdf.org/arg#wellBoreId> ;
spl:valueType xsd:string
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The date of the DDR (not the submission date, but the start date of the report)."^^xsd:string ;
spl:predicate <http://spinrdf.org/arg#date> ;
spl:valueType xsd:date
] ;
spin:returnType xsd:string .
reportspin:idOfDPRByDateAndOwner
rdf:type spin:Function ;
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 ;
rdfs:label "id of DPR by date and owner"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:orderBy ([ rdf:type sp:Desc ;
sp:expression
[ sp:varName "created"^^xsd:string
]
]) ;
sp:resultVariables ([ sp:varName "id"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "owner"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#owner> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "date"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/date> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "created"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "id"^^xsd:string
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The date of the DDR (not the submission date, but the start date of the report)."^^xsd:string ;
spl:predicate <http://spinrdf.org/arg#date> ;
spl:valueType xsd:date
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The Licence or BAA."^^xsd:string ;
spl:predicate <http://spinrdf.org/arg#owner> ;
spl:valueType <http://www.reportinghub.no/np/schema/npd#Owner>
] ;
spin:returnType xsd:string .