MonkeyChap

First load - put these up here in case anyone wants to make use of

them.
# Saved by TopBraid on Thu Aug 04 09:37:09 BST 2011
# baseURI: http://www.reportinghub.no/1.1/schema/NPD-to-15926
# imports: http://topbraid.org/spin/spinmapl
# imports: http://spinrdf.org/spin
# imports: http://www.reportinghub.no/1.1/schema/npd
# imports: http://rds.posccaesar.org/2008/06/OWL/RDL
@prefix afn: <http://jena.hpl.hp.com/ARQ/function#> .
@prefix dm: <http://rds.posccaesar.org/2008/02/OWL/ISO-15926-2_2003#> .
@prefix npd: <http://www.reportinghub.no/schema/npd#> .
@prefix npdMap: <http://www.reportinghub.no/1.1/schema/NPD-to-15926#> .
@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 rdl: <http://rds.posccaesar.org/2008/06/OWL/RDL#> .
@prefix smf: <http://topbraid.org/sparqlmotionfunctions#> .
@prefix sp: <http://spinrdf.org/sp#> .
@prefix spif: <http://spinrdf.org/spif#> .
@prefix spin: <http://spinrdf.org/spin#> .
@prefix spl: <http://spinrdf.org/spl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://www.reportinghub.no/1.1/schema/NPD-to-15926>
rdf:type owl:Ontology ;
owl:imports <http://rds.posccaesar.org/2008/06/OWL/RDL> , <http://www.reportinghub.no/1.1/schema/npd> , <http://topbraid.org/spin/spinmapl> , <http://spinrdf.org/spin> ;
owl:versionInfo "Created with TopBraid Composer"^^xsd:string .
npdMap:ClassifyArrangedIndividual
rdf:type spin:ConstructTemplate ;
rdfs:comment """?AI is the Arranged_Individual that is the wellbore
?AIClsn is the classification relationship from ?ai to the RDL entry for Wellbore - RDS1714464911"""^^xsd:string ;
rdfs:subClassOf spin:ConstructTemplates ;
spin:body
[ rdf:type sp:Construct ;
rdfs:comment """?AI is the Arranged_Individual that is the wellbore
?AIClsn is the classification relationship from ?ai to the RDL entry referred to by arg1"""^^xsd:string ;
sp:templates ([ sp:object dm:ArrangedIndividual ;
sp:predicate rdf:type ;
sp:subject _:b1
] [ sp:object dm:Classification ;
sp:predicate rdf:type ;
sp:subject _:b2
] [ sp:object _:b1 ;
sp:predicate dm:hasClassified ;
sp:subject _:b2
] [ sp:object spin:_arg1 ;
sp:predicate dm:hasClassifier ;
sp:subject _:b2
]) ;
sp:where ([ sp:object _:b3 ;
sp:predicate rdf:type ;
sp:subject spin:_this
] [ sp:object
[ sp:varName "npdid"^^xsd:string
] ;
sp:predicate npd:id ;
sp:subject spin:_this
] [ rdf:type sp:Bind ;
sp:expression "http://www.reportinghub.no/ep/" ;
sp:variable
[ sp:varName "base"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:buildURI ;
sp:arg1 [ rdf:type sp:add ;
sp:arg1 [ rdf:type sp:add ;
sp:arg1 "<{?base}" ;
sp:arg2 [ rdf:type afn:localname ;
sp:arg1 _:b3
]
] ;
sp:arg2 "AI-{?npdid}>"
]
] ;
sp:variable _:b1
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type smf:buildURI ;
sp:arg1 [ rdf:type sp:add ;
sp:arg1 [ rdf:type sp:add ;
sp:arg1 "<{?base}" ;
sp:arg2 [ rdf:type afn:localname ;
sp:arg1 _:b3
]
] ;
sp:arg2 "AIClsn-{?npdid}>"
]
] ;
sp:variable _:b2
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
spl:predicate sp:arg1 ;
spl:valueType owl:Thing
] ;
spin:labelTemplate """?AI is the Arranged_Individual that is the wellbore
?AIClsn is the classification relationship from ?ai to the RDL entry referred to by arg1"""^^xsd:string .
npdMap:CreateIndividualWithNPDID
rdf:type spin:ConstructTemplate ;
rdfs:comment """?Arg1 is the type of object - e.g. \"WellBore\", \"Licence\", etc.?AI is the Arranged_Individual
?npdExpStr is the Express_string that holds the NPDID text
?npdCOI is the class of Identification relating ?ai to ?npdExpStr
?npdCOIClsn is classification relationship from ?npdCOI to the RDL entry for NPD Identifier - RDS487765302
?wbIDExpStr is the Express_string that holds the wellbore id code
?wbCOI is the class of Identification relating ?ai to ?wbIDExpStr
?wbIDCOIClsn is classification relationship from ?wbCOI to the RDL entry for wellbore identification code - RDS16622067"""^^xsd:string ;
rdfs:subClassOf spin:ConstructTemplates ;
spin:body
[ rdf:type sp:Construct ;
rdfs:comment """?Arg1 is the type of object - e.g. \"WellBore\", \"Licence\", etc.
?AI is the Arranged_Individual
?npdExpStr is the Express_string that holds the NPDID text
?npdCOI is the class of Identification relating ?ai to ?npdExpStr
?npdCOIClsn is classification relationship from ?npdCOI to the RDL entry for NPD Identifier - RDS487765302
?wbIDExpStr is the Express_string that holds the wellbore id code
?wbCOI is the class of Identification relating ?ai to ?wbIDExpStr
?wbIDCOIClsn is classification relationship from ?wbCOI to the RDL entry for wellbore identification code - RDS16622067"""^^xsd:string ;
sp:templates ([ sp:object dm:ArrangedIndividual ;
sp:predicate rdf:type ;
sp:subject _:b4
] [ sp:object dm:ClassOfIdentification ;
sp:predicate rdf:type ;
sp:subject _:b5
] [ sp:object _:b4 ;
sp:predicate dm:hasRepresented ;
sp:subject _:b5
] [ sp:object dm:ExpressString ;
sp:predicate rdf:type ;
sp:subject _:b6
] [ sp:object _:b6 ;
sp:predicate dm:hasPattern ;
sp:subject _:b5
] [ sp:object dm:Classification ;
sp:predicate rdf:type ;
sp:subject _:b7
] [ sp:object _:b5 ;
sp:predicate dm:hasClassified ;
sp:subject _:b7
] [ sp:object rdl:RDS487765302 ;
sp:predicate dm:hasClassifier ;
sp:subject _:b7
] [ sp:object _:b8 ;
sp:predicate dm:hasContent ;
sp:subject _:b6
]) ;
sp:where ([ sp:object _:b8 ;
sp:predicate npd:id ;
sp:subject spin:_this
] [ sp:object _:b9 ;
sp:predicate rdf:type ;
sp:subject spin:_this
] [ rdf:type sp:Bind ;
sp:expression "http://www.reportinghub.no/ep/" ;
sp:variable
[ sp:varName "base"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:buildURI ;
sp:arg1 [ rdf:type sp:add ;
sp:arg1 [ rdf:type sp:add ;
sp:arg1 "<{?base}" ;
sp:arg2 [ rdf:type afn:localname ;
sp:arg1 _:b9
]
] ;
sp:arg2 "AI-{?npdid}>"
]
] ;
sp:variable _:b4
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:buildURI ;
sp:arg1 [ rdf:type sp:add ;
sp:arg1 [ rdf:type sp:add ;
sp:arg1 "<{?base}" ;
sp:arg2 [ rdf:type afn:localname ;
sp:arg1 _:b9
]
] ;
sp:arg2 "CoINPDID-{?npdid}>"
]
] ;
sp:variable _:b5
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:buildURI ;
sp:arg1 [ rdf:type sp:add ;
sp:arg1 [ rdf:type sp:add ;
sp:arg1 "<{?base}" ;
sp:arg2 [ rdf:type afn:localname ;
sp:arg1 _:b9
]
] ;
sp:arg2 "CoINPDIDClsn-{?npdid}>"
]
] ;
sp:variable _:b7
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type spif:buildURI ;
sp:arg1 [ rdf:type sp:add ;
sp:arg1 [ rdf:type sp:add ;
sp:arg1 "<{?base}" ;
sp:arg2 [ rdf:type afn:localname ;
sp:arg1 _:b9
]
] ;
sp:arg2 "NPDIDExpressString-{?npdid}>"
]
] ;
sp:variable _:b6
])
] ;
spin:labelTemplate """?AI is the Arranged_Individual that is the wellbore
?npdExpStr is the Express_string that holds the NPDID text
?npdCOI is the class of Identification relating ?ai to ?npdExpStr
?npdCOIClsn is classification relationship from ?npdCOI to the RDL entry for NPD Identifier - RDS487765302
?wbIDExpStr is the Express_string that holds the wellbore id code
?wbCOI is the class of Identification relating ?ai to ?wbIDExpStr
?wbIDCOIClsn is classification relationship from ?wbCOI to the RDL entry for wellbore identification code - RDS16622067"""^^xsd:string .
npdMap:Licence_1
rdf:type npd:Licence ;
npd:id "ABC123"^^xsd:string .
npd:NpdIndividual
spin:rule
[ rdf:type npdMap:CreateIndividualWithNPDID ;
sp:arg1 "\"Individual\""^^xsd:string
] .
npd:WellBore
spin:rule
[ rdf:type sp:Construct ;
rdfs:comment """This rule creates the WellBore and Well and joins them up using a composition relationship (dm:ArrangementOfIndividual)
Note that because it uses the same URI production rule as other functions, we don't get repeated instances of the Well and WellBore...hopefully"""^^xsd:string ;
sp:templates ([ sp:object dm:ArrangedIndividual ;
sp:predicate rdf:type ;
sp:subject _:b10
] [ sp:object dm:ArrangedIndividual ;
sp:predicate rdf:type ;
sp:subject _:b11
] [ sp:object dm:ArrangementOfIndividual ;
sp:predicate rdf:type ;
sp:subject _:b12
] [ sp:object _:b11 ;
sp:predicate dm:hasWhole ;
sp:subject _:b12
] [ sp:object _:b10 ;
sp:predicate dm:hasPart ;
sp:subject _:b12
]) ;
sp:where ([ sp:object
[ sp:varName "npdid"^^xsd:string
] ;
sp:predicate npd:id ;
sp:subject spin:_this
] [ sp:object _:b13 ;
sp:predicate npd:partOfWell ;
sp:subject spin:_this
] [ sp:object
[ sp:varName "wellName"^^xsd:string
] ;
sp:predicate npd:name ;
sp:subject _:b13
] [ rdf:type sp:Bind ;
sp:expression "http://www.reportinghub.no/ep/" ;
sp:variable
[ sp:varName "base"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type smf:buildURI ;
sp:arg1 "<{?base}WellAI-{?wellName}>"
] ;
sp:variable _:b11
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type smf:buildURI ;
sp:arg1 "<{?base}WellBoreAI-{?npdid}>"
] ;
sp:variable _:b10
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type smf:buildURI ;
sp:arg1 "<{?base}WellBoreComposition-{?npdid}>"
] ;
sp:variable _:b12
])
] ;
spin:rule
[ rdf:type npdMap:ClassifyArrangedIndividual
] .
npd:WellBore_1
npd:drilledInProductionLicence
npdMap:Licence_1 .
npd:wellDiskosType
rdf:type owl:DatatypeProperty ;
rdfs:comment "Corresponds to DISKOS Type field in WellBore tables"^^xsd:string ;
rdfs:domain npd:Well ;
rdfs:range xsd:string .
_:b13
sp:varName "well"^^xsd:string .
_:b12
sp:varName "wellBoreComp"^^xsd:string .
_:b11
sp:varName "wellAI"^^xsd:string .
_:b10
sp:varName "wellBoreAI"^^xsd:string .
_:b9 sp:varName "npdType"^^xsd:string .
_:b8 sp:varName "npdid"^^xsd:string .
_:b7 sp:varName "npdCOIClsn"^^xsd:string .
_:b6 sp:varName "npdExpStr"^^xsd:string .
_:b5 sp:varName "npdCOI"^^xsd:string .
_:b4 sp:varName "AI"^^xsd:string .
_:b3 sp:varName "npdType"^^xsd:string .
_:b2 sp:varName "AIClsn"^^xsd:string .
_:b1 sp:varName "AI"^^xsd:string .