Holger Knublauch

Added functions for DPR upload so that only the operators of BAA or

licence can upload, updated NPDI with baa operators
This diff could not be displayed because it is too large.
...@@ -300,6 +300,85 @@ rhspin:GetLicensesAndBAAsOfCompanyName ...@@ -300,6 +300,85 @@ rhspin:GetLicensesAndBAAsOfCompanyName
300 spl:valueType xsd:string 300 spl:valueType xsd:string
301 ] . 301 ] .
302 302
303 +rhspin:GetLicensesAndBAAsWhereCompanyNameIsOperator
304 + rdf:type spin:SelectTemplate ;
305 + rdfs:comment "Gets the licences and BAAs that a company with a given name is the operator of. This determines whether the company can upload DPRs. Result variables are ?ownerId and ?ownerName."^^xsd:string ;
306 + rdfs:label "Get licenses and BAAs where company name is operator"^^xsd:string ;
307 + rdfs:subClassOf spin:SelectTemplates ;
308 + spin:body
309 + [ rdf:type sp:Select ;
310 + sp:distinct "true"^^xsd:boolean ;
311 + sp:orderBy ([ sp:varName "ownerName"^^xsd:string
312 + ]) ;
313 + sp:resultVariables ([ sp:varName "ownerId"^^xsd:string
314 + ] [ sp:varName "ownerName"^^xsd:string
315 + ]) ;
316 + sp:where ([ rdf:type sp:NamedGraph ;
317 + sp:elements ([ rdf:type sp:Union ;
318 + sp:elements (([ sp:object
319 + [ sp:varName "companyName"^^xsd:string
320 + ] ;
321 + sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
322 + sp:subject
323 + [ sp:varName "company"^^xsd:string
324 + ]
325 + ] [ sp:object <http://www.reportinghub.no/np/schema/npd#OperatingCompany> ;
326 + sp:predicate rdf:type ;
327 + sp:subject
328 + [ sp:varName "company"^^xsd:string
329 + ]
330 + ] [ sp:object
331 + [ sp:varName "company"^^xsd:string
332 + ] ;
333 + sp:predicate <http://www.reportinghub.no/np/schema/npd#baaOperator> ;
334 + sp:subject
335 + [ sp:varName "owner"^^xsd:string
336 + ]
337 + ]) ([ sp:object
338 + [ sp:varName "companyName"^^xsd:string
339 + ] ;
340 + sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
341 + sp:subject
342 + [ sp:varName "company"^^xsd:string
343 + ]
344 + ] [ sp:object <http://www.reportinghub.no/np/schema/npd#OperatingCompany> ;
345 + sp:predicate rdf:type ;
346 + sp:subject
347 + [ sp:varName "company"^^xsd:string
348 + ]
349 + ] [ sp:object
350 + [ sp:varName "company"^^xsd:string
351 + ] ;
352 + sp:predicate <http://www.reportinghub.no/np/schema/npd#licenceOperator> ;
353 + sp:subject
354 + [ sp:varName "owner"^^xsd:string
355 + ]
356 + ]))
357 + ] [ sp:object
358 + [ sp:varName "ownerName"^^xsd:string
359 + ] ;
360 + sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
361 + sp:subject
362 + [ sp:varName "owner"^^xsd:string
363 + ]
364 + ] [ sp:object
365 + [ sp:varName "ownerId"^^xsd:string
366 + ] ;
367 + sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
368 + sp:subject
369 + [ sp:varName "owner"^^xsd:string
370 + ]
371 + ]) ;
372 + sp:graphNameNode npdata:npd
373 + ])
374 + ] ;
375 + spin:constraint
376 + [ rdf:type spl:Argument ;
377 + rdfs:comment "The name of a company."^^xsd:string ;
378 + spl:predicate arg:companyName ;
379 + spl:valueType xsd:string
380 + ] .
381 +
303 rhspin:GetWellBoresOfWell 382 rhspin:GetWellBoresOfWell
304 rdf:type spin:SelectTemplate ; 383 rdf:type spin:SelectTemplate ;
305 rdfs:comment "Gets an ordered list of well bores that belong to a given Well. Result variables are ?wellBoreId and ?wellBoreName."^^xsd:string ; 384 rdfs:comment "Gets an ordered list of well bores that belong to a given Well. Result variables are ?wellBoreId and ?wellBoreName."^^xsd:string ;
...@@ -844,6 +923,54 @@ rhspin:currentUserHasAccessToWellBoreWithId ...@@ -844,6 +923,54 @@ rhspin:currentUserHasAccessToWellBoreWithId
844 ] ; 923 ] ;
845 spin:returnType xsd:boolean . 924 spin:returnType xsd:boolean .
846 925
926 +rhspin:currentUserIsOperatorOfOwner
927 + 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 ;
929 + rdfs:label "current user is operator of owner"^^xsd:string ;
930 + rdfs:subClassOf spin:Functions ;
931 + spin:body
932 + [ rdf:type sp:Ask ;
933 + sp:where ([ rdf:type sp:Bind ;
934 + sp:expression
935 + [ rdf:type rhspin:companyName
936 + ] ;
937 + sp:variable
938 + [ sp:varName "companyName"^^xsd:string
939 + ]
940 + ] [ rdf:type sp:Bind ;
941 + sp:expression
942 + [ rdf:type rhspin:companyWithName ;
943 + arg:name
944 + [ sp:varName "companyName"^^xsd:string
945 + ]
946 + ] ;
947 + sp:variable
948 + [ sp:varName "company"^^xsd:string
949 + ]
950 + ] [ rdf:type sp:NamedGraph ;
951 + sp:elements ([ rdf:type sp:TriplePath ;
952 + sp:object
953 + [ sp:varName "company"^^xsd:string
954 + ] ;
955 + sp:path [ rdf:type sp:AltPath ;
956 + sp:path1 <http://www.reportinghub.no/np/schema/npd#baaOperator> ;
957 + sp:path2 <http://www.reportinghub.no/np/schema/npd#licenceOperator>
958 + ] ;
959 + sp:subject
960 + [ sp:varName "owner"^^xsd:string
961 + ]
962 + ]) ;
963 + sp:graphNameNode npdata:npd
964 + ])
965 + ] ;
966 + spin:constraint
967 + [ rdf:type spl:Argument ;
968 + rdfs:comment "The licence or BAA."^^xsd:string ;
969 + spl:predicate arg:owner ;
970 + spl:valueType <http://www.reportinghub.no/np/schema/npd#Owner>
971 + ] ;
972 + spin:returnType xsd:boolean .
973 +
847 rhspin:ddrActivityStartDate 974 rhspin:ddrActivityStartDate
848 rdf:type spin:Function ; 975 rdf:type spin:Function ;
849 rdfs:comment "Gets the declared start time of the activity in a DDR, as an xsd:date literal."^^xsd:string ; 976 rdfs:comment "Gets the declared start time of the activity in a DDR, as an xsd:date literal."^^xsd:string ;
...@@ -1048,15 +1175,15 @@ rhspin:dtypeValue ...@@ -1048,15 +1175,15 @@ rhspin:dtypeValue
1048 ] ; 1175 ] ;
1049 spin:constraint 1176 spin:constraint
1050 [ rdf:type spl:Argument ; 1177 [ rdf:type spl:Argument ;
1051 - rdfs:comment "The predicate that points to the reified value."^^xsd:string ;
1052 - spl:predicate sp:arg2 ;
1053 - spl:valueType rdf:Property
1054 - ] ;
1055 - spin:constraint
1056 - [ rdf:type spl:Argument ;
1057 rdfs:comment "The subject of the value."^^xsd:string ; 1178 rdfs:comment "The subject of the value."^^xsd:string ;
1058 spl:predicate sp:arg1 ; 1179 spl:predicate sp:arg1 ;
1059 spl:valueType rdfs:Resource 1180 spl:valueType rdfs:Resource
1181 + ] ;
1182 + spin:constraint
1183 + [ rdf:type spl:Argument ;
1184 + rdfs:comment "The predicate that points to the reified value."^^xsd:string ;
1185 + spl:predicate sp:arg2 ;
1186 + spl:valueType rdf:Property
1060 ] . 1187 ] .
1061 1188
1062 rhspin:facilityById 1189 rhspin:facilityById
...@@ -1851,8 +1978,9 @@ rhspin:npdTripleExists ...@@ -1851,8 +1978,9 @@ rhspin:npdTripleExists
1851 ] ; 1978 ] ;
1852 spin:constraint 1979 spin:constraint
1853 [ rdf:type spl:Argument ; 1980 [ rdf:type spl:Argument ;
1854 - rdfs:comment "The object to match."^^xsd:string ; 1981 + rdfs:comment "The subject to find"^^xsd:string ;
1855 - spl:predicate sp:arg3 1982 + spl:predicate sp:arg1 ;
1983 + spl:valueType rdfs:Resource
1856 ] ; 1984 ] ;
1857 spin:constraint 1985 spin:constraint
1858 [ rdf:type spl:Argument ; 1986 [ rdf:type spl:Argument ;
...@@ -1862,9 +1990,8 @@ rhspin:npdTripleExists ...@@ -1862,9 +1990,8 @@ rhspin:npdTripleExists
1862 ] ; 1990 ] ;
1863 spin:constraint 1991 spin:constraint
1864 [ rdf:type spl:Argument ; 1992 [ rdf:type spl:Argument ;
1865 - rdfs:comment "The subject to find"^^xsd:string ; 1993 + rdfs:comment "The object to match."^^xsd:string ;
1866 - spl:predicate sp:arg1 ; 1994 + spl:predicate sp:arg3
1867 - spl:valueType rdfs:Resource
1868 ] ; 1995 ] ;
1869 spin:returnType xsd:boolean . 1996 spin:returnType xsd:boolean .
1870 1997
...@@ -2123,66 +2250,66 @@ rhspin:wellByName ...@@ -2123,66 +2250,66 @@ rhspin:wellByName
2123 ] ; 2250 ] ;
2124 spin:returnType <http://www.reportinghub.no/ep/schema/well#Well> . 2251 spin:returnType <http://www.reportinghub.no/ep/schema/well#Well> .
2125 2252
2126 -_:b26 2253 +_:b7 sp:varName "company"^^xsd:string .
2127 - sp:varName "name"^^xsd:string .
2128 2254
2129 -_:b25 2255 +_:b11
2130 - sp:varName "id"^^xsd:string . 2256 + sp:varName "company"^^xsd:string .
2131 2257
2132 -_:b24 2258 +_:b9 sp:varName "company"^^xsd:string .
2133 - sp:varName "t4"^^xsd:string .
2134 2259
2135 -_:b23 2260 +_:b10
2136 - sp:varName "t3"^^xsd:string . 2261 + sp:varName "companyName"^^xsd:string .
2137 2262
2138 -_:b22 2263 +_:b25
2139 - sp:varName "t2"^^xsd:string . 2264 + sp:varName "id"^^xsd:string .
2140 2265
2141 -_:b21 2266 +_:b15
2142 - sp:varName "t1"^^xsd:string . 2267 + sp:varName "licence"^^xsd:string .
2143 2268
2144 -_:b20 2269 +_:b26
2145 - sp:varName "t0b"^^xsd:string . 2270 + sp:varName "name"^^xsd:string .
2146 2271
2147 -_:b19 2272 +_:b16
2148 - sp:varName "t0a"^^xsd:string . 2273 + sp:varName "normalizedStr"^^xsd:string .
2149 2274
2150 -_:b18 2275 +_:b14
2151 - sp:varName "s2"^^xsd:string . 2276 + sp:varName "reif"^^xsd:string .
2152 2277
2153 _:b17 2278 _:b17
2154 sp:varName "s1"^^xsd:string . 2279 sp:varName "s1"^^xsd:string .
2155 2280
2156 -_:b16 2281 +_:b18
2157 - sp:varName "normalizedStr"^^xsd:string . 2282 + sp:varName "s2"^^xsd:string .
2158 -
2159 -_:b15
2160 - sp:varName "licence"^^xsd:string .
2161 2283
2162 -_:b14 2284 +_:b1 sp:varName "subject"^^xsd:string .
2163 - sp:varName "reif"^^xsd:string .
2164 2285
2165 -_:b13 2286 +_:b19
2166 - sp:varName "value"^^xsd:string . 2287 + sp:varName "t0a"^^xsd:string .
2167 2288
2168 -_:b12 2289 +_:b20
2169 - sp:varName "wellBore"^^xsd:string . 2290 + sp:varName "t0b"^^xsd:string .
2170 2291
2171 -_:b11 2292 +_:b21
2172 - sp:varName "company"^^xsd:string . 2293 + sp:varName "t1"^^xsd:string .
2173 2294
2174 -_:b10 2295 +_:b22
2175 - sp:varName "companyName"^^xsd:string . 2296 + sp:varName "t2"^^xsd:string .
2176 2297
2177 -_:b9 sp:varName "company"^^xsd:string . 2298 +_:b23
2299 + sp:varName "t3"^^xsd:string .
2178 2300
2179 -_:b8 sp:varName "wellBore"^^xsd:string . 2301 +_:b24
2302 + sp:varName "t4"^^xsd:string .
2180 2303
2181 -_:b7 sp:varName "company"^^xsd:string . 2304 +_:b13
2305 + sp:varName "value"^^xsd:string .
2182 2306
2183 _:b6 sp:varName "well"^^xsd:string . 2307 _:b6 sp:varName "well"^^xsd:string .
2184 2308
2185 -_:b5 sp:varName "wellName"^^xsd:string . 2309 +_:b8 sp:varName "wellBore"^^xsd:string .
2310 +
2311 +_:b12
2312 + sp:varName "wellBore"^^xsd:string .
2186 2313
2187 _:b4 sp:varName "wellBore"^^xsd:string . 2314 _:b4 sp:varName "wellBore"^^xsd:string .
2188 2315
...@@ -2190,4 +2317,4 @@ _:b3 sp:varName "wellBoreId"^^xsd:string . ...@@ -2190,4 +2317,4 @@ _:b3 sp:varName "wellBoreId"^^xsd:string .
2190 2317
2191 _:b2 sp:varName "wellBoreName"^^xsd:string . 2318 _:b2 sp:varName "wellBoreName"^^xsd:string .
2192 2319
2193 -_:b1 sp:varName "subject"^^xsd:string . 2320 +_:b5 sp:varName "wellName"^^xsd:string .
......