Holger Knublauch

Licence checks now also use npd:endDate

......@@ -69,6 +69,11 @@ arg:resource
rdfs:label "resource"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:share
rdf:type rdf:Property ;
rdfs:label "share"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:startDate
rdf:type rdf:Property ;
rdfs:label "start date"^^xsd:string ;
......@@ -481,14 +486,28 @@ rhspin:companyHasLicence
spin:body
[ rdf:type sp:Select ;
sp:distinct "true"^^xsd:boolean ;
sp:resultVariables (_:b9) ;
sp:resultVariables ([ sp:varName "licence"^^xsd:string
]) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object spin:_arg1 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#shareHolder> ;
sp:subject _:b10
] [ sp:object _:b9 ;
sp:subject
[ sp:varName "share"^^xsd:string
]
] [ sp:object
[ sp:varName "licence"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#licenceShared> ;
sp:subject _:b10
sp:subject
[ sp:varName "share"^^xsd:string
]
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type rhspin:shareIsValid ;
arg:share
[ sp:varName "share"^^xsd:string
]
]
]) ;
sp:graphNameNode npdata:npd
])
......@@ -509,20 +528,40 @@ rhspin:companyHasLicenceForWellBore
spin:body
[ rdf:type sp:Select ;
sp:distinct "true"^^xsd:boolean ;
sp:resultVariables (_:b11) ;
sp:resultVariables ([ sp:varName "wellBore"^^xsd:string
]) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object spin:_arg1 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#shareHolder> ;
sp:subject _:b12
] [ sp:object _:b13 ;
sp:subject
[ sp:varName "share"^^xsd:string
]
] [ sp:object
[ sp:varName "licence"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#licenceShared> ;
sp:subject _:b12
sp:subject
[ sp:varName "share"^^xsd:string
]
] [ sp:object <http://www.reportinghub.no/np/schema/npd#LS_Active> ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#licenceStatus> ;
sp:subject _:b13
] [ sp:object _:b13 ;
sp:subject
[ sp:varName "licence"^^xsd:string
]
] [ sp:object
[ sp:varName "licence"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#drilledInProductionLicence> ;
sp:subject _:b11
sp:subject
[ sp:varName "wellBore"^^xsd:string
]
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type rhspin:shareIsValid ;
arg:share
[ sp:varName "share"^^xsd:string
]
]
]) ;
sp:graphNameNode npdata:npd
])
......@@ -546,20 +585,25 @@ rhspin:companyHasLicenceOrBAA
sp:resultVariables ([ sp:varName "owner"^^xsd:string
]) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object spin:_arg1 ;
sp:elements ([ rdf:type sp:Union ;
sp:elements (([ sp:object spin:_arg1 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#shareHolder> ;
sp:subject
[ sp:varName "share"^^xsd:string
]
] [ rdf:type sp:Union ;
sp:elements (([ sp:object
] [ sp:object
[ sp:varName "owner"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#licenceShared> ;
sp:subject
[ sp:varName "share"^^xsd:string
]
]) ([ sp:object
]) ([ sp:object spin:_arg1 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#shareHolder> ;
sp:subject
[ sp:varName "share"^^xsd:string
]
] [ sp:object
[ sp:varName "owner"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#baaShared> ;
......@@ -567,6 +611,13 @@ rhspin:companyHasLicenceOrBAA
[ sp:varName "share"^^xsd:string
]
]))
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type rhspin:shareIsValid ;
arg:share
[ sp:varName "share"^^xsd:string
]
]
]) ;
sp:graphNameNode npdata:npd
])
......@@ -626,6 +677,13 @@ rhspin:companyNameHasLicenceForGraph
sp:subject
[ sp:varName "licence"^^xsd:string
]
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type rhspin:shareIsValid ;
arg:share
[ sp:varName "share"^^xsd:string
]
]
] [ sp:object
[ sp:varName "id"^^xsd:string
] ;
......@@ -663,16 +721,16 @@ rhspin:companyWithName
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b14) ;
sp:resultVariables (_:b9) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object
[ sp:varName "name"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject _:b14
sp:subject _:b9
] [ sp:object <http://www.reportinghub.no/np/schema/npd#OperatingCompany> ;
sp:predicate rdf:type ;
sp:subject _:b14
sp:subject _:b9
]) ;
sp:graphNameNode npdata:npd
])
......@@ -737,33 +795,33 @@ rhspin:currentUserHasAccessToWellBoreWithId
sp:expression
[ rdf:type rhspin:companyName
] ;
sp:variable _:b15
sp:variable _:b10
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:companyWithName ;
arg:name _:b15
arg:name _:b10
] ;
sp:variable _:b16
sp:variable _:b11
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:wellBoreById ;
arg:id [ sp:varName "id"^^xsd:string
]
] ;
sp:variable _:b17
sp:variable _:b12
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:and ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 _:b17
sp:arg1 _:b12
] ;
sp:arg2 [ rdf:type sp:bound ;
sp:arg1 _:b16
sp:arg1 _:b11
]
]
] [ sp:object _:b17 ;
] [ sp:object _:b12 ;
sp:predicate rhspin:companyHasLicenceForWellBore ;
sp:subject _:b16
sp:subject _:b11
])
] ;
spin:constraint
......@@ -961,13 +1019,13 @@ rhspin:dtypeValue
rdfs:subClassOf spl:OntologyFunctions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b18) ;
sp:where ([ sp:object _:b19 ;
sp:resultVariables (_:b13) ;
sp:where ([ sp:object _:b14 ;
sp:predicate spin:_arg2 ;
sp:subject spin:_arg1
] [ sp:object _:b18 ;
] [ sp:object _:b13 ;
sp:predicate <http://www.linkedmodel.org/schema/dtype#value> ;
sp:subject _:b19
sp:subject _:b14
])
] ;
spin:constraint
......@@ -1219,9 +1277,9 @@ rhspin:licenceForWellBore
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b20) ;
sp:resultVariables (_:b15) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object _:b20 ;
sp:elements ([ sp:object _:b15 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#drilledInProductionLicence> ;
sp:subject
[ sp:varName "wellBore"^^xsd:string
......@@ -1245,7 +1303,7 @@ rhspin:normalizeString
rdfs:subClassOf spl:StringFunctions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b21) ;
sp:resultVariables (_:b16) ;
sp:where ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
......@@ -1253,67 +1311,67 @@ rhspin:normalizeString
sp:arg2 "\\((.*)\\)" ;
sp:arg3 ""
] ;
sp:variable _:b22
sp:variable _:b17
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:trim ;
sp:arg1 _:b22
sp:arg1 _:b17
] ;
sp:variable _:b23
sp:variable _:b18
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:encodeURL ;
sp:arg1 _:b23
sp:arg1 _:b18
] ;
sp:variable _:b24
sp:variable _:b19
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
sp:arg1 _:b24 ;
sp:arg1 _:b19 ;
sp:arg2 "%2F" ;
sp:arg3 "_"
] ;
sp:variable _:b25
sp:variable _:b20
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
sp:arg1 _:b25 ;
sp:arg1 _:b20 ;
sp:arg2 "%[0-9A-F][0-9A-F]" ;
sp:arg3 ""
] ;
sp:variable _:b26
sp:variable _:b21
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
sp:arg1 _:b26 ;
sp:arg1 _:b21 ;
sp:arg2 "\\+" ;
sp:arg3 "_"
] ;
sp:variable _:b27
sp:variable _:b22
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
sp:arg1 _:b27 ;
sp:arg1 _:b22 ;
sp:arg2 "_+" ;
sp:arg3 "_"
] ;
sp:variable _:b28
sp:variable _:b23
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
sp:arg1 _:b28 ;
sp:arg1 _:b23 ;
sp:arg2 "\\*" ;
sp:arg3 ""
] ;
sp:variable _:b29
sp:variable _:b24
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type xsd:string ;
sp:arg1 [ rdf:type spif:upperCase ;
sp:arg1 _:b29
sp:arg1 _:b24
]
] ;
sp:variable _:b21
sp:variable _:b16
])
] ;
spin:constraint
......@@ -1543,9 +1601,9 @@ rhspin:npdId
rdfs:subClassOf spl:StringFunctions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b30) ;
sp:resultVariables (_:b25) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object _:b30 ;
sp:elements ([ sp:object _:b25 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
sp:subject
[ sp:varName "resource"^^xsd:string
......@@ -1718,9 +1776,9 @@ rhspin:npdName
rdfs:subClassOf spl:StringFunctions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b31) ;
sp:resultVariables (_:b26) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object _:b31 ;
sp:elements ([ sp:object _:b26 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject
[ sp:varName "resource"^^xsd:string
......@@ -1797,6 +1855,52 @@ rhspin:parentCompanyByName
] ;
spin:returnType <http://www.reportinghub.no/ep/schema/well#WellBore> .
rhspin:shareIsValid
rdf:type spin:Function ;
rdfs:comment "Tests whether a Share is still active, i.e. its end date must either be empty or after the current date."^^xsd:string ;
rdfs:label "share is valid"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Ask ;
sp:where ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type spl:object ;
sp:arg1 [ sp:varName "share"^^xsd:string
] ;
sp:arg2 <http://www.reportinghub.no/np/schema/npd#endDate>
] ;
sp:variable
[ sp:varName "endDate"^^xsd:string
]
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:or ;
sp:arg1 [ rdf:type sp:not ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 [ sp:varName "endDate"^^xsd:string
]
]
] ;
sp:arg2 [ rdf:type sp:ge ;
sp:arg1 [ sp:varName "endDate"^^xsd:string
] ;
sp:arg2 [ rdf:type xsd:date ;
sp:arg1 [ rdf:type sp:now
]
]
]
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The Share to test."^^xsd:string ;
spl:predicate arg:share ;
spl:valueType <http://www.reportinghub.no/np/schema/npd#Share>
] ;
spin:private "true"^^xsd:boolean ;
spin:returnType xsd:boolean .
rhspin:tableHeaders
rdf:type owl:ObjectProperty ;
rdfs:comment "Points to an rdf:List of xsd:string literals, one for each result column of the associated template."^^xsd:string ;
......@@ -1949,86 +2053,71 @@ rhspin:wellByName
] ;
spin:returnType <http://www.reportinghub.no/ep/schema/well#Well> .
_:b31
sp:varName "name"^^xsd:string .
_:b30
sp:varName "id"^^xsd:string .
_:b29
sp:varName "t4"^^xsd:string .
_:b28
sp:varName "t3"^^xsd:string .
_:b1 sp:varName "subject"^^xsd:string .
_:b27
sp:varName "t2"^^xsd:string .
_:b2 sp:varName "wellBoreName"^^xsd:string .
_:b26
sp:varName "t1"^^xsd:string .
_:b3 sp:varName "wellBoreId"^^xsd:string .
_:b25
sp:varName "t0b"^^xsd:string .
_:b4 sp:varName "wellBore"^^xsd:string .
_:b24
sp:varName "t0a"^^xsd:string .
_:b5 sp:varName "wellName"^^xsd:string .
_:b23
sp:varName "s2"^^xsd:string .
_:b6 sp:varName "well"^^xsd:string .
_:b22
sp:varName "s1"^^xsd:string .
_:b7 sp:varName "company"^^xsd:string .
_:b21
sp:varName "normalizedStr"^^xsd:string .
_:b8 sp:varName "wellBore"^^xsd:string .
_:b20
sp:varName "licence"^^xsd:string .
_:b9 sp:varName "company"^^xsd:string .
_:b19
sp:varName "reif"^^xsd:string .
_:b10
sp:varName "companyName"^^xsd:string .
_:b18
sp:varName "value"^^xsd:string .
_:b11
sp:varName "company"^^xsd:string .
_:b17
_:b12
sp:varName "wellBore"^^xsd:string .
_:b16
sp:varName "company"^^xsd:string .
_:b15
sp:varName "companyName"^^xsd:string .
_:b13
sp:varName "value"^^xsd:string .
_:b14
sp:varName "company"^^xsd:string .
sp:varName "reif"^^xsd:string .
_:b13
_:b15
sp:varName "licence"^^xsd:string .
_:b12
sp:varName "share"^^xsd:string .
_:b11
sp:varName "wellBore"^^xsd:string .
_:b16
sp:varName "normalizedStr"^^xsd:string .
_:b10
sp:varName "share"^^xsd:string .
_:b17
sp:varName "s1"^^xsd:string .
_:b9 sp:varName "licence"^^xsd:string .
_:b18
sp:varName "s2"^^xsd:string .
_:b8 sp:varName "wellBore"^^xsd:string .
_:b19
sp:varName "t0a"^^xsd:string .
_:b7 sp:varName "company"^^xsd:string .
_:b20
sp:varName "t0b"^^xsd:string .
_:b6 sp:varName "well"^^xsd:string .
_:b21
sp:varName "t1"^^xsd:string .
_:b5 sp:varName "wellName"^^xsd:string .
_:b22
sp:varName "t2"^^xsd:string .
_:b4 sp:varName "wellBore"^^xsd:string .
_:b23
sp:varName "t3"^^xsd:string .
_:b3 sp:varName "wellBoreId"^^xsd:string .
_:b24
sp:varName "t4"^^xsd:string .
_:b2 sp:varName "wellBoreName"^^xsd:string .
_:b25
sp:varName "id"^^xsd:string .
_:b1 sp:varName "subject"^^xsd:string .
_:b26
sp:varName "name"^^xsd:string .
......