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
spl:valueType xsd:string
] .
rhspin:GetLicensesAndBAAsWhereCompanyNameIsOperator
rdf:type spin:SelectTemplate ;
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 ;
rdfs:label "Get licenses and BAAs where company name is operator"^^xsd:string ;
rdfs:subClassOf spin:SelectTemplates ;
spin:body
[ rdf:type sp:Select ;
sp:distinct "true"^^xsd:boolean ;
sp:orderBy ([ sp:varName "ownerName"^^xsd:string
]) ;
sp:resultVariables ([ sp:varName "ownerId"^^xsd:string
] [ sp:varName "ownerName"^^xsd:string
]) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ rdf:type sp:Union ;
sp:elements (([ sp:object
[ sp:varName "companyName"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject
[ sp:varName "company"^^xsd:string
]
] [ sp:object <http://www.reportinghub.no/np/schema/npd#OperatingCompany> ;
sp:predicate rdf:type ;
sp:subject
[ sp:varName "company"^^xsd:string
]
] [ sp:object
[ sp:varName "company"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#baaOperator> ;
sp:subject
[ sp:varName "owner"^^xsd:string
]
]) ([ sp:object
[ sp:varName "companyName"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject
[ sp:varName "company"^^xsd:string
]
] [ sp:object <http://www.reportinghub.no/np/schema/npd#OperatingCompany> ;
sp:predicate rdf:type ;
sp:subject
[ sp:varName "company"^^xsd:string
]
] [ sp:object
[ sp:varName "company"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#licenceOperator> ;
sp:subject
[ sp:varName "owner"^^xsd:string
]
]))
] [ sp:object
[ sp:varName "ownerName"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject
[ sp:varName "owner"^^xsd:string
]
] [ sp:object
[ sp:varName "ownerId"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
sp:subject
[ sp:varName "owner"^^xsd:string
]
]) ;
sp:graphNameNode npdata:npd
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The name of a company."^^xsd:string ;
spl:predicate arg:companyName ;
spl:valueType xsd:string
] .
rhspin:GetWellBoresOfWell
rdf:type spin:SelectTemplate ;
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
] ;
spin:returnType xsd:boolean .
rhspin:currentUserIsOperatorOfOwner
rdf:type spin:Function ;
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 ;
rdfs:label "current user is operator of owner"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Ask ;
sp:where ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:companyName
] ;
sp:variable
[ sp:varName "companyName"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:companyWithName ;
arg:name
[ sp:varName "companyName"^^xsd:string
]
] ;
sp:variable
[ sp:varName "company"^^xsd:string
]
] [ rdf:type sp:NamedGraph ;
sp:elements ([ rdf:type sp:TriplePath ;
sp:object
[ sp:varName "company"^^xsd:string
] ;
sp:path [ rdf:type sp:AltPath ;
sp:path1 <http://www.reportinghub.no/np/schema/npd#baaOperator> ;
sp:path2 <http://www.reportinghub.no/np/schema/npd#licenceOperator>
] ;
sp:subject
[ sp:varName "owner"^^xsd:string
]
]) ;
sp:graphNameNode npdata:npd
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The licence or BAA."^^xsd:string ;
spl:predicate arg:owner ;
spl:valueType <http://www.reportinghub.no/np/schema/npd#Owner>
] ;
spin:returnType xsd:boolean .
rhspin:ddrActivityStartDate
rdf:type spin:Function ;
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
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The predicate that points to the reified value."^^xsd:string ;
spl:predicate sp:arg2 ;
spl:valueType rdf:Property
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The subject of the value."^^xsd:string ;
spl:predicate sp:arg1 ;
spl:valueType rdfs:Resource
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The predicate that points to the reified value."^^xsd:string ;
spl:predicate sp:arg2 ;
spl:valueType rdf:Property
] .
rhspin:facilityById
......@@ -1851,8 +1978,9 @@ rhspin:npdTripleExists
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The object to match."^^xsd:string ;
spl:predicate sp:arg3
rdfs:comment "The subject to find"^^xsd:string ;
spl:predicate sp:arg1 ;
spl:valueType rdfs:Resource
] ;
spin:constraint
[ rdf:type spl:Argument ;
......@@ -1862,9 +1990,8 @@ rhspin:npdTripleExists
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The subject to find"^^xsd:string ;
spl:predicate sp:arg1 ;
spl:valueType rdfs:Resource
rdfs:comment "The object to match."^^xsd:string ;
spl:predicate sp:arg3
] ;
spin:returnType xsd:boolean .
......@@ -2123,66 +2250,66 @@ rhspin:wellByName
] ;
spin:returnType <http://www.reportinghub.no/ep/schema/well#Well> .
_:b26
sp:varName "name"^^xsd:string .
_:b7 sp:varName "company"^^xsd:string .
_:b25
sp:varName "id"^^xsd:string .
_:b11
sp:varName "company"^^xsd:string .
_:b24
sp:varName "t4"^^xsd:string .
_:b9 sp:varName "company"^^xsd:string .
_:b23
sp:varName "t3"^^xsd:string .
_:b10
sp:varName "companyName"^^xsd:string .
_:b22
sp:varName "t2"^^xsd:string .
_:b25
sp:varName "id"^^xsd:string .
_:b21
sp:varName "t1"^^xsd:string .
_:b15
sp:varName "licence"^^xsd:string .
_:b20
sp:varName "t0b"^^xsd:string .
_:b26
sp:varName "name"^^xsd:string .
_:b19
sp:varName "t0a"^^xsd:string .
_:b16
sp:varName "normalizedStr"^^xsd:string .
_:b18
sp:varName "s2"^^xsd:string .
_:b14
sp:varName "reif"^^xsd:string .
_:b17
sp:varName "s1"^^xsd:string .
_:b16
sp:varName "normalizedStr"^^xsd:string .
_:b15
sp:varName "licence"^^xsd:string .
_:b18
sp:varName "s2"^^xsd:string .
_:b14
sp:varName "reif"^^xsd:string .
_:b1 sp:varName "subject"^^xsd:string .
_:b13
sp:varName "value"^^xsd:string .
_:b19
sp:varName "t0a"^^xsd:string .
_:b12
sp:varName "wellBore"^^xsd:string .
_:b20
sp:varName "t0b"^^xsd:string .
_:b11
sp:varName "company"^^xsd:string .
_:b21
sp:varName "t1"^^xsd:string .
_:b10
sp:varName "companyName"^^xsd:string .
_:b22
sp:varName "t2"^^xsd:string .
_:b9 sp:varName "company"^^xsd:string .
_:b23
sp:varName "t3"^^xsd:string .
_:b8 sp:varName "wellBore"^^xsd:string .
_:b24
sp:varName "t4"^^xsd:string .
_:b7 sp:varName "company"^^xsd:string .
_:b13
sp:varName "value"^^xsd:string .
_:b6 sp:varName "well"^^xsd:string .
_:b5 sp:varName "wellName"^^xsd:string .
_:b8 sp:varName "wellBore"^^xsd:string .
_:b12
sp:varName "wellBore"^^xsd:string .
_:b4 sp:varName "wellBore"^^xsd:string .
......@@ -2190,4 +2317,4 @@ _:b3 sp:varName "wellBoreId"^^xsd:string .
_:b2 sp:varName "wellBoreName"^^xsd:string .
_:b1 sp:varName "subject"^^xsd:string .
_:b5 sp:varName "wellName"^^xsd:string .
......