TRANSFORM_SPREADSHEETS-to-NPD.ttl 14.6 KB
# baseURI: http://www.reportinghub.no/transform/spreadsheets2npd
# imports: http://topbraid.org/spin/spinmapl
# imports: file:///www.reportinghub.no/transform/wellbore-npdid-overview
# imports: file:///www.reportinghub.no/transform/npd/license-2011-07-30
# imports: file:///www.reportinghub.no/transform/npd/company
# imports: http://www.reportinghub.no/examples/transform/npd/company-2011-07-30
# imports: file:///www.reportinghub.no/transform/npd/licence
# 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 company-2011-07-30:  <http://www.reportinghub.no/examples/transform/npd/company-2011-07-30#> .
@prefix license-2011-07-30:  <file:///www.reportinghub.no/transform/npd/license-2011-07-30#> .
@prefix licensee-2011-07-30:  <file:///www.reportinghub.no/transform/npd/licensee-2011-07-30#> .
@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 spif:    <http://spinrdf.org/spif#> .
@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/examples/transform/npd/licence-2011-07-30.csv#Licence>
      spinmap:rule
              [ rdf:type spinmap:Mapping-1-1 ;
                spinmap:context :License-License ;
                spinmap:expression spin:_arg1 ;
                spinmap:sourcePredicate1
                        <file:///www.reportinghub.no/examples/transform/npd/licence-2011-07-30.csv#prlLicensingActivityName> ;
                spinmap:targetPredicate1
                        <http://www.reportinghub.no/schema/npd#licensingActivity>
              ] ;
      spinmap:rule
              [ rdf:type spinmap:Mapping-1-1 ;
                spinmap:context :License-License ;
                spinmap:expression spin:_arg1 ;
                spinmap:sourcePredicate1
                        <file:///www.reportinghub.no/examples/transform/npd/licence-2011-07-30.csv#prlName> ;
                spinmap:targetPredicate1
                        <http://www.reportinghub.no/schema/npd#name>
              ] ;
      spinmap:rule
              [ rdf:type spinmap:Mapping-1-1 ;
                spinmap:context :License-License ;
                spinmap:expression spin:_arg1 ;
                spinmap:sourcePredicate1
                        <file:///www.reportinghub.no/examples/transform/npd/licence-2011-07-30.csv#prlStatus> ;
                spinmap:targetPredicate1
                        <http://www.reportinghub.no/schema/npd#licenseStatus>
              ] ;
      spinmap:rule
              [ rdf:type spinmap:Mapping-1-1 ;
                spinmap:context :License-License ;
                spinmap:expression spin:_arg1 ;
                spinmap:sourcePredicate1
                        <file:///www.reportinghub.no/examples/transform/npd/licence-2011-07-30.csv#prlNpdidLicence> ;
                spinmap:targetPredicate1
                        <http://www.reportinghub.no/schema/npd#id>
              ] ;
      spinmap:rule
              [ rdf:type spinmap:Mapping-1-1 ;
                spinmap:context :License-License ;
                spinmap:expression
                        [ rdf:type spif:parseDate ;
                          arg:pattern "dd.MM.yyyy" ;
                          sp:arg1 spin:_arg1
                        ] ;
                spinmap:sourcePredicate1
                        <file:///www.reportinghub.no/examples/transform/npd/licence-2011-07-30.csv#prlDateValidTo> ;
                spinmap:targetPredicate1
                        <http://www.reportinghub.no/schema/npd#endDate>
              ] ;
      spinmap:rule
              [ rdf:type spinmap:Mapping-1-1 ;
                spinmap:context :License-License ;
                spinmap:expression
                        [ rdf:type spif:parseDate ;
                          arg:pattern "dd.MM.yyyy" ;
                          sp:arg1 spin:_arg1
                        ] ;
                spinmap:sourcePredicate1
                        <file:///www.reportinghub.no/examples/transform/npd/licence-2011-07-30.csv#prlDateGranted> ;
                spinmap:targetPredicate1
                        <http://www.reportinghub.no/schema/npd#startDate>
              ] ;
      spinmap:rule
              [ rdf:type spinmap:Mapping-0-1 ;
                spinmap:context :License-License ;
                spinmap:expression <http://www.reportinghub.no/schema/npd#License> ;
                spinmap:targetPredicate1
                        rdf:type
              ] .

<file:///www.reportinghub.no/transform/npd/company#Company>
      spinmap:rule
              [ rdf:type spinmap:Mapping-1-1 ;
                spinmap:context :Company-Company ;
                spinmap:expression spin:_arg1 ;
                spinmap:sourcePredicate1
                        <file:///www.reportinghub.no/transform/npd/company#cmpNpdidCompany> ;
                spinmap:targetPredicate1
                        <http://www.reportinghub.no/schema/npd#id>
              ] ;
      spinmap:rule
              [ rdf:type spinmap:Mapping-1-1 ;
                spinmap:context :Company-Company ;
                spinmap:expression spin:_arg1 ;
                spinmap:sourcePredicate1
                        <file:///www.reportinghub.no/transform/npd/company#cmpShortName> ;
                spinmap:targetPredicate1
                        <http://www.reportinghub.no/schema/npd#companyShortName>
              ] ;
      spinmap:rule
              [ rdf:type spinmap:Mapping-1-1 ;
                spinmap:context :Company-Company ;
                spinmap:expression spin:_arg1 ;
                spinmap:sourcePredicate1
                        <file:///www.reportinghub.no/transform/npd/company#cmpLongName> ;
                spinmap:targetPredicate1
                        <http://www.reportinghub.no/schema/npd#name>
              ] ;
      spinmap:rule
              [ rdf:type spinmap:Mapping-0-1 ;
                spinmap:context :Company-Company ;
                spinmap:expression <http://www.reportinghub.no/schema/npd#Company> ;
                spinmap:targetPredicate1
                        rdf:type
              ] .

<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 <http://www.reportinghub.no/1.1/schema/npd> , <http://topbraid.org/spin/spinmapl> , <file:///www.reportinghub.no/transform/npd/licence> , <http://www.reportinghub.no/spin/rh> , <http://www.reportinghub.no/examples/transform/npd/company-2011-07-30> , <file:///www.reportinghub.no/transform/npd/license-2011-07-30> , <file:///www.reportinghub.no/transform/wellbore-npdid-overview> , <file:///www.reportinghub.no/transform/npd/company> , <http://spinrdf.org/spin> ;
      owl:versionInfo "0.1.0"^^xsd:string .

:Company-Company
      rdf:type spinmap:Context ;
      spinmap:sourceClass <file:///www.reportinghub.no/transform/npd/company#Company> ;
      spinmap:target
              [ rdf:type :buildCompanyURI ;
                spinmap:source spinmap:_source
              ] ;
      spinmap:targetClass <http://www.reportinghub.no/schema/npd#Company> .

:License-License
      rdf:type spinmap:Context ;
      spinmap:sourceClass <file:///www.reportinghub.no/examples/transform/npd/licence-2011-07-30.csv#Licence> ;
      spinmap:target
              [ rdf:type :buildLicenceURI ;
                spinmap:source spinmap:_source
              ] ;
      spinmap:targetClass <http://www.reportinghub.no/schema/npd#License> .

: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> .

:buildCompanyURI
      rdf:type spinmap:TargetFunction ;
      rdfs:label "build company URI"^^xsd:string ;
      rdfs:subClassOf spinmap:TargetFunctions ;
      spin:body
              [ rdf:type sp:Select ;
                sp:resultVariables ([ rdf:type rhspin:companyById ;
                            arg:id  [ rdf:type spl:object ;
                                      sp:arg1 [ sp:varName "source"^^xsd:string
                                              ] ;
                                      sp:arg2 <file:///www.reportinghub.no/transform/npd/company#cmpNpdidCompany>
                                    ]
                          ]) ;
                sp:where ()
              ] .

:buildLicenceURI
      rdf:type spinmap:TargetFunction ;
      rdfs:label "build licence URI"^^xsd:string ;
      rdfs:subClassOf spinmap:TargetFunctions ;
      spin:body
              [ rdf:type sp:Select ;
                sp:resultVariables ([ rdf:type rhspin:licenceById ;
                            arg:id  [ rdf:type spl:object ;
                                      sp:arg1 [ sp:varName "source"^^xsd:string
                                              ] ;
                                      sp:arg2 <file:///www.reportinghub.no/examples/transform/npd/licence-2011-07-30.csv#prlNpdidLicence>
                                    ]
                          ]) ;
                sp:where ()
              ] .

: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 .