Holger Knublauch

Prepared DPR SWP and some rhspin helper functions

...@@ -105,14 +105,14 @@ arg:wellName ...@@ -105,14 +105,14 @@ arg:wellName
105 ] ; 105 ] ;
106 spin:constraint 106 spin:constraint
107 [ rdf:type spl:Argument ; 107 [ rdf:type spl:Argument ;
108 - rdfs:comment "The property that must be used in the result resource."^^xsd:string ; 108 + rdfs:comment "The value to match against."^^xsd:string ;
109 - spl:predicate <http://topbraid.org/spin/spinmapl#predicate> ; 109 + spl:predicate sp:arg1
110 - spl:valueType rdf:Property
111 ] ; 110 ] ;
112 spin:constraint 111 spin:constraint
113 [ rdf:type spl:Argument ; 112 [ rdf:type spl:Argument ;
114 - rdfs:comment "The value to match against."^^xsd:string ; 113 + rdfs:comment "The property that must be used in the result resource."^^xsd:string ;
115 - spl:predicate sp:arg1 114 + spl:predicate <http://topbraid.org/spin/spinmapl#predicate> ;
115 + spl:valueType rdf:Property
116 ] ; 116 ] ;
117 spin:returnType rdfs:Resource . 117 spin:returnType rdfs:Resource .
118 118
...@@ -208,6 +208,57 @@ rhspin:GetLicenceInfo ...@@ -208,6 +208,57 @@ rhspin:GetLicenceInfo
208 spl:valueType xsd:string 208 spl:valueType xsd:string
209 ] . 209 ] .
210 210
211 +rhspin:GetLicensesAndBAAsOfCompanyName
212 + rdf:type spin:SelectTemplate ;
213 + 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 ;
214 + rdfs:label "Get licenses and BAAs of company name"^^xsd:string ;
215 + rdfs:subClassOf spin:SelectTemplates ;
216 + spin:body
217 + [ rdf:type sp:Select ;
218 + sp:distinct "true"^^xsd:boolean ;
219 + sp:orderBy ([ sp:varName "ownerName"^^xsd:string
220 + ]) ;
221 + sp:resultVariables ([ sp:varName "owner"^^xsd:string
222 + ] [ sp:varName "ownerName"^^xsd:string
223 + ]) ;
224 + sp:where ([ rdf:type sp:NamedGraph ;
225 + sp:elements ([ sp:object
226 + [ sp:varName "companyName"^^xsd:string
227 + ] ;
228 + sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
229 + sp:subject
230 + [ sp:varName "company"^^xsd:string
231 + ]
232 + ] [ sp:object <http://www.reportinghub.no/np/schema/npd#OperatingCompany> ;
233 + sp:predicate rdf:type ;
234 + sp:subject
235 + [ sp:varName "company"^^xsd:string
236 + ]
237 + ] [ sp:object
238 + [ sp:varName "owner"^^xsd:string
239 + ] ;
240 + sp:predicate rhspin:companyHasLicenceOrBAA ;
241 + sp:subject
242 + [ sp:varName "company"^^xsd:string
243 + ]
244 + ] [ sp:object
245 + [ sp:varName "ownerName"^^xsd:string
246 + ] ;
247 + sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
248 + sp:subject
249 + [ sp:varName "owner"^^xsd:string
250 + ]
251 + ]) ;
252 + sp:graphNameNode npdata:npd
253 + ])
254 + ] ;
255 + spin:constraint
256 + [ rdf:type spl:Argument ;
257 + rdfs:comment "The name of a company."^^xsd:string ;
258 + spl:predicate arg:companyName ;
259 + spl:valueType xsd:string
260 + ] .
261 +
211 rhspin:GetWellBoresOfWell 262 rhspin:GetWellBoresOfWell
212 rdf:type spin:SelectTemplate ; 263 rdf:type spin:SelectTemplate ;
213 rdfs:comment "Gets an ordered list of well bores that belong to a given Well. Result variables are ?wellBoreId and ?wellBoreName."^^xsd:string ; 264 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 ...@@ -337,15 +388,15 @@ rhspin:WDRTableTemplates
337 spin:abstract "true"^^xsd:boolean ; 388 spin:abstract "true"^^xsd:boolean ;
338 spin:constraint 389 spin:constraint
339 [ rdf:type spl:Argument ; 390 [ rdf:type spl:Argument ;
340 - rdfs:comment "The DDR that serves as root of the query."^^xsd:string ;
341 - spl:predicate arg:wellBore ;
342 - spl:valueType <http://www.reportinghub.no/ep/schema/well#WellBore>
343 - ] ;
344 - spin:constraint
345 - [ rdf:type spl:Argument ;
346 rdfs:comment "The start date of the reporting week."^^xsd:string ; 391 rdfs:comment "The start date of the reporting week."^^xsd:string ;
347 spl:predicate arg:startDate ; 392 spl:predicate arg:startDate ;
348 spl:valueType xsd:date 393 spl:valueType xsd:date
394 + ] ;
395 + spin:constraint
396 + [ rdf:type spl:Argument ;
397 + rdfs:comment "The DDR that serves as root of the query."^^xsd:string ;
398 + spl:predicate arg:wellBore ;
399 + spl:valueType <http://www.reportinghub.no/ep/schema/well#WellBore>
349 ] . 400 ] .
350 401
351 rhspin:baaById 402 rhspin:baaById
...@@ -454,6 +505,50 @@ rhspin:companyHasLicenceForWellBore ...@@ -454,6 +505,50 @@ rhspin:companyHasLicenceForWellBore
454 ] ; 505 ] ;
455 spin:returnType <http://www.reportinghub.no/ep/schema/well#WellBore> . 506 spin:returnType <http://www.reportinghub.no/ep/schema/well#WellBore> .
456 507
508 +rhspin:companyHasLicenceOrBAA
509 + rdf:type spin:MagicProperty ;
510 + 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 ;
511 + rdfs:label "company has licence or BAA"^^xsd:string ;
512 + rdfs:subClassOf spin:MagicProperties ;
513 + spin:body
514 + [ rdf:type sp:Select ;
515 + sp:distinct "true"^^xsd:boolean ;
516 + sp:resultVariables ([ sp:varName "owner"^^xsd:string
517 + ]) ;
518 + sp:where ([ rdf:type sp:NamedGraph ;
519 + sp:elements ([ sp:object spin:_arg1 ;
520 + sp:predicate <http://www.reportinghub.no/np/schema/npd#shareHolder> ;
521 + sp:subject
522 + [ sp:varName "share"^^xsd:string
523 + ]
524 + ] [ rdf:type sp:Union ;
525 + sp:elements (([ sp:object
526 + [ sp:varName "owner"^^xsd:string
527 + ] ;
528 + sp:predicate <http://www.reportinghub.no/np/schema/npd#licenceShared> ;
529 + sp:subject
530 + [ sp:varName "share"^^xsd:string
531 + ]
532 + ]) ([ sp:object
533 + [ sp:varName "owner"^^xsd:string
534 + ] ;
535 + sp:predicate <http://www.reportinghub.no/np/schema/npd#baaShared> ;
536 + sp:subject
537 + [ sp:varName "share"^^xsd:string
538 + ]
539 + ]))
540 + ]) ;
541 + sp:graphNameNode npdata:npd
542 + ])
543 + ] ;
544 + spin:constraint
545 + [ rdf:type spl:Argument ;
546 + rdfs:comment "The Company to match."^^xsd:string ;
547 + spl:predicate sp:arg1 ;
548 + spl:valueType <http://www.reportinghub.no/ep/schema/organization#Company>
549 + ] ;
550 + spin:returnType <http://www.reportinghub.no/ep/schema/well#WellBore> .
551 +
457 rhspin:companyName 552 rhspin:companyName
458 rdf:type spin:Function ; 553 rdf:type spin:Function ;
459 rdfs:comment "Gets the name of the company of the currently logged in user."^^xsd:string ; 554 rdfs:comment "Gets the name of the company of the currently logged in user."^^xsd:string ;
...@@ -710,16 +805,16 @@ rhspin:ddrOfWeek ...@@ -710,16 +805,16 @@ rhspin:ddrOfWeek
710 ] ; 805 ] ;
711 spin:constraint 806 spin:constraint
712 [ rdf:type spl:Argument ; 807 [ rdf:type spl:Argument ;
713 - rdfs:comment "The well bore that the DDR must be about."^^xsd:string ;
714 - spl:predicate sp:arg2 ;
715 - spl:valueType <http://www.reportinghub.no/ep/schema/well#WellBore>
716 - ] ;
717 - spin:constraint
718 - [ rdf:type spl:Argument ;
719 rdfs:comment "The first day of the week."^^xsd:string ; 808 rdfs:comment "The first day of the week."^^xsd:string ;
720 spl:predicate sp:arg1 ; 809 spl:predicate sp:arg1 ;
721 spl:valueType xsd:date 810 spl:valueType xsd:date
722 ] ; 811 ] ;
812 + spin:constraint
813 + [ rdf:type spl:Argument ;
814 + rdfs:comment "The well bore that the DDR must be about."^^xsd:string ;
815 + spl:predicate sp:arg2 ;
816 + spl:valueType <http://www.reportinghub.no/ep/schema/well#WellBore>
817 + ] ;
723 spin:returnType <http://www.reportinghub.no/ep/schema/report#DailyDrillingReport> . 818 spin:returnType <http://www.reportinghub.no/ep/schema/report#DailyDrillingReport> .
724 819
725 rhspin:ddrWellBoreId 820 rhspin:ddrWellBoreId
...@@ -806,15 +901,15 @@ rhspin:dtypeValue ...@@ -806,15 +901,15 @@ rhspin:dtypeValue
806 ] ; 901 ] ;
807 spin:constraint 902 spin:constraint
808 [ rdf:type spl:Argument ; 903 [ rdf:type spl:Argument ;
809 - rdfs:comment "The subject of the value."^^xsd:string ;
810 - spl:predicate sp:arg1 ;
811 - spl:valueType rdfs:Resource
812 - ] ;
813 - spin:constraint
814 - [ rdf:type spl:Argument ;
815 rdfs:comment "The predicate that points to the reified value."^^xsd:string ; 904 rdfs:comment "The predicate that points to the reified value."^^xsd:string ;
816 spl:predicate sp:arg2 ; 905 spl:predicate sp:arg2 ;
817 spl:valueType rdf:Property 906 spl:valueType rdf:Property
907 + ] ;
908 + spin:constraint
909 + [ rdf:type spl:Argument ;
910 + rdfs:comment "The subject of the value."^^xsd:string ;
911 + spl:predicate sp:arg1 ;
912 + spl:valueType rdfs:Resource
818 ] . 913 ] .
819 914
820 rhspin:facilityById 915 rhspin:facilityById
...@@ -868,8 +963,9 @@ rhspin:graphForDDR ...@@ -868,8 +963,9 @@ rhspin:graphForDDR
868 rdfs:subClassOf spin:Functions ; 963 rdfs:subClassOf spin:Functions ;
869 spin:body 964 spin:body
870 [ rdf:type sp:Select ; 965 [ rdf:type sp:Select ;
871 - sp:resultVariables ([ rdf:type sp:iri ; 966 + sp:resultVariables ([ rdf:type rhspin:graphForLicence ;
872 - sp:arg1 [ sp:varName "uri"^^xsd:string 967 + arg:licence
968 + [ sp:varName "wellBore"^^xsd:string
873 ] 969 ]
874 ]) ; 970 ]) ;
875 sp:where ([ rdf:type sp:TriplePath ; 971 sp:where ([ rdf:type sp:TriplePath ;
...@@ -895,7 +991,31 @@ rhspin:graphForDDR ...@@ -895,7 +991,31 @@ rhspin:graphForDDR
895 sp:subject 991 sp:subject
896 [ sp:varName "wellBore"^^xsd:string 992 [ sp:varName "wellBore"^^xsd:string
897 ] 993 ]
898 - ] [ sp:object 994 + ]) ;
995 + sp:graphNameNode npdata:npd
996 + ])
997 + ] ;
998 + spin:constraint
999 + [ rdf:type spl:Argument ;
1000 + rdfs:comment "The DDR to get the graph for."^^xsd:string ;
1001 + spl:predicate arg:ddr ;
1002 + spl:valueType <http://www.reportinghub.no/ep/schema/report#DailyDrillingReport>
1003 + ] ;
1004 + spin:returnType rdfs:Resource .
1005 +
1006 +rhspin:graphForLicence
1007 + rdf:type spin:Function ;
1008 + rdfs:comment "Gets the URI resource of the named graph that holds the reports for a given licence."^^xsd:string ;
1009 + rdfs:label "graph for licence"^^xsd:string ;
1010 + rdfs:subClassOf spin:Functions ;
1011 + spin:body
1012 + [ rdf:type sp:Select ;
1013 + sp:resultVariables ([ rdf:type sp:iri ;
1014 + sp:arg1 [ sp:varName "uri"^^xsd:string
1015 + ]
1016 + ]) ;
1017 + sp:where ([ rdf:type sp:NamedGraph ;
1018 + sp:elements ([ sp:object
899 [ sp:varName "id"^^xsd:string 1019 [ sp:varName "id"^^xsd:string
900 ] ; 1020 ] ;
901 sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ; 1021 sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
...@@ -918,9 +1038,9 @@ rhspin:graphForDDR ...@@ -918,9 +1038,9 @@ rhspin:graphForDDR
918 ] ; 1038 ] ;
919 spin:constraint 1039 spin:constraint
920 [ rdf:type spl:Argument ; 1040 [ rdf:type spl:Argument ;
921 - rdfs:comment "The DDR to get the graph for."^^xsd:string ; 1041 + rdfs:comment "The licence or BAA to get the graph for."^^xsd:string ;
922 - spl:predicate arg:ddr ; 1042 + spl:predicate arg:licence ;
923 - spl:valueType <http://www.reportinghub.no/ep/schema/report#DailyDrillingReport> 1043 + spl:valueType <http://www.reportinghub.no/np/schema/npd#Owner>
924 ] ; 1044 ] ;
925 spin:returnType rdfs:Resource . 1045 spin:returnType rdfs:Resource .
926 1046
...@@ -931,8 +1051,9 @@ rhspin:graphForWellBoreWithId ...@@ -931,8 +1051,9 @@ rhspin:graphForWellBoreWithId
931 rdfs:subClassOf spin:Functions ; 1051 rdfs:subClassOf spin:Functions ;
932 spin:body 1052 spin:body
933 [ rdf:type sp:Select ; 1053 [ rdf:type sp:Select ;
934 - sp:resultVariables ([ rdf:type sp:iri ; 1054 + sp:resultVariables ([ rdf:type rhspin:graphForLicence ;
935 - sp:arg1 [ sp:varName "uri"^^xsd:string 1055 + arg:licence
1056 + [ sp:varName "licence"^^xsd:string
936 ] 1057 ]
937 ]) ; 1058 ]) ;
938 sp:where ([ rdf:type sp:NamedGraph ; 1059 sp:where ([ rdf:type sp:NamedGraph ;
...@@ -950,25 +1071,8 @@ rhspin:graphForWellBoreWithId ...@@ -950,25 +1071,8 @@ rhspin:graphForWellBoreWithId
950 sp:subject 1071 sp:subject
951 [ sp:varName "wellBore"^^xsd:string 1072 [ sp:varName "wellBore"^^xsd:string
952 ] 1073 ]
953 - ] [ sp:object
954 - [ sp:varName "licenceId"^^xsd:string
955 - ] ;
956 - sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
957 - sp:subject
958 - [ sp:varName "licence"^^xsd:string
959 - ]
960 ]) ; 1074 ]) ;
961 sp:graphNameNode npdata:npd 1075 sp:graphNameNode npdata:npd
962 - ] [ rdf:type sp:Bind ;
963 - sp:expression
964 - [ rdf:type fn:concat ;
965 - sp:arg1 "https://www.reportinghub.no/ep/graph/licence-" ;
966 - sp:arg2 [ sp:varName "licenceId"^^xsd:string
967 - ]
968 - ] ;
969 - sp:variable
970 - [ sp:varName "uri"^^xsd:string
971 - ]
972 ]) 1076 ])
973 ] ; 1077 ] ;
974 spin:constraint 1078 spin:constraint
...@@ -1394,9 +1498,8 @@ rhspin:npdTripleExists ...@@ -1394,9 +1498,8 @@ rhspin:npdTripleExists
1394 ] ; 1498 ] ;
1395 spin:constraint 1499 spin:constraint
1396 [ rdf:type spl:Argument ; 1500 [ rdf:type spl:Argument ;
1397 - rdfs:comment "The subject to find"^^xsd:string ; 1501 + rdfs:comment "The object to match."^^xsd:string ;
1398 - spl:predicate sp:arg1 ; 1502 + spl:predicate sp:arg3
1399 - spl:valueType rdfs:Resource
1400 ] ; 1503 ] ;
1401 spin:constraint 1504 spin:constraint
1402 [ rdf:type spl:Argument ; 1505 [ rdf:type spl:Argument ;
...@@ -1406,8 +1509,9 @@ rhspin:npdTripleExists ...@@ -1406,8 +1509,9 @@ rhspin:npdTripleExists
1406 ] ; 1509 ] ;
1407 spin:constraint 1510 spin:constraint
1408 [ rdf:type spl:Argument ; 1511 [ rdf:type spl:Argument ;
1409 - rdfs:comment "The object to match."^^xsd:string ; 1512 + rdfs:comment "The subject to find"^^xsd:string ;
1410 - spl:predicate sp:arg3 1513 + spl:predicate sp:arg1 ;
1514 + spl:valueType rdfs:Resource
1411 ] ; 1515 ] ;
1412 spin:returnType xsd:boolean . 1516 spin:returnType xsd:boolean .
1413 1517
......
1 +<div>
2 + <hr />
3 + <ui:setContext ui:queryGraph="&lt;http://www.reportinghub.no/ep/spin/dpr-tables&gt;">
4 + <h2>{= ui:label(?template) }</h2>
5 + </ui:setContext>
6 + <table class="ddrTable">
7 + <ui:setContext ui:queryGraph="&lt;http://www.reportinghub.no/ep/spin/dpr-tables&gt;">
8 + <tr class="ddrTR">
9 + <ui:forEach ui:resultSet="{#
10 + SELECT ?header
11 + WHERE {
12 + ?template rhspin:tableHeaders ?list .
13 + ?list &lt;http://jena.hpl.hp.com/ARQ/list#member&gt; ?header .
14 + }
15 + }">
16 + <th class="ddrTH">{= ?header }</th>
17 + </ui:forEach>
18 + </tr>
19 + </ui:setContext>
20 + <ui:call ui:template="{= ?template }" arg:report="{= ?report }">
21 + <ui:forEach ui:resultSet="{# SELECT ?row ?rowIndex WHERE { ?rs spr:rowIndices ?rowIndex } }">
22 + <tr class="ddrTR">
23 + <ui:forEach ui:resultSet="{# SELECT ?cell WHERE { (?rs ?rowIndex) spr:rowCells (?cell ?cellIndex) } }">
24 + <td class="ddrTD">{= ui:label(?cell) }</td>
25 + </ui:forEach>
26 + </tr>
27 + </ui:forEach>
28 + </ui:call>
29 + </table>
30 + <br />
31 +</div>
...\ No newline at end of file ...\ No newline at end of file
1 +<ui:group>
2 +
3 + <h1>DPR</h1>
4 + <hr />
5 +
6 + <dprswp:Table arg:report="{= ?report }" arg:template="dpr-tables:WellInformation" />
7 +
8 +</ui:group>
...\ No newline at end of file ...\ No newline at end of file
1 +# baseURI: http://www.reportinghub.no/swp/dpr
2 +# imports: http://uispin.org/tui
3 +# imports: http://www.reportinghub.no/ep/schema/1.0/production
4 +# imports: http://www.reportinghub.no/ep/spin/dpr-tables
5 +# imports: http://www.reportinghub.no/spin/rh
6 +
7 +@prefix arg: <http://spinrdf.org/arg#> .
8 +@prefix dprswp: <http://www.reportinghub.no/swp/dpr#> .
9 +@prefix html: <http://uispin.org/html#> .
10 +@prefix let: <http://uispin.org/let#> .
11 +@prefix letrs: <http://uispin.org/letrs#> .
12 +@prefix owl: <http://www.w3.org/2002/07/owl#> .
13 +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
14 +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
15 +@prefix sp: <http://spinrdf.org/sp#> .
16 +@prefix spin: <http://spinrdf.org/spin#> .
17 +@prefix spl: <http://spinrdf.org/spl#> .
18 +@prefix ui: <http://uispin.org/ui#> .
19 +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
20 +
21 +arg:report
22 + rdf:type rdf:Property ;
23 + rdfs:label "report"^^xsd:string ;
24 + rdfs:subPropertyOf sp:arg .
25 +
26 +arg:template
27 + rdf:type rdf:Property ;
28 + rdfs:label "template"^^xsd:string ;
29 + rdfs:subPropertyOf sp:arg .
30 +
31 +<http://www.reportinghub.no/ep/schema/production-report#DailyProductionReport>
32 + ui:instanceView
33 + [ rdf:type dprswp:DailyProductionReportView ;
34 + arg:report spin:_this
35 + ] .
36 +
37 +<http://www.reportinghub.no/swp/dpr>
38 + rdf:type owl:Ontology ;
39 + 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> ;
40 + owl:versionInfo "0.1.0"^^xsd:string .
41 +
42 +dprswp:DailyProductionReportView
43 + rdf:type ui:NodeClass ;
44 + rdfs:label "Daily production report view"^^xsd:string ;
45 + rdfs:subClassOf ui:Element ;
46 + spin:constraint
47 + [ rdf:type spl:Argument ;
48 + rdfs:comment "The report to display."^^xsd:string ;
49 + spl:predicate arg:report ;
50 + spl:valueType <http://www.reportinghub.no/ep/schema/production-report#DailyProductionReport>
51 + ] ;
52 + ui:headIncludes
53 + [ rdf:type html:Link ;
54 + html:href "http://spinrdf.org/rhlib/ddr.css"^^xsd:string ;
55 + html:rel "stylesheet"^^xsd:string ;
56 + html:type "text/css"^^xsd:string
57 + ] ;
58 + ui:prototype <http://www.reportinghub.no/swp/DailyProductionReport.uispin.html> .
59 +
60 +dprswp:Table
61 + rdf:type ui:NodeClass ;
62 + 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 ;
63 + rdfs:label "Table"^^xsd:string ;
64 + rdfs:subClassOf ui:Element ;
65 + spin:constraint
66 + [ rdf:type spl:Argument ;
67 + rdfs:comment "The report that serves as root of the template."^^xsd:string ;
68 + spl:optional "true"^^xsd:boolean ;
69 + spl:predicate arg:report ;
70 + spl:valueType <http://www.reportinghub.no/ep/schema/production-report#DailyProductionReport>
71 + ] ;
72 + spin:constraint
73 + [ rdf:type spl:Argument ;
74 + rdfs:comment "The SPIN Template to execute."^^xsd:string ;
75 + spl:predicate arg:template ;
76 + spl:valueType spin:Template
77 + ] ;
78 + ui:prototype <http://www.reportinghub.no/swp/DPRTable.uispin.html> .