Holger Knublauch

Added rhspin:currentUserHasAccessToWellBoreWithId

......@@ -98,14 +98,14 @@ arg:wellName
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The property that must be used in the result resource."^^xsd:string ;
spl:predicate <http://topbraid.org/spin/spinmapl#predicate> ;
spl:valueType rdf:Property
rdfs:comment "The value to match against."^^xsd:string ;
spl:predicate sp:arg1
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The value to match against."^^xsd:string ;
spl:predicate sp:arg1
rdfs:comment "The property that must be used in the result resource."^^xsd:string ;
spl:predicate <http://topbraid.org/spin/spinmapl#predicate> ;
spl:valueType rdf:Property
] ;
spin:returnType rdfs:Resource .
......@@ -116,8 +116,8 @@ npdata:npd
<http://www.reportinghub.no/spin/rh>
rdf:type owl:Ontology ;
rdfs:comment "A collection of SPIN functions and templates to support working with the ReportingHub schemas."^^xsd:string ;
owl:imports <http://spinrdf.org/spin> , <http://www.reportinghub.no/ep/schema/1.0/organization> , <http://www.reportinghub.no/ep/schema/1.0/facility> , <http://www.reportinghub.no/ep/schema/1.0/report> , <http://topbraid.org/spin/spinmapl> , <http://www.reportinghub.no/ep/schema/1.0/core> , <http://www.reportinghub.no/np/schema/1.0/npd> , <http://www.linkedmodel.org/schema/dtype> ;
owl:versionInfo "0.1.0"^^xsd:string .
owl:imports <http://spinrdf.org/spin> , <http://topbraid.org/spin/spinmapl> , <http://www.linkedmodel.org/schema/dtype> , <http://www.reportinghub.no/ep/schema/1.0/core> , <http://www.reportinghub.no/ep/schema/1.0/facility> , <http://www.reportinghub.no/ep/schema/1.0/organization> , <http://www.reportinghub.no/ep/schema/1.0/report> , <http://www.reportinghub.no/np/schema/1.0/npd> ;
owl:versionInfo "0.1.1"^^xsd:string .
rhspin:DDRTableTemplates
rdf:type rhspin:TableTemplate ;
......@@ -321,8 +321,7 @@ rhspin:companyHasLicenceForWellBore
spl:predicate sp:arg1 ;
spl:valueType <http://www.reportinghub.no/ep/schema/organization#Company>
] ;
spin:returnType <http://www.reportinghub.no/ep/schema/well#WellBore> ;
owl:versionInfo "Note: the algorithm isn't clear - it could be that the date checks are not needed."^^xsd:string .
spin:returnType <http://www.reportinghub.no/ep/schema/well#WellBore> .
rhspin:companyName
rdf:type spin:Function ;
......@@ -360,6 +359,54 @@ rhspin:companyWithName
] ;
spin:returnType <http://www.reportinghub.no/ep/schema/organization#Company> .
rhspin:currentUserHasAccessToWellBoreWithId
rdf:type spin:Function ;
rdfs:comment "Tests whether the currently logged in user is working for a company that has a valid licence for a well bore with a given id. This function is used by the download service to validate access privileges."^^xsd:string ;
rdfs:label "current user has access to well bore with id"^^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 _:b15
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:companyWithName ;
arg:name _:b15
] ;
sp:variable _:b16
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:wellBoreById ;
arg:id [ sp:varName "id"^^xsd:string
]
] ;
sp:variable _:b17
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:and ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 _:b17
] ;
sp:arg2 [ rdf:type sp:bound ;
sp:arg1 _:b16
]
]
] [ sp:object _:b17 ;
sp:predicate rhspin:companyHasLicenceForWellBore ;
sp:subject _:b16
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The id of the well bore."^^xsd:string ;
spl:predicate arg:id ;
spl:valueType xsd:string
] ;
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 ;
......@@ -368,10 +415,10 @@ rhspin:ddrActivityStartDate
spin:body
[ rdf:type sp:Select ;
sp:resultVariables ([ rdf:type xsd:date ;
sp:arg1 _:b15
sp:arg1 _:b18
]) ;
sp:where ([ rdf:type sp:TriplePath ;
sp:object _:b15 ;
sp:object _:b18 ;
sp:path [ rdf:type sp:SeqPath ;
sp:path1 <http://www.reportinghub.no/ep/schema/activity#reportOn> ;
sp:path2 <http://www.reportinghub.no/ep/schema/activity#startedAt>
......@@ -396,9 +443,9 @@ rhspin:ddrWellBoreId
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b16) ;
sp:resultVariables (_:b19) ;
sp:where ([ rdf:type sp:TriplePath ;
sp:object _:b17 ;
sp:object _:b20 ;
sp:path [ rdf:type sp:SeqPath ;
sp:path1
[ rdf:type sp:SeqPath ;
......@@ -411,9 +458,9 @@ rhspin:ddrWellBoreId
[ sp:varName "ddr"^^xsd:string
]
] [ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object _:b16 ;
sp:elements ([ sp:object _:b19 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
sp:subject _:b17
sp:subject _:b20
]) ;
sp:graphNameNode npdata:npd
])
......@@ -455,26 +502,26 @@ rhspin:dtypeValue
rdfs:subClassOf spl:OntologyFunctions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b18) ;
sp:where ([ sp:object _:b19 ;
sp:resultVariables (_:b21) ;
sp:where ([ sp:object _:b22 ;
sp:predicate spin:_arg2 ;
sp:subject spin:_arg1
] [ sp:object _:b18 ;
] [ sp:object _:b21 ;
sp:predicate <http://www.linkedmodel.org/schema/dtype#value> ;
sp:subject _:b19
sp:subject _:b22
])
] ;
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
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The subject of the value."^^xsd:string ;
spl:predicate sp:arg1 ;
spl:valueType rdfs:Resource
] .
rhspin:facilityById
......@@ -529,10 +576,10 @@ rhspin:graphForDDR
spin:body
[ rdf:type sp:Select ;
sp:resultVariables ([ rdf:type sp:iri ;
sp:arg1 _:b20
sp:arg1 _:b23
]) ;
sp:where ([ rdf:type sp:TriplePath ;
sp:object _:b21 ;
sp:object _:b24 ;
sp:path [ rdf:type sp:SeqPath ;
sp:path1
[ rdf:type sp:SeqPath ;
......@@ -545,21 +592,21 @@ rhspin:graphForDDR
[ sp:varName "ddr"^^xsd:string
]
] [ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object _:b22 ;
sp:elements ([ sp:object _:b25 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#drilledInProductionLicence> ;
sp:subject _:b21
] [ sp:object _:b23 ;
sp:subject _:b24
] [ sp:object _:b26 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
sp:subject _:b22
sp:subject _:b25
]) ;
sp:graphNameNode npdata:npd
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "https://www.reportinghub.no/ep/graph/licence-" ;
sp:arg2 _:b23
sp:arg2 _:b26
] ;
sp:variable _:b20
sp:variable _:b23
])
] ;
spin:constraint
......@@ -600,9 +647,9 @@ rhspin:licenceForWellBore
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b24) ;
sp:resultVariables (_:b27) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object _:b24 ;
sp:elements ([ sp:object _:b27 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#drilledInProductionLicence> ;
sp:subject
[ sp:varName "wellBore"^^xsd:string
......@@ -626,7 +673,7 @@ rhspin:normalizeString
rdfs:subClassOf spl:StringFunctions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b25) ;
sp:resultVariables (_:b28) ;
sp:where ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
......@@ -634,67 +681,67 @@ rhspin:normalizeString
sp:arg2 "\\((.*)\\)" ;
sp:arg3 ""
] ;
sp:variable _:b26
sp:variable _:b29
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:trim ;
sp:arg1 _:b26
sp:arg1 _:b29
] ;
sp:variable _:b27
sp:variable _:b30
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:encodeURL ;
sp:arg1 _:b27
sp:arg1 _:b30
] ;
sp:variable _:b28
sp:variable _:b31
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
sp:arg1 _:b28 ;
sp:arg1 _:b31 ;
sp:arg2 "%2F" ;
sp:arg3 "_"
] ;
sp:variable _:b29
sp:variable _:b32
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
sp:arg1 _:b29 ;
sp:arg1 _:b32 ;
sp:arg2 "%[0-9A-F][0-9A-F]" ;
sp:arg3 ""
] ;
sp:variable _:b30
sp:variable _:b33
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
sp:arg1 _:b30 ;
sp:arg1 _:b33 ;
sp:arg2 "\\+" ;
sp:arg3 "_"
] ;
sp:variable _:b31
sp:variable _:b34
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
sp:arg1 _:b31 ;
sp:arg1 _:b34 ;
sp:arg2 "_+" ;
sp:arg3 "_"
] ;
sp:variable _:b32
sp:variable _:b35
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
sp:arg1 _:b32 ;
sp:arg1 _:b35 ;
sp:arg2 "\\*" ;
sp:arg3 ""
] ;
sp:variable _:b33
sp:variable _:b36
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type xsd:string ;
sp:arg1 [ rdf:type spif:upperCase ;
sp:arg1 _:b33
sp:arg1 _:b36
]
] ;
sp:variable _:b25
sp:variable _:b28
])
] ;
spin:constraint
......@@ -711,9 +758,9 @@ rhspin:npdId
rdfs:subClassOf spl:StringFunctions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b34) ;
sp:resultVariables (_:b37) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object _:b34 ;
sp:elements ([ sp:object _:b37 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
sp:subject
[ sp:varName "resource"^^xsd:string
......@@ -736,9 +783,9 @@ rhspin:npdName
rdfs:subClassOf spl:StringFunctions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b35) ;
sp:resultVariables (_:b38) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object _:b35 ;
sp:elements ([ sp:object _:b38 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject
[ sp:varName "resource"^^xsd:string
......@@ -772,9 +819,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:constraint
[ rdf:type spl:Argument ;
......@@ -784,8 +830,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:returnType xsd:boolean .
......@@ -884,16 +931,16 @@ rhspin:wellBoreByName
rdfs:subClassOf spl:URIFunctions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b36) ;
sp:resultVariables (_:b39) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object
[ sp:varName "wellBoreName"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject _:b36
sp:subject _:b39
] [ sp:object <http://www.reportinghub.no/ep/schema/well#WellBore> ;
sp:predicate rdf:type ;
sp:subject _:b36
sp:subject _:b39
]) ;
sp:graphNameNode npdata:npd
])
......@@ -932,70 +979,79 @@ rhspin:wellByName
] ;
spin:returnType <http://www.reportinghub.no/ep/schema/well#Well> .
_:b20
sp:varName "uri"^^xsd:string .
_:b17
sp:varName "wellBore"^^xsd:string .
_:b23
sp:varName "id"^^xsd:string .
_:b16
sp:varName "company"^^xsd:string .
_:b22
sp:varName "licence"^^xsd:string .
_:b15
sp:varName "companyName"^^xsd:string .
_:b21
_:b39
sp:varName "wellBore"^^xsd:string .
_:b38
sp:varName "name"^^xsd:string .
_:b37
sp:varName "id"^^xsd:string .
_:b36
sp:varName "wellBore"^^xsd:string .
sp:varName "t4"^^xsd:string .
_:b35
sp:varName "name"^^xsd:string .
sp:varName "t3"^^xsd:string .
_:b34
sp:varName "id"^^xsd:string .
sp:varName "t2"^^xsd:string .
_:b33
sp:varName "t4"^^xsd:string .
sp:varName "t1"^^xsd:string .
_:b32
sp:varName "t3"^^xsd:string .
sp:varName "t0b"^^xsd:string .
_:b31
sp:varName "t2"^^xsd:string .
sp:varName "t0a"^^xsd:string .
_:b30
sp:varName "t1"^^xsd:string .
sp:varName "s2"^^xsd:string .
_:b29
sp:varName "t0b"^^xsd:string .
sp:varName "s1"^^xsd:string .
_:b28
sp:varName "t0a"^^xsd:string .
sp:varName "normalizedStr"^^xsd:string .
_:b27
sp:varName "s2"^^xsd:string .
sp:varName "licence"^^xsd:string .
_:b26
sp:varName "s1"^^xsd:string .
sp:varName "id"^^xsd:string .
_:b25
sp:varName "normalizedStr"^^xsd:string .
sp:varName "licence"^^xsd:string .
_:b24
sp:varName "licence"^^xsd:string .
sp:varName "wellBore"^^xsd:string .
_:b19
_:b23
sp:varName "uri"^^xsd:string .
_:b22
sp:varName "reif"^^xsd:string .
_:b18
_:b21
sp:varName "value"^^xsd:string .
_:b17
_:b20
sp:varName "wellBore"^^xsd:string .
_:b16
_:b19
sp:varName "id"^^xsd:string .
_:b15
_:b18
sp:varName "startedAt"^^xsd:string .
_:b14
......