Holger Knublauch

Prepared DPR SWP and some rhspin helper functions

......@@ -105,14 +105,14 @@ arg:wellName
] ;
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
rdfs:comment "The value to match against."^^xsd:string ;
spl:predicate sp:arg1
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The value to match against."^^xsd:string ;
spl:predicate sp:arg1
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:returnType rdfs:Resource .
......@@ -208,6 +208,57 @@ rhspin:GetLicenceInfo
spl:valueType xsd:string
] .
rhspin:GetLicensesAndBAAsOfCompanyName
rdf:type spin:SelectTemplate ;
rdfs:comment "Gets the licences and BAAs that a company with a given name has access to. Result variables are ?owner and ?ownerName."^^xsd:string ;
rdfs:label "Get licenses and BAAs of company name"^^xsd:string ;
rdfs:subClassOf spin:SelectTemplates ;
spin:body
[ rdf:type sp:Select ;
sp:distinct "true"^^xsd:boolean ;
sp:orderBy ([ sp:varName "ownerName"^^xsd:string
]) ;
sp:resultVariables ([ sp:varName "owner"^^xsd:string
] [ sp:varName "ownerName"^^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 "ownerName"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
sp:subject
[ sp:varName "owner"^^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:GetWellBoresOfWell
rdf:type spin:SelectTemplate ;
rdfs:comment "Gets an ordered list of well bores that belong to a given Well. Result variables are ?wellBoreId and ?wellBoreName."^^xsd:string ;
......@@ -337,15 +388,15 @@ rhspin:WDRTableTemplates
spin:abstract "true"^^xsd:boolean ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The DDR that serves as root of the query."^^xsd:string ;
spl:predicate arg:wellBore ;
spl:valueType <http://www.reportinghub.no/ep/schema/well#WellBore>
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The start date of the reporting week."^^xsd:string ;
spl:predicate arg:startDate ;
spl:valueType xsd:date
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The DDR that serves as root of the query."^^xsd:string ;
spl:predicate arg:wellBore ;
spl:valueType <http://www.reportinghub.no/ep/schema/well#WellBore>
] .
rhspin:baaById
......@@ -454,6 +505,50 @@ rhspin:companyHasLicenceForWellBore
] ;
spin:returnType <http://www.reportinghub.no/ep/schema/well#WellBore> .
rhspin:companyHasLicenceOrBAA
rdf:type spin:MagicProperty ;
rdfs:comment "A magic property that defines a relationship between companies (left side) and licenses or BAAs (right side). It matches those licenses or BAAs that the company currently holds. The query is optimized for the direction when the company is given and the licenses and BAAs variable."^^xsd:string ;
rdfs:label "company has licence or BAA"^^xsd:string ;
rdfs:subClassOf spin:MagicProperties ;
spin:body
[ rdf:type sp:Select ;
sp:distinct "true"^^xsd:boolean ;
sp:resultVariables ([ sp:varName "owner"^^xsd:string
]) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object spin:_arg1 ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#shareHolder> ;
sp:subject
[ sp:varName "share"^^xsd:string
]
] [ rdf:type sp:Union ;
sp:elements (([ sp:object
[ sp:varName "owner"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#licenceShared> ;
sp:subject
[ sp:varName "share"^^xsd:string
]
]) ([ sp:object
[ sp:varName "owner"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#baaShared> ;
sp:subject
[ sp:varName "share"^^xsd:string
]
]))
]) ;
sp:graphNameNode npdata:npd
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The Company to match."^^xsd:string ;
spl:predicate sp:arg1 ;
spl:valueType <http://www.reportinghub.no/ep/schema/organization#Company>
] ;
spin:returnType <http://www.reportinghub.no/ep/schema/well#WellBore> .
rhspin:companyName
rdf:type spin:Function ;
rdfs:comment "Gets the name of the company of the currently logged in user."^^xsd:string ;
......@@ -710,16 +805,16 @@ rhspin:ddrOfWeek
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The well bore that the DDR must be about."^^xsd:string ;
spl:predicate sp:arg2 ;
spl:valueType <http://www.reportinghub.no/ep/schema/well#WellBore>
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The first day of the week."^^xsd:string ;
spl:predicate sp:arg1 ;
spl:valueType xsd:date
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The well bore that the DDR must be about."^^xsd:string ;
spl:predicate sp:arg2 ;
spl:valueType <http://www.reportinghub.no/ep/schema/well#WellBore>
] ;
spin:returnType <http://www.reportinghub.no/ep/schema/report#DailyDrillingReport> .
rhspin:ddrWellBoreId
......@@ -806,15 +901,15 @@ rhspin:dtypeValue
] ;
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
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The subject of the value."^^xsd:string ;
spl:predicate sp:arg1 ;
spl:valueType rdfs:Resource
] .
rhspin:facilityById
......@@ -868,8 +963,9 @@ rhspin:graphForDDR
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables ([ rdf:type sp:iri ;
sp:arg1 [ sp:varName "uri"^^xsd:string
sp:resultVariables ([ rdf:type rhspin:graphForLicence ;
arg:licence
[ sp:varName "wellBore"^^xsd:string
]
]) ;
sp:where ([ rdf:type sp:TriplePath ;
......@@ -895,7 +991,31 @@ rhspin:graphForDDR
sp:subject
[ sp:varName "wellBore"^^xsd:string
]
] [ sp:object
]) ;
sp:graphNameNode npdata:npd
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The DDR to get the graph for."^^xsd:string ;
spl:predicate arg:ddr ;
spl:valueType <http://www.reportinghub.no/ep/schema/report#DailyDrillingReport>
] ;
spin:returnType rdfs:Resource .
rhspin:graphForLicence
rdf:type spin:Function ;
rdfs:comment "Gets the URI resource of the named graph that holds the reports for a given licence."^^xsd:string ;
rdfs:label "graph for licence"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables ([ rdf:type sp:iri ;
sp:arg1 [ sp:varName "uri"^^xsd:string
]
]) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object
[ sp:varName "id"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
......@@ -918,9 +1038,9 @@ rhspin:graphForDDR
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The DDR to get the graph for."^^xsd:string ;
spl:predicate arg:ddr ;
spl:valueType <http://www.reportinghub.no/ep/schema/report#DailyDrillingReport>
rdfs:comment "The licence or BAA to get the graph for."^^xsd:string ;
spl:predicate arg:licence ;
spl:valueType <http://www.reportinghub.no/np/schema/npd#Owner>
] ;
spin:returnType rdfs:Resource .
......@@ -931,8 +1051,9 @@ rhspin:graphForWellBoreWithId
rdfs:subClassOf spin:Functions ;
spin:body
[ rdf:type sp:Select ;
sp:resultVariables ([ rdf:type sp:iri ;
sp:arg1 [ sp:varName "uri"^^xsd:string
sp:resultVariables ([ rdf:type rhspin:graphForLicence ;
arg:licence
[ sp:varName "licence"^^xsd:string
]
]) ;
sp:where ([ rdf:type sp:NamedGraph ;
......@@ -950,25 +1071,8 @@ rhspin:graphForWellBoreWithId
sp:subject
[ sp:varName "wellBore"^^xsd:string
]
] [ sp:object
[ sp:varName "licenceId"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
sp:subject
[ sp:varName "licence"^^xsd:string
]
]) ;
sp:graphNameNode npdata:npd
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type fn:concat ;
sp:arg1 "https://www.reportinghub.no/ep/graph/licence-" ;
sp:arg2 [ sp:varName "licenceId"^^xsd:string
]
] ;
sp:variable
[ sp:varName "uri"^^xsd:string
]
])
] ;
spin:constraint
......@@ -1394,9 +1498,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:constraint
[ rdf:type spl:Argument ;
......@@ -1406,8 +1509,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:returnType xsd:boolean .
......
<div>
<hr />
<ui:setContext ui:queryGraph="&lt;http://www.reportinghub.no/ep/spin/dpr-tables&gt;">
<h2>{= ui:label(?template) }</h2>
</ui:setContext>
<table class="ddrTable">
<ui:setContext ui:queryGraph="&lt;http://www.reportinghub.no/ep/spin/dpr-tables&gt;">
<tr class="ddrTR">
<ui:forEach ui:resultSet="{#
SELECT ?header
WHERE {
?template rhspin:tableHeaders ?list .
?list &lt;http://jena.hpl.hp.com/ARQ/list#member&gt; ?header .
}
}">
<th class="ddrTH">{= ?header }</th>
</ui:forEach>
</tr>
</ui:setContext>
<ui:call ui:template="{= ?template }" arg:report="{= ?report }">
<ui:forEach ui:resultSet="{# SELECT ?row ?rowIndex WHERE { ?rs spr:rowIndices ?rowIndex } }">
<tr class="ddrTR">
<ui:forEach ui:resultSet="{# SELECT ?cell WHERE { (?rs ?rowIndex) spr:rowCells (?cell ?cellIndex) } }">
<td class="ddrTD">{= ui:label(?cell) }</td>
</ui:forEach>
</tr>
</ui:forEach>
</ui:call>
</table>
<br />
</div>
\ No newline at end of file
<ui:group>
<h1>DPR</h1>
<hr />
<dprswp:Table arg:report="{= ?report }" arg:template="dpr-tables:WellInformation" />
</ui:group>
\ No newline at end of file
# baseURI: http://www.reportinghub.no/swp/dpr
# imports: http://uispin.org/tui
# imports: http://www.reportinghub.no/ep/schema/1.0/production
# imports: http://www.reportinghub.no/ep/spin/dpr-tables
# imports: http://www.reportinghub.no/spin/rh
@prefix arg: <http://spinrdf.org/arg#> .
@prefix dprswp: <http://www.reportinghub.no/swp/dpr#> .
@prefix html: <http://uispin.org/html#> .
@prefix let: <http://uispin.org/let#> .
@prefix letrs: <http://uispin.org/letrs#> .
@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 sp: <http://spinrdf.org/sp#> .
@prefix spin: <http://spinrdf.org/spin#> .
@prefix spl: <http://spinrdf.org/spl#> .
@prefix ui: <http://uispin.org/ui#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
arg:report
rdf:type rdf:Property ;
rdfs:label "report"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:template
rdf:type rdf:Property ;
rdfs:label "template"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
<http://www.reportinghub.no/ep/schema/production-report#DailyProductionReport>
ui:instanceView
[ rdf:type dprswp:DailyProductionReportView ;
arg:report spin:_this
] .
<http://www.reportinghub.no/swp/dpr>
rdf:type owl:Ontology ;
owl:imports <http://uispin.org/tui> , <http://www.reportinghub.no/ep/schema/1.0/production> , <http://www.reportinghub.no/ep/spin/dpr-tables> , <http://www.reportinghub.no/spin/rh> ;
owl:versionInfo "0.1.0"^^xsd:string .
dprswp:DailyProductionReportView
rdf:type ui:NodeClass ;
rdfs:label "Daily production report view"^^xsd:string ;
rdfs:subClassOf ui:Element ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The report to display."^^xsd:string ;
spl:predicate arg:report ;
spl:valueType <http://www.reportinghub.no/ep/schema/production-report#DailyProductionReport>
] ;
ui:headIncludes
[ rdf:type html:Link ;
html:href "http://spinrdf.org/rhlib/ddr.css"^^xsd:string ;
html:rel "stylesheet"^^xsd:string ;
html:type "text/css"^^xsd:string
] ;
ui:prototype <http://www.reportinghub.no/swp/DailyProductionReport.uispin.html> .
dprswp:Table
rdf:type ui:NodeClass ;
rdfs:comment "An HTML table displaying the results of a given SPIN template for a given DPR. The template should also provide rhspin:tableHeaders."^^xsd:string ;
rdfs:label "Table"^^xsd:string ;
rdfs:subClassOf ui:Element ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The report that serves as root of the template."^^xsd:string ;
spl:optional "true"^^xsd:boolean ;
spl:predicate arg:report ;
spl:valueType <http://www.reportinghub.no/ep/schema/production-report#DailyProductionReport>
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The SPIN Template to execute."^^xsd:string ;
spl:predicate arg:template ;
spl:valueType spin:Template
] ;
ui:prototype <http://www.reportinghub.no/swp/DPRTable.uispin.html> .