Holger Knublauch

New ontologies for system schema/spin

Bug fix in SPIN constraint for the case if no well bore name is known
......@@ -36,7 +36,7 @@
<http://www.reportinghub.no/ep/spin/report-constraints>
rdf:type owl:Ontology ;
rdfs:comment "Constraints that need to be executed after ep-report:Report generation (without SXML triples)."^^xsd:string ;
owl:imports <http://www.reportinghub.no/spin/rh> , <http://spinrdf.org/spin> , <http://www.reportinghub.no/ep/schema/1.0/report> , <http://www.reportinghub.no/ep/schema/1.0/facility> , <http://www.reportinghub.no/np/schema/1.0/npd> , <http://www.reportinghub.no/ep/schema/1.0/organization> , <http://www.reportinghub.no/ep/schema/1.0/core> , <http://www.reportinghub.no/ep/schema/1.0/well> , <http://www.reportinghub.no/ep/schema/1.0/equipment> , <http://www.reportinghub.no/ep/schema/1.0/activity> , <http://www.reportinghub.no/ep/schema/1.0/ddr> ;
owl:imports <http://spinrdf.org/spin> , <http://www.reportinghub.no/ep/schema/1.0/activity> , <http://www.reportinghub.no/ep/schema/1.0/core> , <http://www.reportinghub.no/ep/schema/1.0/ddr> , <http://www.reportinghub.no/ep/schema/1.0/equipment> , <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/ep/schema/1.0/well> , <http://www.reportinghub.no/np/schema/1.0/npd> , <http://www.reportinghub.no/spin/rh> ;
owl:versionInfo "0.1.0"^^xsd:string .
:DDRSuperclass
......@@ -52,12 +52,16 @@
] [ sp:object spin:_this ;
sp:predicate spin:violationRoot ;
sp:subject _:b1
] [ sp:object _:b2 ;
] [ sp:object
[ sp:varName "message"^^xsd:string
] ;
sp:predicate rdfs:label ;
sp:subject _:b1
]) ;
sp:where ([ rdf:type sp:TriplePath ;
sp:object _:b3 ;
sp:object
[ sp:varName "wellBore"^^xsd:string
] ;
sp:path [ rdf:type sp:SeqPath ;
sp:path1
[ rdf:type sp:SeqPath ;
......@@ -71,41 +75,59 @@
sp:expression
[ rdf:type rhspin:companyName
] ;
sp:variable _:b4
sp:variable
[ sp:varName "companyName"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:companyWithName ;
arg:name _:b4
arg:name
[ sp:varName "companyName"^^xsd:string
]
] ;
sp:variable _:b5
sp:variable
[ sp:varName "company"^^xsd:string
]
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:bound ;
sp:arg1 _:b5
sp:arg1 [ sp:varName "company"^^xsd:string
]
]
] [ rdf:type sp:NotExists ;
sp:elements ([ sp:object _:b3 ;
sp:elements ([ sp:object
[ sp:varName "wellBore"^^xsd:string
] ;
sp:predicate rhspin:companyHasLicenceForWellBore ;
sp:subject _:b5
sp:subject
[ sp:varName "company"^^xsd:string
]
])
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type sp:coalesce ;
sp:arg1 [ rdf:type rhspin:npdName ;
arg:resource
[ sp:varName "wellBore"^^xsd:string
]
] ;
sp:arg2 "Unknown well bore"
] ;
sp:variable
[ sp:varName "displayName"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "Your company (" ;
sp:arg2 _:b4 ;
sp:arg2 [ sp:varName "companyName"^^xsd:string
] ;
sp:arg3 ") does not hold a licence for well bore " ;
sp:arg4 [ rdf:type rhspin:npdName ;
arg:resource _:b3
sp:arg4 [ sp:varName "displayName"^^xsd:string
]
] ;
sp:variable _:b2
sp:variable
[ sp:varName "message"^^xsd:string
]
])
] .
_:b5 sp:varName "company"^^xsd:string .
_:b4 sp:varName "companyName"^^xsd:string .
_:b3 sp:varName "wellBore"^^xsd:string .
_:b2 sp:varName "message"^^xsd:string .
......
# baseURI: http://www.reportinghub.no/system/schema/reporting
# imports: http://purl.org/dc/terms/
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@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 report: <http://www.reportinghub.no/system/schema/reporting#> .
@prefix sioc: <http://rdfs.org/sioc/ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
sioc:id
rdf:type owl:DatatypeProperty ;
rdfs:label "id"^^xsd:string .
<http://www.reportinghub.no/system/schema/reporting>
rdf:type owl:Ontology ;
rdfs:comment "The schema of metadata kept by the ReportingHub system to keep track of submitted reports. The starting point is the class foaf:Document."^^xsd:string ;
owl:imports <http://purl.org/dc/terms/> ;
owl:versionInfo "0.1.0"^^xsd:string .
report:DDR
rdf:type rdfs:Class ;
rdfs:comment "The metadata about a Daily Drilling Report."^^xsd:string ;
rdfs:label "DDR"^^xsd:string ;
rdfs:subClassOf foaf:Document ;
rdfs:subClassOf
[ rdf:type owl:Restriction ;
owl:allValuesFrom xsd:string ;
owl:onProperty sioc:id
] ;
rdfs:subClassOf
[ rdf:type owl:Restriction ;
owl:cardinality "1"^^xsd:nonNegativeInteger ;
owl:onProperty <http://purl.org/dc/terms/date>
] ;
rdfs:subClassOf
[ rdf:type owl:Restriction ;
owl:cardinality "1"^^xsd:nonNegativeInteger ;
owl:onProperty report:wellBoreId
] ;
rdfs:subClassOf
[ rdf:type owl:Restriction ;
owl:cardinality "1"^^xsd:nonNegativeInteger ;
owl:onProperty <http://purl.org/dc/terms/created>
] ;
rdfs:subClassOf
[ rdf:type owl:Restriction ;
owl:cardinality "1"^^xsd:nonNegativeInteger ;
owl:onProperty sioc:id
] .
report:wellBoreId
rdf:type owl:DatatypeProperty ;
rdfs:label "well bore id"^^xsd:string .
foaf:Document
rdf:type rdfs:Class ;
rdfs:label "Document"^^xsd:string .
# baseURI: http://www.reportinghub.no/system/spin/reporting
# imports: http://spinrdf.org/spin
# imports: http://www.reportinghub.no/system/schema/reporting
@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 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#> .
<http://spinrdf.org/arg#date>
rdf:type rdf:Property ;
rdfs:label "date"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
<http://spinrdf.org/arg#id>
rdf:type rdf:Property ;
rdfs:label "id"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
<http://spinrdf.org/arg#wellBoreId>
rdf:type rdf:Property ;
rdfs:label "well bore id"^^xsd:string ;
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> , <http://www.reportinghub.no/system/schema/reporting> ;
owl:versionInfo "0.1.0"^^xsd:string .
reportspin:graphByDDRId
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 DDRId"^^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 <http://spinrdf.org/arg#id> ;
spl:valueType xsd:string
] ;
spin:returnType rdfs:Resource .
reportspin:idOfDDRByDateAndWellBoreId
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
]
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The id of the well bore."^^xsd:string ;
spl:predicate <http://spinrdf.org/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 <http://spinrdf.org/arg#date> ;
spl:valueType xsd:date
] ;
spin:returnType xsd:string .