Holger Knublauch

Fixed well/bore constraints

Added constraints for licence checking
Removed header (moved to Sources project)
# baseURI: http://www.reportinghub.no/ep/spin/ddr-constraints
# imports: http://spinrdf.org/spin
# imports: http://topbraid.org/sxml
# imports: http://www.reportinghub.no/ep/schema/1.0/activity
# imports: http://www.reportinghub.no/ep/schema/1.0/core
# imports: http://www.reportinghub.no/ep/schema/1.0/ddr
......@@ -9,10 +10,14 @@
# imports: http://www.reportinghub.no/ep/schema/1.0/report
# imports: http://www.reportinghub.no/ep/schema/1.0/well
# imports: http://www.reportinghub.no/np/schema/1.0/npd
# imports: http://www.reportinghub.no/spin/rh
# imports: http://www.topbraid.org/2007/05/composite.owl
@prefix : <http://www.reportinghub.no/ep/spin/ddr-constraints#> .
@prefix arg: <http://spinrdf.org/arg#> .
@prefix ddr: <http://www.reportinghub.no/ep/schema/ddr#> .
@prefix fn: <http://www.w3.org/2005/xpath-functions#> .
@prefix normalization: <http://www.reportinghub.no/ep/transform/1.1/normalization#> .
@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#> .
......@@ -20,6 +25,7 @@
@prefix sp: <http://spinrdf.org/sp#> .
@prefix spin: <http://spinrdf.org/spin#> .
@prefix spl: <http://spinrdf.org/spl#> .
@prefix witsml: <http://www.witsml.org/schemas/1series#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
ddr:Obj_drillReport
......@@ -39,86 +45,136 @@ ddr:Obj_drillReport
sp:subject _:b1
]) ;
sp:where ([ sp:object _:b3 ;
sp:predicate ddr:nameWell ;
sp:predicate <http://www.topbraid.org/2007/05/composite.owl#child> ;
sp:subject spin:_this
] [ rdf:type sp:NamedGraph ;
sp:elements ([ rdf:type sp:NotExists ;
sp:elements ([ rdf:type sp:Bind ;
] [ sp:object witsml:nameWell ;
sp:predicate rdf:type ;
sp:subject _:b3
] [ sp:object _:b4 ;
sp:predicate <http://www.topbraid.org/2007/05/composite.owl#child> ;
sp:subject _:b3
] [ sp:object _:b5 ;
sp:predicate <http://topbraid.org/sxml#text> ;
sp:subject _:b4
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:wellByName ;
sp:arg1 _:b3
arg:wellName _:b5
] ;
sp:variable _:b4
] [ sp:object <http://www.reportinghub.no/ep/schema/well#Well> ;
sp:predicate rdf:type ;
sp:subject _:b4
])
]) ;
sp:graphNameNode <http://www.reportinghub.no/np/data/npd>
sp:variable _:b6
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:not ;
sp:arg1 [ rdf:type rhspin:npdTripleExists ;
sp:arg1 _:b6 ;
sp:arg2 rdf:type ;
sp:arg3 <http://www.reportinghub.no/ep/schema/well#Well>
]
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "Unregistered well name " ;
sp:arg2 _:b3
sp:arg2 _:b5
] ;
sp:variable _:b2
])
] ;
spin:constraint
[ rdf:type sp:Ask ;
rdfs:comment "DDRs can only be submitted if a user is logged in"^^xsd:string ;
sp:where ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:companyName
] ;
sp:variable _:b7
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:not ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 _:b7
]
]
])
] ;
spin:constraint
[ rdf:type sp:Construct ;
sp:templates ([ sp:object spin:ConstraintViolation ;
sp:predicate rdf:type ;
sp:subject _:b5
sp:subject _:b8
] [ sp:object spin:_this ;
sp:predicate spin:violationRoot ;
sp:subject _:b5
sp:subject _:b8
] [ sp:object ddr:nameWellbore ;
sp:predicate spin:violationPath ;
sp:subject _:b5
] [ sp:object _:b6 ;
sp:subject _:b8
] [ sp:object _:b9 ;
sp:predicate rdfs:label ;
sp:subject _:b5
sp:subject _:b8
]) ;
sp:where ([ sp:object _:b7 ;
sp:predicate ddr:nameWellbore ;
sp:where ([ sp:object _:b10 ;
sp:predicate <http://www.topbraid.org/2007/05/composite.owl#child> ;
sp:subject spin:_this
] [ sp:object witsml:nameWellbore ;
sp:predicate rdf:type ;
sp:subject _:b10
] [ sp:object _:b11 ;
sp:predicate <http://www.topbraid.org/2007/05/composite.owl#child> ;
sp:subject _:b10
] [ sp:object _:b12 ;
sp:predicate <http://topbraid.org/sxml#text> ;
sp:subject _:b11
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:wellBoreByName ;
sp:arg1 _:b7
arg:wellBoreName _:b12
] ;
sp:variable _:b8
sp:variable _:b13
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:not ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 _:b8
sp:arg1 _:b13
]
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "Unregistered well bore name " ;
sp:arg2 _:b7
sp:arg2 _:b12
] ;
sp:variable _:b6
sp:variable _:b9
])
] .
<http://www.reportinghub.no/ep/spin/ddr-constraints>
rdf:type owl:Ontology ;
rdfs:comment "Constraints that need to be executed immediately after SXML import, i.e. not on the inferred triples."^^xsd:string ;
owl:imports <http://www.reportinghub.no/np/schema/1.0/npd> , <http://www.reportinghub.no/ep/schema/1.0/equipment> , <http://www.reportinghub.no/ep/schema/1.0/well> , <http://www.reportinghub.no/ep/schema/1.0/ddr> , <http://www.reportinghub.no/ep/schema/1.0/activity> , <http://www.reportinghub.no/ep/schema/1.0/facility> , <http://www.reportinghub.no/ep/schema/1.0/report> , <http://www.reportinghub.no/ep/schema/1.0/organization> , <http://www.reportinghub.no/ep/schema/1.0/core> , <http://spinrdf.org/spin> ;
owl:imports <http://www.reportinghub.no/np/schema/1.0/npd> , <http://topbraid.org/sxml> , <http://www.reportinghub.no/ep/schema/1.0/equipment> , <http://www.reportinghub.no/ep/schema/1.0/well> , <http://www.reportinghub.no/ep/schema/1.0/ddr> , <http://www.reportinghub.no/spin/rh> , <http://www.reportinghub.no/ep/schema/1.0/activity> , <http://www.reportinghub.no/ep/schema/1.0/facility> , <http://www.reportinghub.no/ep/schema/1.0/report> , <http://www.topbraid.org/2007/05/composite.owl> , <http://www.reportinghub.no/ep/schema/1.0/organization> , <http://www.reportinghub.no/ep/schema/1.0/core> , <http://spinrdf.org/spin> ;
owl:versionInfo "0.1.0"^^xsd:string .
_:b7 sp:varName "companyName"^^xsd:string .
_:b2 sp:varName "message"^^xsd:string .
_:b4 sp:varName "well"^^xsd:string .
_:b6 sp:varName "well"^^xsd:string .
_:b5 sp:varName "wellName"^^xsd:string .
_:b4 sp:varName "cc"^^xsd:string .
_:b3 sp:varName "child"^^xsd:string .
_:b9 sp:varName "message"^^xsd:string .
_:b3 sp:varName "nameWell"^^xsd:string .
_:b13
sp:varName "wellBore"^^xsd:string .
_:b6 sp:varName "message"^^xsd:string .
_:b12
sp:varName "wellBoreName"^^xsd:string .
_:b8 sp:varName "wellBore"^^xsd:string .
_:b11
sp:varName "cc"^^xsd:string .
_:b7 sp:varName "nameWellbore"^^xsd:string .
_:b10
sp:varName "child"^^xsd:string .
......
# baseURI: http://www.reportinghub.no/ep/spin/report-constraints
# imports: http://spinrdf.org/spin
# imports: http://www.reportinghub.no/ep/schema/1.0/activity
# imports: http://www.reportinghub.no/ep/schema/1.0/core
# imports: http://www.reportinghub.no/ep/schema/1.0/ddr
# imports: http://www.reportinghub.no/ep/schema/1.0/equipment
# imports: http://www.reportinghub.no/ep/schema/1.0/facility
# imports: http://www.reportinghub.no/ep/schema/1.0/organization
# imports: http://www.reportinghub.no/ep/schema/1.0/report
# imports: http://www.reportinghub.no/ep/schema/1.0/well
# imports: http://www.reportinghub.no/np/schema/1.0/npd
# imports: http://www.reportinghub.no/spin/rh
@prefix : <http://www.reportinghub.no/ep/spin/report-constraints#> .
@prefix arg: <http://spinrdf.org/arg#> .
@prefix ddr: <http://www.reportinghub.no/ep/schema/ddr#> .
@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 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#> .
<http://www.reportinghub.no/ep/schema/report#DailyDrillingReport>
spin:constraint
[ rdf:type sp:Construct ;
sp:templates ([ sp:object spin:ConstraintViolation ;
sp:predicate rdf:type ;
sp:subject _:b1
] [ sp:object spin:_this ;
sp:predicate spin:violationRoot ;
sp:subject _:b1
] [ sp:object _:b2 ;
sp:predicate rdfs:label ;
sp:subject _:b1
]) ;
sp:where ([ rdf:type sp:TriplePath ;
sp:object _:b3 ;
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 spin:_this
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:companyName
] ;
sp:variable _:b4
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:companyWithName ;
arg:name _:b4
] ;
sp:variable _:b5
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:bound ;
sp:arg1 _:b5
]
] [ rdf:type sp:NotExists ;
sp:elements ([ sp:object _:b3 ;
sp:predicate rhspin:companyHasLicenceForWellBore ;
sp:subject _:b5
])
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "Your company (" ;
sp:arg2 _:b4 ;
sp:arg3 ") does not hold a licence for well bore " ;
sp:arg4 [ rdf:type rhspin:npdName ;
arg:resource _:b3
]
] ;
sp:variable _:b2
])
] .
<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:versionInfo "0.1.0"^^xsd:string .
_:b2 sp:varName "message"^^xsd:string .
_:b3 sp:varName "wellBore"^^xsd:string .
_:b4 sp:varName "companyName"^^xsd:string .
_:b5 sp:varName "company"^^xsd:string .
......@@ -700,6 +700,40 @@ rhspin:npdName
] ;
spin:returnType xsd:string .
rhspin:npdTripleExists
rdf:type spin:Function ;
rdfs:comment "Checks whether the NPD graph contains a given triple (?arg1, ?arg2, ?arg3)."^^xsd:string ;
rdfs:label "NPD triple exists"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Ask ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object spin:_arg3 ;
sp:predicate spin:_arg2 ;
sp:subject spin:_arg1
]) ;
sp:graphNameNode npdata:npd
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The object to match."^^xsd:string ;
spl:predicate sp:arg3
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The predicate to match."^^xsd:string ;
spl:predicate sp:arg2 ;
spl:valueType rdf:Property
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The subject to find"^^xsd:string ;
spl:predicate sp:arg1 ;
spl:valueType rdfs:Resource
] ;
spin:returnType xsd:boolean .
rhspin:parentCompanyByName
rdf:type spin:Function ;
rdfs:comment "Gets the URI resource of a parent company based on its NPD name."^^xsd:string ;
......@@ -797,22 +831,11 @@ rhspin:wellBoreByName
[ rdf:type sp:Select ;
sp:resultVariables (_:b32) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ rdf:type sp:Union ;
sp:elements (([ sp:object _:b33 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject _:b32
]) ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:replaceAll ;
sp:arg1 _:b33 ;
sp:arg2 "/0" ;
sp:arg3 "/"
sp:elements ([ sp:object
[ sp:varName "wellBoreName"^^xsd:string
] ;
sp:variable _:b34
] [ sp:object _:b34 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject _:b32
]))
] [ sp:object <http://www.reportinghub.no/ep/schema/well#WellBore> ;
sp:predicate rdf:type ;
sp:subject _:b32
......@@ -854,21 +877,6 @@ 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 .
_:b34
sp:varName "str"^^xsd:string .
_:b33
sp:varName "wellBoreName"^^xsd:string .
_:b32
sp:varName "wellBore"^^xsd:string .
......@@ -914,6 +922,15 @@ _:b19
_:b18
sp:varName "value"^^xsd:string .
_:b17
sp:varName "wellBore"^^xsd:string .
_:b16
sp:varName "id"^^xsd:string .
_:b15
sp:varName "startedAt"^^xsd:string .
_:b14
sp:varName "company"^^xsd:string .
......
<ui:group>
<div>&nbsp;</div>
<div class="logoContainer"><a href="http://www.epim.no" target="_new"><img src="lib/rh/images/logoEpim.gif" width="201" height="106" align="right" title="EPIM" /></a>
<div style="padding: 10px">
<h1>ReportingHub</h1>
<div>You are logged in as: <b>{= rhspin:userName() }</b></div>
</div>
</div>
</ui:group>
\ No newline at end of file