Holger Knublauch

Added test NPD triples file, additional SPIN function for MPRG

......@@ -40,6 +40,11 @@ arg:ddr
rdfs:label "ddr"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:fieldName
rdf:type rdf:Property ;
rdfs:label "field name"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:id
rdf:type rdf:Property ;
rdfs:label "id"^^xsd:string ;
......@@ -172,6 +177,71 @@ rhspin:DPRTableTemplates
spl:valueType <http://www.reportinghub.no/ep/schema/production-report#DailyProductionReport>
] .
rhspin:GetFieldsOfCompanyName
rdf:type spin:SelectTemplate ;
rdfs:comment "Gets the fields that a company with a given name has access to. Result variables are ?fieldId and ?fieldName."^^xsd:string ;
rdfs:label "Get fields of company name"^^xsd:string ;
rdfs:subClassOf spin:SelectTemplates ;
spin:body
[ rdf:type sp:Select ;
sp:distinct "true"^^xsd:boolean ;
sp:orderBy ([ sp:varName "fieldName"^^xsd:string
]) ;
sp:resultVariables ([ sp:varName "fieldName"^^xsd:string
] [ sp:varName "fieldId"^^xsd:string
]) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object
[ sp:varName "companyName"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject
[ sp:varName "company"^^xsd:string
]
] [ sp:object <http://www.reportinghub.no/np/schema/npd#OperatingCompany> ;
sp:predicate rdf:type ;
sp:subject
[ sp:varName "company"^^xsd:string
]
] [ sp:object
[ sp:varName "owner"^^xsd:string
] ;
sp:predicate rhspin:companyHasLicenceOrBAA ;
sp:subject
[ sp:varName "company"^^xsd:string
]
] [ sp:object
[ sp:varName "owner"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#fieldOwner> ;
sp:subject
[ sp:varName "field"^^xsd:string
]
] [ sp:object
[ sp:varName "fieldName"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject
[ sp:varName "field"^^xsd:string
]
] [ sp:object
[ sp:varName "fieldId"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
sp:subject
[ sp:varName "field"^^xsd:string
]
]) ;
sp:graphNameNode npdata:npd
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The name of a company."^^xsd:string ;
spl:predicate arg:companyName ;
spl:valueType xsd:string
] .
rhspin:GetLicenceInfo
rdf:type spin:SelectTemplate ;
rdfs:comment "Gets the NPD id and a type identifier (\"PL\" or \"BA\") for a licence specified by a name."^^xsd:string ;
......@@ -923,6 +993,68 @@ rhspin:currentUserHasAccessToWellBoreWithId
] ;
spin:returnType xsd:boolean .
rhspin:currentUserIsOperatorOfFieldWithName
rdf:type spin:Function ;
rdfs:comment "Checks if the current user is working for a company that is the owner of the licence or BAA that operates a field with a given name."^^xsd:string ;
rdfs:label "current user is operator of field with name"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Ask ;
sp:where ([ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:companyName
] ;
sp:variable
[ sp:varName "companyName"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type rhspin:companyWithName ;
arg:name
[ sp:varName "companyName"^^xsd:string
]
] ;
sp:variable
[ sp:varName "company"^^xsd:string
]
] [ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object
[ sp:varName "fieldName"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject
[ sp:varName "field"^^xsd:string
]
] [ sp:object
[ sp:varName "owner"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#fieldOwner> ;
sp:subject
[ sp:varName "field"^^xsd:string
]
] [ rdf:type sp:TriplePath ;
sp:object
[ sp:varName "company"^^xsd:string
] ;
sp:path [ rdf:type sp:AltPath ;
sp:path1 <http://www.reportinghub.no/np/schema/npd#baaOperator> ;
sp:path2 <http://www.reportinghub.no/np/schema/npd#licenceOperator>
] ;
sp:subject
[ sp:varName "owner"^^xsd:string
]
]) ;
sp:graphNameNode npdata:npd
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The NPD name of the field."^^xsd:string ;
spl:predicate arg:fieldName ;
spl:valueType xsd:string
] ;
spin:returnType xsd:boolean .
rhspin:currentUserIsOperatorOfOwner
rdf:type spin:Function ;
rdfs:comment "Tests whether the currently logged in user is working for a company that is operator of a given licence or BAA. This function is used by the DPR upload service to validate access privileges."^^xsd:string ;
......@@ -2459,11 +2591,11 @@ _:b6 sp:varName "well"^^xsd:string .
_:b8 sp:varName "wellBore"^^xsd:string .
_:b4 sp:varName "wellBore"^^xsd:string .
_:b12
sp:varName "wellBore"^^xsd:string .
_:b4 sp:varName "wellBore"^^xsd:string .
_:b3 sp:varName "wellBoreId"^^xsd:string .
_:b2 sp:varName "wellBoreName"^^xsd:string .
......
# baseURI: http://www.reportinghub.no/np/data/npd-test
# imports: http://www.reportinghub.no/np/schema/1.0/npd
@prefix ep-fac: <http://www.reportinghub.no/ep/schema/facility#> .
@prefix ep-well: <http://www.reportinghub.no/ep/schema/well#> .
@prefix npd: <http://www.reportinghub.no/np/schema/npd#> .
@prefix npd-test: <http://www.reportinghub.no/np/data/npd-test#> .
@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 xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://www.reportinghub.no/np/data/npd-test>
rdf:type owl:Ontology ;
rdfs:comment "These triples will be added to the NPD Fact Pages automatically. They contain additional test companies, well bores etc that allows the developers and admins to upload and download dummy data."^^xsd:string ;
owl:imports <http://www.reportinghub.no/np/schema/1.0/npd> .
npd-test:BA_ERH_TEST
rdf:type npd:BusinessArrangementArea ;
npd:id "2222222222"^^xsd:string ;
npd:name "BA_ERH_TEST"^^xsd:string .
npd-test:EPIM
rdf:type npd:OperatingCompany ;
npd:companyShortName
"EPIM"^^xsd:string ;
npd:id "5555555555"^^xsd:string ;
npd:name "EPIM"^^xsd:string .
npd-test:ERH-TEST-WELL-01
rdf:type ep-well:Well ;
npd:name "ERH-TEST-WELL-01"^^xsd:string ;
npd:wellPartOfField npd-test:ERH_TEST_FIELD_01 .
npd-test:ERH-TEST-WELL-02
rdf:type ep-well:Well ;
npd:name "ERH-TEST-WELL-02"^^xsd:string ;
npd:wellPartOfField npd-test:ERH_TEST_FIELD_02 .
npd-test:ERH-TEST-WELLBORE-01
rdf:type ep-well:WellBore ;
npd:id "4111111111"^^xsd:string ;
npd:name "ERH-TEST-WELLBORE-01"^^xsd:string ;
npd:partOfWell npd-test:ERH-TEST-WELL-01 ;
npd:wellBoreType "DEVELOPMENT"^^xsd:string .
npd-test:ERH-TEST-WELLBORE-02
rdf:type ep-well:WellBore ;
npd:id "4222222222"^^xsd:string ;
npd:name "ERH-TEST-WELLBORE-02"^^xsd:string ;
npd:partOfWell npd-test:ERH-TEST-WELL-02 ;
npd:wellBoreType "DEVELOPMENT"^^xsd:string .
npd-test:ERH_TEST_FIELD_01
rdf:type ep-fac:Field ;
npd:fieldOwner npd-test:BA_ERH_TEST ;
npd:id "1111111111"^^xsd:string ;
npd:name "ERH_TEST_FIELD_01"^^xsd:string .
npd-test:ERH_TEST_FIELD_02
rdf:type ep-fac:Field ;
npd:fieldOwner npd-test:PL_ERH_TEST ;
npd:id "1222222222"^^xsd:string ;
npd:name "ERH_TEST_FIELD_02"^^xsd:string .
npd-test:PL_ERH_TEST
rdf:type npd:Licence ;
npd:id "3333333333"^^xsd:string ;
npd:name "PL_ERH_TEST"^^xsd:string .