TRANSFORM_SPREADSHEETS-to-NPD.ttl 6.86 KB
# baseURI: http://www.reportinghub.no/transform/spreadsheets2npd
# imports: http://topbraid.org/spin/spinmapl
# imports: file:///www.reportinghub.no/transform/wellbore-npdid-overview-2011-07-30
# imports: file:///www.reportinghub.no/transform/wellbore-npdid-overview
# imports: http://spinrdf.org/spin
# imports: http://www.reportinghub.no/1.1/schema/npd
# imports: http://www.reportinghub.no/spin/rh

@prefix :        <http://www.reportinghub.no/transform/spreadsheets2npd#> .
@prefix arg:     <http://spinrdf.org/arg#> .
@prefix npdi:    <https://www.reportinghub.no/data/npd/> .
@prefix npdi1:   <http://www.reportinghub.no/examples/npdi#> .
@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 spinmap:  <http://spinrdf.org/spinmap#> .
@prefix spl:     <http://spinrdf.org/spl#> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .

<file:///www.reportinghub.no/transform/wellbore-npdid-overview#WBID>
      spinmap:rule
              [ rdf:type spinmap:Mapping-0-1 ;
                spinmap:context :WBID-WellBore ;
                spinmap:expression <http://www.reportinghub.no/schema/npd#WellBore> ;
                spinmap:targetPredicate1
                        rdf:type
              ] ;
      spinmap:rule
              [ rdf:type spinmap:Mapping-1-1 ;
                spinmap:context :WBID-WellBore ;
                spinmap:expression spin:_arg1 ;
                spinmap:sourcePredicate1
                        <file:///www.reportinghub.no/transform/wellbore-npdid-overview#wlbNpdidWellbore> ;
                spinmap:targetPredicate1
                        <http://www.reportinghub.no/schema/npd#id>
              ] ;
      spinmap:rule
              [ rdf:type spinmap:Mapping-1-1 ;
                spinmap:context :WBID-WellBore ;
                spinmap:expression spin:_arg1 ;
                spinmap:sourcePredicate1
                        <file:///www.reportinghub.no/transform/wellbore-npdid-overview#wlbWellType> ;
                spinmap:targetPredicate1
                        <http://www.reportinghub.no/schema/npd#wellBoreType>
              ] ;
      spinmap:rule
              [ rdf:type spinmap:Mapping-1-1 ;
                spinmap:context :WBID-WellBore ;
                spinmap:expression spin:_arg1 ;
                spinmap:sourcePredicate1
                        <file:///www.reportinghub.no/transform/wellbore-npdid-overview#wlbWellboreName> ;
                spinmap:targetPredicate1
                        <http://www.reportinghub.no/schema/npd#name>
              ] ;
      spinmap:rule
              [ rdf:type spinmap:Mapping-0-1 ;
                spinmap:context :WBID-Well ;
                spinmap:expression <http://www.reportinghub.no/schema/npd#Well> ;
                spinmap:targetPredicate1
                        rdf:type
              ] ;
      spinmap:rule
              [ rdf:type spinmap:Mapping-1-1 ;
                spinmap:context :WBID-Well ;
                spinmap:expression spin:_arg1 ;
                spinmap:sourcePredicate1
                        <file:///www.reportinghub.no/transform/wellbore-npdid-overview#wlbWell> ;
                spinmap:targetPredicate1
                        <http://www.reportinghub.no/schema/npd#name>
              ] ;
      spinmap:rule
              [ rdf:type spinmap:Mapping-1-1 ;
                spinmap:context :WBID-WellBore ;
                spinmap:expression
                        [ rdf:type rhspin:wellByName ;
                          arg:wellName spin:_arg1
                        ] ;
                spinmap:sourcePredicate1
                        <file:///www.reportinghub.no/transform/wellbore-npdid-overview#wlbWell> ;
                spinmap:targetPredicate1
                        <http://www.reportinghub.no/schema/npd#partOfWell>
              ] .

arg:well
      rdfs:subPropertyOf sp:arg .

arg:wellBoreName
      rdfs:subPropertyOf sp:arg .

arg:wellName
      rdfs:subPropertyOf sp:arg .

<http://www.reportinghub.no/transform/spreadsheets2npd>
      rdf:type owl:Ontology ;
      rdfs:comment "Takes spreadsheets imported from the NPD fact pages and maps them into the NPD ontology."^^xsd:string ;
      owl:imports <file:///www.reportinghub.no/transform/wellbore-npdid-overview-2011-07-30> , <http://www.reportinghub.no/1.1/schema/npd> , <http://topbraid.org/spin/spinmapl> , <http://www.reportinghub.no/spin/rh> , <file:///www.reportinghub.no/transform/wellbore-npdid-overview> , <http://spinrdf.org/spin> ;
      owl:versionInfo "0.1.0"^^xsd:string .

:WBID-Well
      rdf:type spinmap:Context ;
      spinmap:sourceClass <file:///www.reportinghub.no/transform/wellbore-npdid-overview#WBID> ;
      spinmap:target
              [ rdf:type :buildWellURI ;
                spinmap:source spinmap:_source
              ] ;
      spinmap:targetClass <http://www.reportinghub.no/schema/npd#Well> .

:WBID-WellBore
      rdf:type spinmap:Context ;
      spinmap:sourceClass <file:///www.reportinghub.no/transform/wellbore-npdid-overview#WBID> ;
      spinmap:target
              [ rdf:type :buildWellBoreURI ;
                spinmap:source spinmap:_source
              ] ;
      spinmap:targetClass <http://www.reportinghub.no/schema/npd#WellBore> .

:buildWellBoreURI
      rdf:type spinmap:TargetFunction ;
      rdfs:label "build well bore URI"^^xsd:string ;
      rdfs:subClassOf spinmap:TargetFunctions ;
      spin:body
              [ rdf:type sp:Select ;
                sp:resultVariables ([ rdf:type rhspin:wellBoreByName ;
                            arg:wellBoreName _:b1
                          ]) ;
                sp:where ([ sp:object _:b1 ;
                            sp:predicate <file:///www.reportinghub.no/transform/wellbore-npdid-overview#wlbWellboreName> ;
                            sp:subject
                                    [ sp:varName "source"^^xsd:string
                                    ]
                          ])
              ] ;
      spin:returnType rdfs:Resource .

:buildWellURI
      rdf:type spinmap:TargetFunction ;
      rdfs:label "build well URI"^^xsd:string ;
      rdfs:subClassOf spinmap:TargetFunctions ;
      spin:body
              [ rdf:type sp:Select ;
                sp:resultVariables ([ rdf:type rhspin:wellByName ;
                            arg:wellName _:b2
                          ]) ;
                sp:where ([ sp:object _:b2 ;
                            sp:predicate <file:///www.reportinghub.no/transform/wellbore-npdid-overview#wlbWell> ;
                            sp:subject
                                    [ sp:varName "source"^^xsd:string
                                    ]
                          ])
              ] .

_:b2  sp:varName "wellName"^^xsd:string .

_:b1  sp:varName "wellBoreId"^^xsd:string .