Holger Knublauch

Adjusted constraints to new ontologies

Added normalization to wellBoreByName function
# 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
# 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
# imports: http://www.topbraid.org/2007/05/composite.owl
# imports: http://www.witsml.org/schemas/1series
@prefix : <http://www.reportinghub.no/ep/spin/ddr-constraints#> .
@prefix arg: <http://spinrdf.org/arg#> .
......@@ -28,7 +20,33 @@
@prefix witsml: <http://www.witsml.org/schemas/1series#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
ddr:Obj_drillReport
<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://spinrdf.org/spin> , <http://topbraid.org/sxml> , <http://www.reportinghub.no/np/schema/1.0/npd> , <http://www.reportinghub.no/spin/rh> , <http://www.witsml.org/schemas/1series> ;
owl:versionInfo "0.2.0"^^xsd:string .
witsml:Obj_drillReport
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
[ sp:varName "companyName"^^xsd:string
]
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:not ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 [ sp:varName "companyName"^^xsd:string
]
]
]
])
] ;
spin:constraint
[ rdf:type sp:Construct ;
sp:templates ([ sp:object spin:ConstraintViolation ;
......@@ -37,36 +55,36 @@ ddr:Obj_drillReport
] [ sp:object spin:_this ;
sp:predicate spin:violationRoot ;
sp:subject _:b1
] [ sp:object ddr:nameWell ;
] [ sp:object witsml:nameWell ;
sp:predicate spin:violationPath ;
sp:subject _:b1
] [ sp:object _:b2 ;
] [ sp:object
[ sp:varName "message"^^xsd:string
] ;
sp:predicate rdfs:label ;
sp:subject _:b1
]) ;
sp:where ([ sp:object _:b3 ;
sp:predicate <http://www.topbraid.org/2007/05/composite.owl#child> ;
sp:where ([ sp:object
[ sp:varName "wellName"^^xsd:string
] ;
sp:predicate witsml:nameWell ;
sp:subject spin:_this
] [ 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 ;
arg:wellName _:b5
arg:wellName
[ sp:varName "wellName"^^xsd:string
]
] ;
sp:variable _:b6
sp:variable
[ sp:varName "well"^^xsd:string
]
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:not ;
sp:arg1 [ rdf:type rhspin:npdTripleExists ;
sp:arg1 _:b6 ;
sp:arg1 [ sp:varName "well"^^xsd:string
] ;
sp:arg2 rdf:type ;
sp:arg3 <http://www.reportinghub.no/ep/schema/well#Well>
]
......@@ -75,25 +93,11 @@ ddr:Obj_drillReport
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "Unregistered well name " ;
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
sp:arg2 [ sp:varName "wellName"^^xsd:string
]
] ;
sp:variable
[ sp:varName "message"^^xsd:string
]
])
] ;
......@@ -101,80 +105,51 @@ ddr:Obj_drillReport
[ rdf:type sp:Construct ;
sp:templates ([ sp:object spin:ConstraintViolation ;
sp:predicate rdf:type ;
sp:subject _:b8
sp:subject _:b2
] [ sp:object spin:_this ;
sp:predicate spin:violationRoot ;
sp:subject _:b8
] [ sp:object ddr:nameWellbore ;
sp:subject _:b2
] [ sp:object witsml:nameWellbore ;
sp:predicate spin:violationPath ;
sp:subject _:b8
] [ sp:object _:b9 ;
sp:subject _:b2
] [ sp:object
[ sp:varName "message"^^xsd:string
] ;
sp:predicate rdfs:label ;
sp:subject _:b8
sp:subject _:b2
]) ;
sp:where ([ sp:object _:b10 ;
sp:predicate <http://www.topbraid.org/2007/05/composite.owl#child> ;
sp:where ([ sp:object
[ sp:varName "wellBoreName"^^xsd:string
] ;
sp:predicate witsml:nameWellbore ;
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 ;
arg:wellBoreName _:b12
arg:wellBoreName
[ sp:varName "wellBoreName"^^xsd:string
]
] ;
sp:variable _:b13
sp:variable
[ sp:varName "wellBore"^^xsd:string
]
] [ rdf:type sp:Filter ;
sp:expression
[ rdf:type sp:not ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 _:b13
sp:arg1 [ sp:varName "wellBore"^^xsd:string
]
]
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "Unregistered well bore name " ;
sp:arg2 _:b12
sp:arg2 [ sp:varName "wellBoreName"^^xsd:string
]
] ;
sp:variable _:b9
sp:variable
[ sp:varName "message"^^xsd:string
]
])
] .
<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://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 .
_: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 .
_:b13
sp:varName "wellBore"^^xsd:string .
_:b12
sp:varName "wellBoreName"^^xsd:string .
_:b11
sp:varName "cc"^^xsd:string .
_:b10
sp:varName "child"^^xsd:string .
......
# Saved by TopBraid on Thu Sep 15 16:25:34 BST 2011
# baseURI: http://www.reportinghub.no/ep/spin/report-constraints
# 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://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/equipment
# imports: http://www.reportinghub.no/ep/schema/1.0/activity
# 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://spinrdf.org/spin
# imports: http://www.reportinghub.no/spin/rh
@prefix : <http://www.reportinghub.no/ep/spin/report-constraints#> .
......@@ -35,7 +34,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> ;
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/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
......@@ -64,7 +63,7 @@
sp:path [ rdf:type sp:SeqPath ;
sp:path1
[ rdf:type sp:SeqPath ;
sp:path1 <http://www.reportinghub.no/ep/schema/activity#reportOn> ;
sp:path1 <http://www.reportinghub.no/ep/schema/report#reportOn> ;
sp:path2 <http://www.reportinghub.no/ep/schema/activity#onWellBore>
] ;
sp:path2 <http://www.reportinghub.no/ep/schema/core#temporalPartOf>
......
......@@ -99,15 +99,15 @@ arg:wellName
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The value to match against."^^xsd:string ;
spl:predicate sp:arg1
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The property that must be used in the result resource."^^xsd:string ;
spl:predicate <http://topbraid.org/spin/spinmapl#predicate> ;
spl:valueType rdf:Property
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The value to match against."^^xsd:string ;
spl:predicate sp:arg1
] ;
spin:returnType rdfs:Resource .
npdata:npd
......@@ -634,15 +634,15 @@ rhspin:dtypeValue
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The predicate that points to the reified value."^^xsd:string ;
spl:predicate sp:arg2 ;
spl:valueType rdf:Property
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The subject of the value."^^xsd:string ;
spl:predicate sp:arg1 ;
spl:valueType rdfs:Resource
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The predicate that points to the reified value."^^xsd:string ;
spl:predicate sp:arg2 ;
spl:valueType rdf:Property
] .
rhspin:facilityById
......@@ -1222,8 +1222,9 @@ rhspin:npdTripleExists
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The object to match."^^xsd:string ;
spl:predicate sp:arg3
rdfs:comment "The subject to find"^^xsd:string ;
spl:predicate sp:arg1 ;
spl:valueType rdfs:Resource
] ;
spin:constraint
[ rdf:type spl:Argument ;
......@@ -1233,9 +1234,8 @@ rhspin:npdTripleExists
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The subject to find"^^xsd:string ;
spl:predicate sp:arg1 ;
spl:valueType rdfs:Resource
rdfs:comment "The object to match."^^xsd:string ;
spl:predicate sp:arg3
] ;
spin:returnType xsd:boolean .
......@@ -1341,16 +1341,30 @@ rhspin:wellBoreByName
rdfs:subClassOf spl:URIFunctions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables (_:b32) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:resultVariables ([ sp:varName "wellBore"^^xsd:string
]) ;
sp:where ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:normalizeWellBoreName ;
sp:arg1 [ sp:varName "wellBoreName"^^xsd:string
]
] ;
sp:variable
[ sp:varName "name"^^xsd:string
]
] [ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object
[ sp:varName "wellBoreName"^^xsd:string
[ sp:varName "name"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject _:b32
sp:subject
[ sp:varName "wellBore"^^xsd:string
]
] [ sp:object <http://www.reportinghub.no/ep/schema/well#WellBore> ;
sp:predicate rdf:type ;
sp:subject _:b32
sp:subject
[ sp:varName "wellBore"^^xsd:string
]
]) ;
sp:graphNameNode npdata:npd
])
......@@ -1389,89 +1403,86 @@ rhspin:wellByName
] ;
spin:returnType <http://www.reportinghub.no/ep/schema/well#Well> .
_:b1 sp:varName "subject"^^xsd:string .
_:b2 sp:varName "wellBoreName"^^xsd:string .
_:b31
sp:varName "name"^^xsd:string .
_:b3 sp:varName "wellBoreId"^^xsd:string .
_:b30
sp:varName "id"^^xsd:string .
_:b4 sp:varName "wellBore"^^xsd:string .
_:b29
sp:varName "t4"^^xsd:string .
_:b5 sp:varName "wellName"^^xsd:string .
_:b28
sp:varName "t3"^^xsd:string .
_:b6 sp:varName "well"^^xsd:string .
_:b27
sp:varName "t2"^^xsd:string .
_:b7 sp:varName "company"^^xsd:string .
_:b26
sp:varName "t1"^^xsd:string .
_:b8 sp:varName "wellBore"^^xsd:string .
_:b25
sp:varName "t0b"^^xsd:string .
_:b9 sp:varName "licence"^^xsd:string .
_:b24
sp:varName "t0a"^^xsd:string .
_:b10
sp:varName "share"^^xsd:string .
_:b23
sp:varName "s2"^^xsd:string .
_:b11
sp:varName "wellBore"^^xsd:string .
_:b22
sp:varName "s1"^^xsd:string .
_:b12
sp:varName "share"^^xsd:string .
_:b21
sp:varName "normalizedStr"^^xsd:string .
_:b13
_:b20
sp:varName "licence"^^xsd:string .
_:b14
sp:varName "company"^^xsd:string .
_:b15
sp:varName "companyName"^^xsd:string .
_:b19
sp:varName "reif"^^xsd:string .
_:b16
sp:varName "company"^^xsd:string .
_:b18
sp:varName "value"^^xsd:string .
_:b17
sp:varName "wellBore"^^xsd:string .
_:b18
sp:varName "value"^^xsd:string .
_:b16
sp:varName "company"^^xsd:string .
_:b19
sp:varName "reif"^^xsd:string .
_:b15
sp:varName "companyName"^^xsd:string .
_:b20
_:b14
sp:varName "company"^^xsd:string .
_:b13
sp:varName "licence"^^xsd:string .
_:b21
sp:varName "normalizedStr"^^xsd:string .
_:b12
sp:varName "share"^^xsd:string .
_:b22
sp:varName "s1"^^xsd:string .
_:b11
sp:varName "wellBore"^^xsd:string .
_:b23
sp:varName "s2"^^xsd:string .
_:b10
sp:varName "share"^^xsd:string .
_:b24
sp:varName "t0a"^^xsd:string .
_:b9 sp:varName "licence"^^xsd:string .
_:b25
sp:varName "t0b"^^xsd:string .
_:b8 sp:varName "wellBore"^^xsd:string .
_:b26
sp:varName "t1"^^xsd:string .
_:b7 sp:varName "company"^^xsd:string .
_:b27
sp:varName "t2"^^xsd:string .
_:b6 sp:varName "well"^^xsd:string .
_:b28
sp:varName "t3"^^xsd:string .
_:b5 sp:varName "wellName"^^xsd:string .
_:b29
sp:varName "t4"^^xsd:string .
_:b4 sp:varName "wellBore"^^xsd:string .
_:b30
sp:varName "id"^^xsd:string .
_:b3 sp:varName "wellBoreId"^^xsd:string .
_:b31
sp:varName "name"^^xsd:string .
_:b2 sp:varName "wellBoreName"^^xsd:string .
_:b32
sp:varName "wellBore"^^xsd:string .
_:b1 sp:varName "subject"^^xsd:string .
......