Holger Knublauch
Committed by David Price

Additional helper function

......@@ -383,6 +383,43 @@ rhspin:ddrActivityStartDate
] ;
spin:returnType xsd:date .
rhspin:ddrWellBoreId
rdf:type spin:Function ;
rdfs:comment "Gets the id of the well bore covered by a given DDR."^^xsd:string ;
rdfs:label "DDR well bore id"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b16) ;
sp:where ([ rdf:type sp:TriplePath ;
sp:object _:b17 ;
sp:path [ rdf:type sp:SeqPath ;
sp:path1
[ rdf:type sp:SeqPath ;
sp:path1 <http://www.reportinghub.no/ep/schema/activity#reportOn> ;
sp:path2 <http://www.reportinghub.no/ep/schema/activity#onWellBore>
] ;
sp:path2 <http://www.reportinghub.no/ep/schema/core#temporalPartOf>
] ;
sp:subject
[ sp:varName "ddr"^^xsd:string
]
] [ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object _:b16 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
sp:subject _:b17
]) ;
sp:graphNameNode npdata:npd
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The DailyDrillingReport to get the start date of."^^xsd:string ;
spl:predicate <http://spinrdf.org/arg#ddr> ;
spl:valueType <http://www.reportinghub.no/ep/schema/report#DailyDrillingReport>
] ;
spin:returnType xsd:string .
rhspin:discoveryById
rdf:type spin:Function ;
rdfs:label "discovery by id"^^xsd:string ;
......@@ -412,13 +449,13 @@ rhspin:dtypeValue
rdfs:subClassOf spl:OntologyFunctions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b16) ;
sp:where ([ sp:object _:b17 ;
sp:resultVariables (_:b18) ;
sp:where ([ sp:object _:b19 ;
sp:predicate spin:_arg2 ;
sp:subject spin:_arg1
] [ sp:object _:b16 ;
] [ sp:object _:b18 ;
sp:predicate <http://www.linkedmodel.org/schema/dtype#value> ;
sp:subject _:b17
sp:subject _:b19
])
] ;
spin:constraint
......@@ -508,9 +545,9 @@ rhspin:licenceForWellBore
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b18) ;
sp:resultVariables (_:b20) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object _:b18 ;
sp:elements ([ sp:object _:b20 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#drilledInProductionLicence> ;
sp:subject
[ sp:varName "wellBore"^^xsd:string
......@@ -534,7 +571,7 @@ rhspin:normalizeString
rdfs:subClassOf spl:StringFunctions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b19) ;
sp:resultVariables (_:b21) ;
sp:where ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
......@@ -542,67 +579,67 @@ rhspin:normalizeString
sp:arg2 "\\((.*)\\)" ;
sp:arg3 ""
] ;
sp:variable _:b20
sp:variable _:b22
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:trim ;
sp:arg1 _:b20
sp:arg1 _:b22
] ;
sp:variable _:b21
sp:variable _:b23
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:encodeURL ;
sp:arg1 _:b21
sp:arg1 _:b23
] ;
sp:variable _:b22
sp:variable _:b24
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
sp:arg1 _:b22 ;
sp:arg1 _:b24 ;
sp:arg2 "%2F" ;
sp:arg3 "_"
] ;
sp:variable _:b23
sp:variable _:b25
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
sp:arg1 _:b23 ;
sp:arg1 _:b25 ;
sp:arg2 "%[0-9A-F][0-9A-F]" ;
sp:arg3 ""
] ;
sp:variable _:b24
sp:variable _:b26
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
sp:arg1 _:b24 ;
sp:arg1 _:b26 ;
sp:arg2 "\\+" ;
sp:arg3 "_"
] ;
sp:variable _:b25
sp:variable _:b27
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
sp:arg1 _:b25 ;
sp:arg1 _:b27 ;
sp:arg2 "_+" ;
sp:arg3 "_"
] ;
sp:variable _:b26
sp:variable _:b28
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:regex ;
sp:arg1 _:b26 ;
sp:arg1 _:b28 ;
sp:arg2 "\\*" ;
sp:arg3 ""
] ;
sp:variable _:b27
sp:variable _:b29
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type xsd:string ;
sp:arg1 [ rdf:type spif:upperCase ;
sp:arg1 _:b27
sp:arg1 _:b29
]
] ;
sp:variable _:b19
sp:variable _:b21
])
] ;
spin:constraint
......@@ -619,9 +656,9 @@ rhspin:npdId
rdfs:subClassOf spl:StringFunctions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b28) ;
sp:resultVariables (_:b30) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object _:b28 ;
sp:elements ([ sp:object _:b30 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
sp:subject
[ sp:varName "resource"^^xsd:string
......@@ -644,9 +681,9 @@ rhspin:npdName
rdfs:subClassOf spl:StringFunctions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b29) ;
sp:resultVariables (_:b31) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object _:b29 ;
sp:elements ([ sp:object _:b31 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject
[ sp:varName "resource"^^xsd:string
......@@ -758,27 +795,27 @@ rhspin:wellBoreByName
rdfs:subClassOf spl:URIFunctions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b30) ;
sp:resultVariables (_:b32) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ rdf:type sp:Union ;
sp:elements (([ sp:object _:b31 ;
sp:elements (([ sp:object _:b33 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject _:b30
sp:subject _:b32
]) ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:replaceAll ;
sp:arg1 _:b31 ;
sp:arg1 _:b33 ;
sp:arg2 "/0" ;
sp:arg3 "/"
] ;
sp:variable _:b32
] [ sp:object _:b32 ;
sp:variable _:b34
] [ sp:object _:b34 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject _:b30
sp:subject _:b32
]))
] [ sp:object <http://www.reportinghub.no/ep/schema/well#WellBore> ;
sp:predicate rdf:type ;
sp:subject _:b30
sp:subject _:b32
]) ;
sp:graphNameNode npdata:npd
])
......@@ -817,58 +854,64 @@ rhspin:wellByName
] ;
spin:returnType <http://www.reportinghub.no/ep/schema/well#Well> .
_:b16
sp:varName "id"^^xsd:string .
_:b17
sp:varName "wellBore"^^xsd:string .
_:b15
sp:varName "startedAt"^^xsd:string .
_:b32
_:b34
sp:varName "str"^^xsd:string .
_:b31
_:b33
sp:varName "wellBoreName"^^xsd:string .
_:b30
_:b32
sp:varName "wellBore"^^xsd:string .
_:b29
_:b31
sp:varName "name"^^xsd:string .
_:b28
_:b30
sp:varName "id"^^xsd:string .
_:b27
_:b29
sp:varName "t4"^^xsd:string .
_:b26
_:b28
sp:varName "t3"^^xsd:string .
_:b25
_:b27
sp:varName "t2"^^xsd:string .
_:b24
_:b26
sp:varName "t1"^^xsd:string .
_:b23
_:b25
sp:varName "t0b"^^xsd:string .
_:b22
_:b24
sp:varName "t0a"^^xsd:string .
_:b21
_:b23
sp:varName "s2"^^xsd:string .
_:b20
_:b22
sp:varName "s1"^^xsd:string .
_:b19
_:b21
sp:varName "normalizedStr"^^xsd:string .
_:b18
_:b20
sp:varName "licence"^^xsd:string .
_:b17
_:b19
sp:varName "reif"^^xsd:string .
_:b16
_:b18
sp:varName "value"^^xsd:string .
_:b14
......