chinmaytq

added a spin select template to retrieve DDR triples for a given date range.

# baseURI: http://www.reportinghub.no/system/spin/reporting
# imports: http://spinrdf.org/spin
# imports: http://www.reportinghub.no/system/schema/reporting
# c14n-version: 3
@prefix arg: <http://spinrdf.org/arg#> .
@prefix fn: <http://www.w3.org/2005/xpath-functions#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix reportspin: <http://www.reportinghub.no/system/spin/reporting#> .
@prefix rhspin: <http://www.reportinghub.no/spin/rh#> .
@prefix sp: <http://spinrdf.org/sp#> .
@prefix spin: <http://spinrdf.org/spin#> .
@prefix spl: <http://spinrdf.org/spl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
# baseURI: http://www.reportinghub.no/system/spin/reporting
# imports: http://spinrdf.org/spin
# imports: http://www.reportinghub.no/system/schema/reporting
@prefix arg: <http://spinrdf.org/arg#> .
@prefix fn: <http://www.w3.org/2005/xpath-functions#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix reportspin: <http://www.reportinghub.no/system/spin/reporting#> .
@prefix rhspin: <http://www.reportinghub.no/spin/rh#> .
@prefix sp: <http://spinrdf.org/sp#> .
@prefix spin: <http://spinrdf.org/spin#> .
@prefix spl: <http://spinrdf.org/spl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
arg:date
rdf:type rdf:Property ;
rdfs:label "date"^^xsd:string ;
rdfs:subPropertyOf sp:arg ;
.
rdf:type rdf:Property ;
rdfs:label "date"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:endDate
rdf:type rdf:Property ;
rdfs:subPropertyOf sp:arg .
arg:fieldName
rdf:type rdf:Property ;
rdfs:label "field name"^^xsd:string ;
rdfs:subPropertyOf sp:arg ;
.
rdf:type rdf:Property ;
rdfs:label "field name"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:id
rdf:type rdf:Property ;
rdfs:label "id"^^xsd:string ;
rdfs:subPropertyOf sp:arg ;
.
rdf:type rdf:Property ;
rdfs:label "id"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:month
rdf:type rdf:Property ;
rdfs:label "month"^^xsd:string ;
rdfs:subPropertyOf sp:arg ;
.
rdf:type rdf:Property ;
rdfs:label "month"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:owner
rdf:type rdf:Property ;
rdfs:label "owner"^^xsd:string ;
rdfs:subPropertyOf sp:arg ;
.
rdf:type rdf:Property ;
rdfs:label "owner"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:parts
rdf:type rdf:Property ;
rdfs:label "parts"^^xsd:string ;
rdfs:subPropertyOf sp:arg ;
.
rdf:type rdf:Property ;
rdfs:label "parts"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:startDate
rdf:type rdf:Property ;
rdfs:subPropertyOf sp:arg .
arg:wellBoreId
rdf:type rdf:Property ;
rdfs:label "well bore id"^^xsd:string ;
rdfs:subPropertyOf sp:arg ;
.
rdf:type rdf:Property ;
rdfs:label "well bore id"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:wellboreId
rdf:type rdf:Property ;
rdfs:subPropertyOf sp:arg .
<http://www.reportinghub.no/system/spin/reporting>
rdf:type owl:Ontology ;
rdfs:comment "SPIN functions and templates to support querying report metadata."^^xsd:string ;
owl:imports <http://spinrdf.org/spin> ;
owl:imports <http://www.reportinghub.no/system/schema/reporting> ;
owl:versionInfo "0.1.0"^^xsd:string ;
.
rdf:type owl:Ontology ;
rdfs:comment "SPIN functions and templates to support querying report metadata."^^xsd:string ;
owl:imports <http://www.reportinghub.no/system/schema/reporting> , <http://spinrdf.org/spin> ;
owl:versionInfo "0.1.0"^^xsd:string .
reportspin:DDRsOverview
rdf:type spin:SelectTemplate ;
spin:body [
rdf:type sp:Select ;
sp:orderBy (
[
sp:varName "wellBoreName"^^xsd:string ;
]
[
sp:varName "date"^^xsd:string ;
]
[
sp:varName "created"^^xsd:string ;
]
) ;
sp:resultVariables (
[
sp:varName "wellBoreName"^^xsd:string ;
]
[
sp:varName "date"^^xsd:string ;
]
[
sp:varName "created"^^xsd:string ;
]
[
sp:varName "id"^^xsd:string ;
]
) ;
sp:where (
[
sp:object [
sp:varName "wellBoreId"^^xsd:string ;
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ;
sp:subject [
sp:varName "ddr"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "created"^^xsd:string ;
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject [
sp:varName "ddr"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "date"^^xsd:string ;
] ;
sp:predicate <http://purl.org/dc/terms/date> ;
sp:subject [
sp:varName "ddr"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "id"^^xsd:string ;
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject [
sp:varName "ddr"^^xsd:string ;
] ;
]
[
rdf:type sp:Bind ;
sp:expression [
rdf:type rhspin:wellBoreById ;
sp:arg1 [
sp:varName "wellBoreId"^^xsd:string ;
] ;
] ;
sp:variable [
sp:varName "wellBore"^^xsd:string ;
] ;
]
[
rdf:type sp:Bind ;
sp:expression [
rdf:type rhspin:npdName ;
sp:arg1 [
sp:varName "wellBore"^^xsd:string ;
] ;
] ;
sp:variable [
sp:varName "wellBoreName"^^xsd:string ;
] ;
]
) ;
] ;
rdfs:label "DDRs overview"^^xsd:string ;
rdfs:subClassOf spin:SelectTemplates ;
.
rdf:type spin:SelectTemplate ;
rdfs:label "DDRs overview"^^xsd:string ;
rdfs:subClassOf spin:SelectTemplates ;
spin:body
[ rdf:type sp:Select ;
sp:orderBy ([ sp:varName "wellBoreName"^^xsd:string
] [ sp:varName "date"^^xsd:string
] [ sp:varName "created"^^xsd:string
]) ;
sp:resultVariables ([ sp:varName "wellBoreName"^^xsd:string
] [ sp:varName "date"^^xsd:string
] [ sp:varName "created"^^xsd:string
] [ sp:varName "id"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "wellBoreId"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ;
sp:subject
[ sp:varName "ddr"^^xsd:string
]
] [ sp:object
[ sp:varName "created"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject
[ sp:varName "ddr"^^xsd:string
]
] [ sp:object
[ sp:varName "date"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/date> ;
sp:subject
[ sp:varName "ddr"^^xsd:string
]
] [ sp:object
[ sp:varName "id"^^xsd:string
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject
[ sp:varName "ddr"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:wellBoreById ;
sp:arg1 [ sp:varName "wellBoreId"^^xsd:string
]
] ;
sp:variable
[ sp:varName "wellBore"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:npdName ;
sp:arg1 [ sp:varName "wellBore"^^xsd:string
]
] ;
sp:variable
[ sp:varName "wellBoreName"^^xsd:string
]
])
] .
reportspin:DPRsOverview
rdf:type spin:SelectTemplate ;
spin:body [
rdf:type sp:Select ;
sp:orderBy (
[
sp:varName "ownerName"^^xsd:string ;
]
[
sp:varName "date"^^xsd:string ;
]
[
sp:varName "created"^^xsd:string ;
]
) ;
sp:resultVariables (
[
sp:varName "ownerName"^^xsd:string ;
]
[
sp:varName "date"^^xsd:string ;
]
[
sp:varName "created"^^xsd:string ;
]
[
sp:varName "id"^^xsd:string ;
]
) ;
sp:where (
[
sp:object [
sp:varName "id"^^xsd:string ;
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject [
sp:varName "dpr"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "created"^^xsd:string ;
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject [
sp:varName "dpr"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "date"^^xsd:string ;
] ;
sp:predicate <http://purl.org/dc/terms/date> ;
sp:subject [
sp:varName "dpr"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "owner"^^xsd:string ;
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#owner> ;
sp:subject [
sp:varName "dpr"^^xsd:string ;
] ;
]
[
rdf:type sp:Bind ;
sp:expression [
rdf:type rhspin:npdName ;
sp:arg1 [
sp:varName "owner"^^xsd:string ;
] ;
] ;
sp:variable [
sp:varName "ownerName"^^xsd:string ;
] ;
]
) ;
] ;
rdfs:label "DPRs overview"^^xsd:string ;
rdfs:subClassOf spin:SelectTemplates ;
.
rdf:type spin:SelectTemplate ;
rdfs:label "DPRs overview"^^xsd:string ;
rdfs:subClassOf spin:SelectTemplates ;
spin:body
[ rdf:type sp:Select ;
sp:orderBy ([ sp:varName "ownerName"^^xsd:string
] [ sp:varName "date"^^xsd:string
] [ sp:varName "created"^^xsd:string
]) ;
sp:resultVariables ([ sp:varName "ownerName"^^xsd:string
] [ sp:varName "date"^^xsd:string
] [ sp:varName "created"^^xsd:string
] [ sp:varName "id"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "id"^^xsd:string
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject
[ sp:varName "dpr"^^xsd:string
]
] [ sp:object
[ sp:varName "created"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject
[ sp:varName "dpr"^^xsd:string
]
] [ sp:object
[ sp:varName "date"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/date> ;
sp:subject
[ sp:varName "dpr"^^xsd:string
]
] [ sp:object
[ sp:varName "owner"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#owner> ;
sp:subject
[ sp:varName "dpr"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:npdName ;
sp:arg1 [ sp:varName "owner"^^xsd:string
]
] ;
sp:variable
[ sp:varName "ownerName"^^xsd:string
]
])
] .
reportspin:graphByDDRId
rdf:type spin:Function ;
spin:body [
rdf:type sp:Select ;
sp:resultVariables (
[
rdf:type sp:iri ;
sp:arg1 [
sp:varName "uri"^^xsd:string ;
] ;
]
) ;
sp:where (
[
rdf:type sp:Bind ;
sp:expression [
rdf:type fn:concat ;
sp:arg1 "http://www.reportinghub.no/system/ddr/" ;
sp:arg2 [
sp:varName "id"^^xsd:string ;
] ;
] ;
sp:variable [
sp:varName "uri"^^xsd:string ;
] ;
]
) ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:id ;
spl:valueType xsd:string ;
rdfs:comment "The id of the DDR metadata."^^xsd:string ;
] ;
spin:returnType rdfs:Resource ;
rdfs:comment "Gets the URI of the named graph containing the triples submitted by a report:DDR (metadata) with a given id."^^xsd:string ;
rdfs:label "graph by DDR id"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
.
rdf:type spin:Function ;
rdfs:comment "Gets the URI of the named graph containing the triples submitted by a report:DDR (metadata) with a given id."^^xsd:string ;
rdfs:label "graph by DDR id"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables ([ rdf:type sp:iri ;
sp:arg1 [ sp:varName "uri"^^xsd:string
]
]) ;
sp:where ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "http://www.reportinghub.no/system/ddr/" ;
sp:arg2 [ sp:varName "id"^^xsd:string
]
] ;
sp:variable
[ sp:varName "uri"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The id of the DDR metadata."^^xsd:string ;
spl:predicate arg:id ;
spl:valueType xsd:string
] ;
spin:returnType rdfs:Resource .
reportspin:graphByDPRId
rdf:type spin:Function ;
spin:body [
rdf:type sp:Select ;
sp:resultVariables (
[
rdf:type sp:iri ;
sp:arg1 [
sp:varName "uri"^^xsd:string ;
] ;
]
) ;
sp:where (
[
rdf:type sp:Bind ;
sp:expression [
rdf:type fn:concat ;
sp:arg1 "http://www.reportinghub.no/system/dpr/" ;
sp:arg2 [
sp:varName "id"^^xsd:string ;
] ;
] ;
sp:variable [
sp:varName "uri"^^xsd:string ;
] ;
]
) ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:id ;
spl:valueType xsd:string ;
rdfs:comment "The id of the DPR metadata."^^xsd:string ;
] ;
spin:returnType rdfs:Resource ;
rdfs:comment "Gets the URI of the named graph containing the triples submitted by a report:DPR (metadata) with a given id."^^xsd:string ;
rdfs:label "graph by DPR id"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
.
rdf:type spin:Function ;
rdfs:comment "Gets the URI of the named graph containing the triples submitted by a report:DPR (metadata) with a given id."^^xsd:string ;
rdfs:label "graph by DPR id"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables ([ rdf:type sp:iri ;
sp:arg1 [ sp:varName "uri"^^xsd:string
]
]) ;
sp:where ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "http://www.reportinghub.no/system/dpr/" ;
sp:arg2 [ sp:varName "id"^^xsd:string
]
] ;
sp:variable
[ sp:varName "uri"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The id of the DPR metadata."^^xsd:string ;
spl:predicate arg:id ;
spl:valueType xsd:string
] ;
spin:returnType rdfs:Resource .
reportspin:graphByReportId
rdf:type spin:Function ;
spin:body [
rdf:type sp:Select ;
sp:resultVariables (
[
rdf:type sp:iri ;
sp:arg1 [
sp:varName "uri"^^xsd:string ;
] ;
]
) ;
sp:where (
[
rdf:type sp:Bind ;
sp:expression [
rdf:type fn:concat ;
sp:arg1 "http://www.reportinghub.no/system/report/" ;
sp:arg2 [
sp:varName "id"^^xsd:string ;
] ;
] ;
sp:variable [
sp:varName "uri"^^xsd:string ;
] ;
]
) ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:id ;
spl:valueType xsd:string ;
rdfs:comment "The id of the DDR metadata."^^xsd:string ;
] ;
spin:returnType rdfs:Resource ;
rdfs:comment "Gets the URI of the named graph containing the triples submitted by a report with a given id."^^xsd:string ;
rdfs:label "graph by report id"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
.
rdf:type spin:Function ;
rdfs:comment "Gets the URI of the named graph containing the triples submitted by a report with a given id."^^xsd:string ;
rdfs:label "graph by report id"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables ([ rdf:type sp:iri ;
sp:arg1 [ sp:varName "uri"^^xsd:string
]
]) ;
sp:where ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "http://www.reportinghub.no/system/report/" ;
sp:arg2 [ sp:varName "id"^^xsd:string
]
] ;
sp:variable
[ sp:varName "uri"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The id of the DDR metadata."^^xsd:string ;
spl:predicate arg:id ;
spl:valueType xsd:string
] ;
spin:returnType rdfs:Resource .
reportspin:idOfDDRByDateAndWellBoreId
rdf:type spin:Function ;
spin:body [
rdf:type sp:Select ;
sp:orderBy (
[
rdf:type sp:Desc ;
sp:expression [
sp:varName "created"^^xsd:string ;
] ;
]
) ;
sp:resultVariables (
[
sp:varName "id"^^xsd:string ;
]
) ;
sp:where (
[
sp:object [
sp:varName "wellBoreId"^^xsd:string ;
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "date"^^xsd:string ;
] ;
sp:predicate <http://purl.org/dc/terms/date> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "created"^^xsd:string ;
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "id"^^xsd:string ;
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
) ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:date ;
spl:valueType xsd:date ;
rdfs:comment "The date of the DDR (not the submission date, but the start date of the report)."^^xsd:string ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:wellBoreId ;
spl:valueType xsd:string ;
rdfs:comment "The id of the well bore."^^xsd:string ;
] ;
spin:returnType xsd:string ;
rdfs:comment "Gets the id of a DDR defined by date and well bore id. If preliminary reports have been created, this will return the most recent one only."^^xsd:string ;
rdfs:label "id of DDR by date and well bore id"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
.
rdf:type spin:Function ;
rdfs:comment "Gets the id of a DDR defined by date and well bore id. If preliminary reports have been created, this will return the most recent one only."^^xsd:string ;
rdfs:label "id of DDR by date and well bore id"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:orderBy ([ rdf:type sp:Desc ;
sp:expression
[ sp:varName "created"^^xsd:string
]
]) ;
sp:resultVariables ([ sp:varName "id"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "wellBoreId"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "date"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/date> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "created"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "id"^^xsd:string
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The id of the well bore."^^xsd:string ;
spl:predicate arg:wellBoreId ;
spl:valueType xsd:string
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The date of the DDR (not the submission date, but the start date of the report)."^^xsd:string ;
spl:predicate arg:date ;
spl:valueType xsd:date
] ;
spin:returnType xsd:string .
reportspin:idOfDPR2ByDateAndFieldName
rdf:type spin:Function ;
spin:body [
rdf:type sp:Select ;
sp:limit "1"^^xsd:long ;
sp:orderBy (
[
rdf:type sp:Desc ;
sp:expression [
sp:varName "created"^^xsd:string ;
] ;
]
) ;
sp:resultVariables (
[
sp:varName "id"^^xsd:string ;
]
) ;
sp:where (
[
sp:object [
sp:varName "fieldName"^^xsd:string ;
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#fieldName> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "date"^^xsd:string ;
] ;
sp:predicate <http://purl.org/dc/terms/date> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "created"^^xsd:string ;
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "id"^^xsd:string ;
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
) ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:date ;
spl:valueType xsd:date ;
rdfs:comment "The xsd:date of the DPR2 to get."^^xsd:string ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:fieldName ;
spl:valueType xsd:string ;
rdfs:comment "The registered name of the Field."^^xsd:string ;
] ;
spin:returnType xsd:string ;
rdfs:label "id of DPR2By date and field name"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
.
rdf:type spin:Function ;
rdfs:label "id of DPR2By date and field name"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:limit "1"^^xsd:long ;
sp:orderBy ([ rdf:type sp:Desc ;
sp:expression
[ sp:varName "created"^^xsd:string
]
]) ;
sp:resultVariables ([ sp:varName "id"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "fieldName"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#fieldName> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "date"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/date> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "created"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "id"^^xsd:string
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The registered name of the Field."^^xsd:string ;
spl:predicate arg:fieldName ;
spl:valueType xsd:string
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The xsd:date of the DPR2 to get."^^xsd:string ;
spl:predicate arg:date ;
spl:valueType xsd:date
] ;
spin:returnType xsd:string .
reportspin:idOfDPRByDateAndOwner
rdf:type spin:Function ;
spin:body [
rdf:type sp:Select ;
sp:orderBy (
[
rdf:type sp:Desc ;
sp:expression [
sp:varName "created"^^xsd:string ;
] ;
]
) ;
sp:resultVariables (
[
sp:varName "id"^^xsd:string ;
]
) ;
sp:where (
[
sp:object [
sp:varName "owner"^^xsd:string ;
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#owner> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "date"^^xsd:string ;
] ;
sp:predicate <http://purl.org/dc/terms/date> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "created"^^xsd:string ;
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "id"^^xsd:string ;
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
) ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:date ;
spl:valueType xsd:date ;
rdfs:comment "The date of the DDR (not the submission date, but the start date of the report)."^^xsd:string ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:owner ;
spl:valueType <http://www.reportinghub.no/np/schema/npd#Owner> ;
rdfs:comment "The Licence or BAA."^^xsd:string ;
] ;
spin:returnType xsd:string ;
rdfs:comment "Gets the id of a DPR defined by date and licence or BAA. If preliminary reports have been created, this will return the most recent one only."^^xsd:string ;
rdfs:label "id of DPR by date and owner"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
.
rdf:type spin:Function ;
rdfs:comment "Gets the id of a DPR defined by date and licence or BAA. If preliminary reports have been created, this will return the most recent one only."^^xsd:string ;
rdfs:label "id of DPR by date and owner"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:orderBy ([ rdf:type sp:Desc ;
sp:expression
[ sp:varName "created"^^xsd:string
]
]) ;
sp:resultVariables ([ sp:varName "id"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "owner"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#owner> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "date"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/date> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "created"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "id"^^xsd:string
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
])
] ;
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:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The date of the DDR (not the submission date, but the start date of the report)."^^xsd:string ;
spl:predicate arg:date ;
spl:valueType xsd:date
] ;
spin:returnType xsd:string .
reportspin:idOfMPRGByFieldMonthAndParts
rdf:type spin:Function ;
spin:body [
rdf:type sp:Select ;
sp:orderBy (
[
rdf:type sp:Desc ;
sp:expression [
sp:varName "created"^^xsd:string ;
] ;
]
) ;
sp:resultVariables (
[
sp:varName "id"^^xsd:string ;
]
) ;
sp:where (
[
sp:object [
sp:varName "fieldName"^^xsd:string ;
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#fieldName> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "month"^^xsd:string ;
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#month> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "parts"^^xsd:string ;
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#containsParts> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "created"^^xsd:string ;
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "id"^^xsd:string ;
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
) ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:fieldName ;
spl:valueType xsd:string ;
rdfs:comment "The field name."^^xsd:string ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:month ;
spl:valueType xsd:string ;
rdfs:comment "The month, e.g. \"2011-04\""^^xsd:string ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:parts ;
spl:valueType xsd:string ;
rdfs:comment "The parts value that the report must have (at report:containsParts)."^^xsd:string ;
] ;
spin:returnType xsd:string ;
rdfs:label "id of MPRG by field, month and parts"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
.
rdf:type spin:Function ;
rdfs:label "id of MPRG by field, month and parts"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:orderBy ([ rdf:type sp:Desc ;
sp:expression
[ sp:varName "created"^^xsd:string
]
]) ;
sp:resultVariables ([ sp:varName "id"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "fieldName"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#fieldName> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "month"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#month> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "parts"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#containsParts> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "created"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "id"^^xsd:string
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The parts value that the report must have (at report:containsParts)."^^xsd:string ;
spl:predicate arg:parts ;
spl:valueType xsd:string
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The month, e.g. \"2011-04\""^^xsd:string ;
spl:predicate arg:month ;
spl:valueType xsd:string
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The field name."^^xsd:string ;
spl:predicate arg:fieldName ;
spl:valueType xsd:string
] ;
spin:returnType xsd:string .
reportspin:idOfMPRPByFieldMonth
rdf:type spin:Function ;
spin:body [
rdf:type sp:Select ;
sp:limit "1"^^xsd:long ;
sp:orderBy (
[
rdf:type sp:Desc ;
sp:expression [
sp:varName "created"^^xsd:string ;
] ;
]
) ;
sp:resultVariables (
[
sp:varName "id"^^xsd:string ;
]
) ;
sp:where (
[
sp:object [
sp:varName "fieldName"^^xsd:string ;
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#fieldName> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "month"^^xsd:string ;
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#month> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "created"^^xsd:string ;
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "id"^^xsd:string ;
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
) ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:fieldName ;
spl:valueType xsd:string ;
rdfs:comment "The field name."^^xsd:string ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:month ;
spl:valueType xsd:string ;
rdfs:comment "The month, e.g. \"2011-04\""^^xsd:string ;
] ;
spin:returnType xsd:string ;
rdfs:label "id of MPRG by field, month and parts"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
.
rdf:type spin:Function ;
rdfs:label "id of MPRG by field, month and parts"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:limit "1"^^xsd:long ;
sp:orderBy ([ rdf:type sp:Desc ;
sp:expression
[ sp:varName "created"^^xsd:string
]
]) ;
sp:resultVariables ([ sp:varName "id"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "fieldName"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#fieldName> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "month"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#month> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "created"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "id"^^xsd:string
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The month, e.g. \"2011-04\""^^xsd:string ;
spl:predicate arg:month ;
spl:valueType xsd:string
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The field name."^^xsd:string ;
spl:predicate arg:fieldName ;
spl:valueType xsd:string
] ;
spin:returnType xsd:string .
reportspin:idsOfDDRsbyDateAndWellboreId
rdf:type spin:SelectTemplate ;
rdfs:subClassOf spin:SelectTemplates ;
spin:body
[ rdf:type sp:Select ;
sp:orderBy ([ rdf:type sp:Desc ;
sp:expression
[ sp:varName "created"^^xsd:string
]
]) ;
sp:resultVariables ([ sp:varName "id"^^xsd:string
] [ sp:varName "date"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "wellBoreId"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "date"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/date> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "created"^^xsd:string
] ;
sp:predicate <http://purl.org/dc/terms/created> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "id"^^xsd:string
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:and ;
sp:arg1 [ rdf:type sp:ge ;
sp:arg1 [ sp:varName "date"^^xsd:string
] ;
sp:arg2 [ sp:varName "startDate"^^xsd:string
]
] ;
sp:arg2 [ rdf:type sp:le ;
sp:arg1 [ sp:varName "date"^^xsd:string
] ;
sp:arg2 [ sp:varName "endDate"^^xsd:string
]
]
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "end date for which DDR reports are to be searched."^^xsd:string ;
spl:predicate arg:endDate ;
spl:valueType xsd:date
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "Start date for which DDR reports are to be searched."^^xsd:string ;
spl:predicate arg:startDate ;
spl:valueType xsd:date
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "Wellbore id for which DDR report is to be searched."^^xsd:string ;
spl:predicate arg:wellboreId ;
spl:valueType xsd:string
] .
reportspin:idsOfMPRGsByFieldAndMonth
rdf:type spin:MagicProperty ;
spin:body [
rdf:type sp:Select ;
sp:resultVariables (
[
sp:varName "id"^^xsd:string ;
]
) ;
sp:where (
[
rdf:type sp:SubQuery ;
sp:query [
rdf:type sp:Select ;
sp:distinct "true"^^xsd:boolean ;
sp:resultVariables (
[
sp:varName "parts"^^xsd:string ;
]
) ;
sp:where (
[
sp:object [
sp:varName "fieldName"^^xsd:string ;
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#fieldName> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "month"^^xsd:string ;
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#month> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "parts"^^xsd:string ;
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#containsParts> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
) ;
] ;
]
[
rdf:type sp:Bind ;
sp:expression [
rdf:type reportspin:idOfMPRGByFieldMonthAndParts ;
arg:fieldName [
sp:varName "fieldName"^^xsd:string ;
] ;
arg:month [
sp:varName "month"^^xsd:string ;
] ;
arg:parts [
sp:varName "parts"^^xsd:string ;
] ;
] ;
sp:variable [
sp:varName "id"^^xsd:string ;
] ;
]
) ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:fieldName ;
spl:valueType xsd:string ;
rdfs:comment "The field name."^^xsd:string ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:month ;
spl:valueType xsd:string ;
rdfs:comment "The month, e.g. \"2011-04\""^^xsd:string ;
] ;
rdfs:comment "Gets the ids of all MPRGs for a given field/month combination, iterating through all used parts combinations."^^xsd:string ;
rdfs:label "ids of MPRGs by field and month"^^xsd:string ;
rdfs:subClassOf spin:MagicProperties ;
.
rdf:type spin:MagicProperty ;
rdfs:comment "Gets the ids of all MPRGs for a given field/month combination, iterating through all used parts combinations."^^xsd:string ;
rdfs:label "ids of MPRGs by field and month"^^xsd:string ;
rdfs:subClassOf spin:MagicProperties ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables ([ sp:varName "id"^^xsd:string
]) ;
sp:where ([ rdf:type sp:SubQuery ;
sp:query
[ rdf:type sp:Select ;
sp:distinct "true"^^xsd:boolean ;
sp:resultVariables ([ sp:varName "parts"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "fieldName"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#fieldName> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "month"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#month> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "parts"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#containsParts> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
])
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type reportspin:idOfMPRGByFieldMonthAndParts ;
arg:fieldName
[ sp:varName "fieldName"^^xsd:string
] ;
arg:month
[ sp:varName "month"^^xsd:string
] ;
arg:parts
[ sp:varName "parts"^^xsd:string
]
] ;
sp:variable
[ sp:varName "id"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The month, e.g. \"2011-04\""^^xsd:string ;
spl:predicate arg:month ;
spl:valueType xsd:string
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The field name."^^xsd:string ;
spl:predicate arg:fieldName ;
spl:valueType xsd:string
] .
reportspin:isPreliminaryById
rdf:type spin:Function ;
spin:body [
rdf:type sp:Select ;
sp:resultVariables (
[
sp:varName "result"^^xsd:string ;
]
) ;
sp:where (
[
sp:object [
sp:varName "id"^^xsd:string ;
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
[
sp:object [
sp:varName "result"^^xsd:string ;
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#preliminary> ;
sp:subject [
sp:varName "report"^^xsd:string ;
] ;
]
) ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate arg:id ;
spl:valueType xsd:string ;
rdfs:comment "The of the report to check."^^xsd:string ;
] ;
spin:returnType xsd:boolean ;
rdfs:label "is preliminary by id"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
.
rdf:type spin:Function ;
rdfs:label "is preliminary by id"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables ([ sp:varName "result"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "id"^^xsd:string
] ;
sp:predicate <http://rdfs.org/sioc/ns#id> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
] [ sp:object
[ sp:varName "result"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/system/schema/reporting#preliminary> ;
sp:subject
[ sp:varName "report"^^xsd:string
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The of the report to check."^^xsd:string ;
spl:predicate arg:id ;
spl:valueType xsd:string
] ;
spin:returnType xsd:boolean .
......