Holger Knublauch

Added test NPD triples file, additional SPIN function for MPRG

...@@ -40,6 +40,11 @@ arg:ddr ...@@ -40,6 +40,11 @@ arg:ddr
40 rdfs:label "ddr"^^xsd:string ; 40 rdfs:label "ddr"^^xsd:string ;
41 rdfs:subPropertyOf sp:arg . 41 rdfs:subPropertyOf sp:arg .
42 42
43 +arg:fieldName
44 + rdf:type rdf:Property ;
45 + rdfs:label "field name"^^xsd:string ;
46 + rdfs:subPropertyOf sp:arg .
47 +
43 arg:id 48 arg:id
44 rdf:type rdf:Property ; 49 rdf:type rdf:Property ;
45 rdfs:label "id"^^xsd:string ; 50 rdfs:label "id"^^xsd:string ;
...@@ -172,6 +177,71 @@ rhspin:DPRTableTemplates ...@@ -172,6 +177,71 @@ rhspin:DPRTableTemplates
172 spl:valueType <http://www.reportinghub.no/ep/schema/production-report#DailyProductionReport> 177 spl:valueType <http://www.reportinghub.no/ep/schema/production-report#DailyProductionReport>
173 ] . 178 ] .
174 179
180 +rhspin:GetFieldsOfCompanyName
181 + rdf:type spin:SelectTemplate ;
182 + rdfs:comment "Gets the fields that a company with a given name has access to. Result variables are ?fieldId and ?fieldName."^^xsd:string ;
183 + rdfs:label "Get fields of company name"^^xsd:string ;
184 + rdfs:subClassOf spin:SelectTemplates ;
185 + spin:body
186 + [ rdf:type sp:Select ;
187 + sp:distinct "true"^^xsd:boolean ;
188 + sp:orderBy ([ sp:varName "fieldName"^^xsd:string
189 + ]) ;
190 + sp:resultVariables ([ sp:varName "fieldName"^^xsd:string
191 + ] [ sp:varName "fieldId"^^xsd:string
192 + ]) ;
193 + sp:where ([ rdf:type sp:NamedGraph ;
194 + sp:elements ([ sp:object
195 + [ sp:varName "companyName"^^xsd:string
196 + ] ;
197 + sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
198 + sp:subject
199 + [ sp:varName "company"^^xsd:string
200 + ]
201 + ] [ sp:object <http://www.reportinghub.no/np/schema/npd#OperatingCompany> ;
202 + sp:predicate rdf:type ;
203 + sp:subject
204 + [ sp:varName "company"^^xsd:string
205 + ]
206 + ] [ sp:object
207 + [ sp:varName "owner"^^xsd:string
208 + ] ;
209 + sp:predicate rhspin:companyHasLicenceOrBAA ;
210 + sp:subject
211 + [ sp:varName "company"^^xsd:string
212 + ]
213 + ] [ sp:object
214 + [ sp:varName "owner"^^xsd:string
215 + ] ;
216 + sp:predicate <http://www.reportinghub.no/np/schema/npd#fieldOwner> ;
217 + sp:subject
218 + [ sp:varName "field"^^xsd:string
219 + ]
220 + ] [ sp:object
221 + [ sp:varName "fieldName"^^xsd:string
222 + ] ;
223 + sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
224 + sp:subject
225 + [ sp:varName "field"^^xsd:string
226 + ]
227 + ] [ sp:object
228 + [ sp:varName "fieldId"^^xsd:string
229 + ] ;
230 + sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
231 + sp:subject
232 + [ sp:varName "field"^^xsd:string
233 + ]
234 + ]) ;
235 + sp:graphNameNode npdata:npd
236 + ])
237 + ] ;
238 + spin:constraint
239 + [ rdf:type spl:Argument ;
240 + rdfs:comment "The name of a company."^^xsd:string ;
241 + spl:predicate arg:companyName ;
242 + spl:valueType xsd:string
243 + ] .
244 +
175 rhspin:GetLicenceInfo 245 rhspin:GetLicenceInfo
176 rdf:type spin:SelectTemplate ; 246 rdf:type spin:SelectTemplate ;
177 rdfs:comment "Gets the NPD id and a type identifier (\"PL\" or \"BA\") for a licence specified by a name."^^xsd:string ; 247 rdfs:comment "Gets the NPD id and a type identifier (\"PL\" or \"BA\") for a licence specified by a name."^^xsd:string ;
...@@ -923,6 +993,68 @@ rhspin:currentUserHasAccessToWellBoreWithId ...@@ -923,6 +993,68 @@ rhspin:currentUserHasAccessToWellBoreWithId
923 ] ; 993 ] ;
924 spin:returnType xsd:boolean . 994 spin:returnType xsd:boolean .
925 995
996 +rhspin:currentUserIsOperatorOfFieldWithName
997 + rdf:type spin:Function ;
998 + rdfs:comment "Checks if the current user is working for a company that is the owner of the licence or BAA that operates a field with a given name."^^xsd:string ;
999 + rdfs:label "current user is operator of field with name"^^xsd:string ;
1000 + rdfs:subClassOf spin:Functions ;
1001 + spin:body
1002 + [ rdf:type sp:Ask ;
1003 + sp:where ([ rdf:type sp:Bind ;
1004 + sp:expression
1005 + [ rdf:type rhspin:companyName
1006 + ] ;
1007 + sp:variable
1008 + [ sp:varName "companyName"^^xsd:string
1009 + ]
1010 + ] [ rdf:type sp:Bind ;
1011 + sp:expression
1012 + [ rdf:type rhspin:companyWithName ;
1013 + arg:name
1014 + [ sp:varName "companyName"^^xsd:string
1015 + ]
1016 + ] ;
1017 + sp:variable
1018 + [ sp:varName "company"^^xsd:string
1019 + ]
1020 + ] [ rdf:type sp:NamedGraph ;
1021 + sp:elements ([ sp:object
1022 + [ sp:varName "fieldName"^^xsd:string
1023 + ] ;
1024 + sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
1025 + sp:subject
1026 + [ sp:varName "field"^^xsd:string
1027 + ]
1028 + ] [ sp:object
1029 + [ sp:varName "owner"^^xsd:string
1030 + ] ;
1031 + sp:predicate <http://www.reportinghub.no/np/schema/npd#fieldOwner> ;
1032 + sp:subject
1033 + [ sp:varName "field"^^xsd:string
1034 + ]
1035 + ] [ rdf:type sp:TriplePath ;
1036 + sp:object
1037 + [ sp:varName "company"^^xsd:string
1038 + ] ;
1039 + sp:path [ rdf:type sp:AltPath ;
1040 + sp:path1 <http://www.reportinghub.no/np/schema/npd#baaOperator> ;
1041 + sp:path2 <http://www.reportinghub.no/np/schema/npd#licenceOperator>
1042 + ] ;
1043 + sp:subject
1044 + [ sp:varName "owner"^^xsd:string
1045 + ]
1046 + ]) ;
1047 + sp:graphNameNode npdata:npd
1048 + ])
1049 + ] ;
1050 + spin:constraint
1051 + [ rdf:type spl:Argument ;
1052 + rdfs:comment "The NPD name of the field."^^xsd:string ;
1053 + spl:predicate arg:fieldName ;
1054 + spl:valueType xsd:string
1055 + ] ;
1056 + spin:returnType xsd:boolean .
1057 +
926 rhspin:currentUserIsOperatorOfOwner 1058 rhspin:currentUserIsOperatorOfOwner
927 rdf:type spin:Function ; 1059 rdf:type spin:Function ;
928 rdfs:comment "Tests whether the currently logged in user is working for a company that is operator of a given licence or BAA. This function is used by the DPR upload service to validate access privileges."^^xsd:string ; 1060 rdfs:comment "Tests whether the currently logged in user is working for a company that is operator of a given licence or BAA. This function is used by the DPR upload service to validate access privileges."^^xsd:string ;
...@@ -2459,11 +2591,11 @@ _:b6 sp:varName "well"^^xsd:string . ...@@ -2459,11 +2591,11 @@ _:b6 sp:varName "well"^^xsd:string .
2459 2591
2460 _:b8 sp:varName "wellBore"^^xsd:string . 2592 _:b8 sp:varName "wellBore"^^xsd:string .
2461 2593
2462 -_:b4 sp:varName "wellBore"^^xsd:string .
2463 -
2464 _:b12 2594 _:b12
2465 sp:varName "wellBore"^^xsd:string . 2595 sp:varName "wellBore"^^xsd:string .
2466 2596
2597 +_:b4 sp:varName "wellBore"^^xsd:string .
2598 +
2467 _:b3 sp:varName "wellBoreId"^^xsd:string . 2599 _:b3 sp:varName "wellBoreId"^^xsd:string .
2468 2600
2469 _:b2 sp:varName "wellBoreName"^^xsd:string . 2601 _:b2 sp:varName "wellBoreName"^^xsd:string .
......
1 +# baseURI: http://www.reportinghub.no/np/data/npd-test
2 +# imports: http://www.reportinghub.no/np/schema/1.0/npd
3 +
4 +@prefix ep-fac: <http://www.reportinghub.no/ep/schema/facility#> .
5 +@prefix ep-well: <http://www.reportinghub.no/ep/schema/well#> .
6 +@prefix npd: <http://www.reportinghub.no/np/schema/npd#> .
7 +@prefix npd-test: <http://www.reportinghub.no/np/data/npd-test#> .
8 +@prefix owl: <http://www.w3.org/2002/07/owl#> .
9 +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
10 +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
11 +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
12 +
13 +<http://www.reportinghub.no/np/data/npd-test>
14 + rdf:type owl:Ontology ;
15 + rdfs:comment "These triples will be added to the NPD Fact Pages automatically. They contain additional test companies, well bores etc that allows the developers and admins to upload and download dummy data."^^xsd:string ;
16 + owl:imports <http://www.reportinghub.no/np/schema/1.0/npd> .
17 +
18 +npd-test:BA_ERH_TEST
19 + rdf:type npd:BusinessArrangementArea ;
20 + npd:id "2222222222"^^xsd:string ;
21 + npd:name "BA_ERH_TEST"^^xsd:string .
22 +
23 +npd-test:EPIM
24 + rdf:type npd:OperatingCompany ;
25 + npd:companyShortName
26 + "EPIM"^^xsd:string ;
27 + npd:id "5555555555"^^xsd:string ;
28 + npd:name "EPIM"^^xsd:string .
29 +
30 +npd-test:ERH-TEST-WELL-01
31 + rdf:type ep-well:Well ;
32 + npd:name "ERH-TEST-WELL-01"^^xsd:string ;
33 + npd:wellPartOfField npd-test:ERH_TEST_FIELD_01 .
34 +
35 +npd-test:ERH-TEST-WELL-02
36 + rdf:type ep-well:Well ;
37 + npd:name "ERH-TEST-WELL-02"^^xsd:string ;
38 + npd:wellPartOfField npd-test:ERH_TEST_FIELD_02 .
39 +
40 +npd-test:ERH-TEST-WELLBORE-01
41 + rdf:type ep-well:WellBore ;
42 + npd:id "4111111111"^^xsd:string ;
43 + npd:name "ERH-TEST-WELLBORE-01"^^xsd:string ;
44 + npd:partOfWell npd-test:ERH-TEST-WELL-01 ;
45 + npd:wellBoreType "DEVELOPMENT"^^xsd:string .
46 +
47 +npd-test:ERH-TEST-WELLBORE-02
48 + rdf:type ep-well:WellBore ;
49 + npd:id "4222222222"^^xsd:string ;
50 + npd:name "ERH-TEST-WELLBORE-02"^^xsd:string ;
51 + npd:partOfWell npd-test:ERH-TEST-WELL-02 ;
52 + npd:wellBoreType "DEVELOPMENT"^^xsd:string .
53 +
54 +npd-test:ERH_TEST_FIELD_01
55 + rdf:type ep-fac:Field ;
56 + npd:fieldOwner npd-test:BA_ERH_TEST ;
57 + npd:id "1111111111"^^xsd:string ;
58 + npd:name "ERH_TEST_FIELD_01"^^xsd:string .
59 +
60 +npd-test:ERH_TEST_FIELD_02
61 + rdf:type ep-fac:Field ;
62 + npd:fieldOwner npd-test:PL_ERH_TEST ;
63 + npd:id "1222222222"^^xsd:string ;
64 + npd:name "ERH_TEST_FIELD_02"^^xsd:string .
65 +
66 +npd-test:PL_ERH_TEST
67 + rdf:type npd:Licence ;
68 + npd:id "3333333333"^^xsd:string ;
69 + npd:name "PL_ERH_TEST"^^xsd:string .