Holger Knublauch

DPR helper functions/template change

...@@ -116,14 +116,14 @@ arg:wellName ...@@ -116,14 +116,14 @@ arg:wellName
116 ] ; 116 ] ;
117 spin:constraint 117 spin:constraint
118 [ rdf:type spl:Argument ; 118 [ rdf:type spl:Argument ;
119 - rdfs:comment "The property that must be used in the result resource."^^xsd:string ; 119 + rdfs:comment "The value to match against."^^xsd:string ;
120 - spl:predicate <http://topbraid.org/spin/spinmapl#predicate> ; 120 + spl:predicate sp:arg1
121 - spl:valueType rdf:Property
122 ] ; 121 ] ;
123 spin:constraint 122 spin:constraint
124 [ rdf:type spl:Argument ; 123 [ rdf:type spl:Argument ;
125 - rdfs:comment "The value to match against."^^xsd:string ; 124 + rdfs:comment "The property that must be used in the result resource."^^xsd:string ;
126 - spl:predicate sp:arg1 125 + spl:predicate <http://topbraid.org/spin/spinmapl#predicate> ;
126 + spl:valueType rdf:Property
127 ] ; 127 ] ;
128 spin:returnType rdfs:Resource . 128 spin:returnType rdfs:Resource .
129 129
...@@ -233,7 +233,7 @@ rhspin:GetLicenceInfo ...@@ -233,7 +233,7 @@ rhspin:GetLicenceInfo
233 233
234 rhspin:GetLicensesAndBAAsOfCompanyName 234 rhspin:GetLicensesAndBAAsOfCompanyName
235 rdf:type spin:SelectTemplate ; 235 rdf:type spin:SelectTemplate ;
236 - 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 ; 236 + rdfs:comment "Gets the licences and BAAs that a company with a given name has access to. Result variables are ?ownerId and ?ownerName."^^xsd:string ;
237 rdfs:label "Get licenses and BAAs of company name"^^xsd:string ; 237 rdfs:label "Get licenses and BAAs of company name"^^xsd:string ;
238 rdfs:subClassOf spin:SelectTemplates ; 238 rdfs:subClassOf spin:SelectTemplates ;
239 spin:body 239 spin:body
...@@ -241,7 +241,7 @@ rhspin:GetLicensesAndBAAsOfCompanyName ...@@ -241,7 +241,7 @@ rhspin:GetLicensesAndBAAsOfCompanyName
241 sp:distinct "true"^^xsd:boolean ; 241 sp:distinct "true"^^xsd:boolean ;
242 sp:orderBy ([ sp:varName "ownerName"^^xsd:string 242 sp:orderBy ([ sp:varName "ownerName"^^xsd:string
243 ]) ; 243 ]) ;
244 - sp:resultVariables ([ sp:varName "owner"^^xsd:string 244 + sp:resultVariables ([ sp:varName "ownerId"^^xsd:string
245 ] [ sp:varName "ownerName"^^xsd:string 245 ] [ sp:varName "ownerName"^^xsd:string
246 ]) ; 246 ]) ;
247 sp:where ([ rdf:type sp:NamedGraph ; 247 sp:where ([ rdf:type sp:NamedGraph ;
...@@ -271,6 +271,13 @@ rhspin:GetLicensesAndBAAsOfCompanyName ...@@ -271,6 +271,13 @@ rhspin:GetLicensesAndBAAsOfCompanyName
271 sp:subject 271 sp:subject
272 [ sp:varName "owner"^^xsd:string 272 [ sp:varName "owner"^^xsd:string
273 ] 273 ]
274 + ] [ sp:object
275 + [ sp:varName "ownerId"^^xsd:string
276 + ] ;
277 + sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
278 + sp:subject
279 + [ sp:varName "owner"^^xsd:string
280 + ]
274 ]) ; 281 ]) ;
275 sp:graphNameNode npdata:npd 282 sp:graphNameNode npdata:npd
276 ]) 283 ])
...@@ -411,15 +418,15 @@ rhspin:WDRTableTemplates ...@@ -411,15 +418,15 @@ rhspin:WDRTableTemplates
411 spin:abstract "true"^^xsd:boolean ; 418 spin:abstract "true"^^xsd:boolean ;
412 spin:constraint 419 spin:constraint
413 [ rdf:type spl:Argument ; 420 [ rdf:type spl:Argument ;
414 - rdfs:comment "The DDR that serves as root of the query."^^xsd:string ;
415 - spl:predicate arg:wellBore ;
416 - spl:valueType <http://www.reportinghub.no/ep/schema/well#WellBore>
417 - ] ;
418 - spin:constraint
419 - [ rdf:type spl:Argument ;
420 rdfs:comment "The start date of the reporting week."^^xsd:string ; 421 rdfs:comment "The start date of the reporting week."^^xsd:string ;
421 spl:predicate arg:startDate ; 422 spl:predicate arg:startDate ;
422 spl:valueType xsd:date 423 spl:valueType xsd:date
424 + ] ;
425 + spin:constraint
426 + [ rdf:type spl:Argument ;
427 + rdfs:comment "The DDR that serves as root of the query."^^xsd:string ;
428 + spl:predicate arg:wellBore ;
429 + spl:valueType <http://www.reportinghub.no/ep/schema/well#WellBore>
423 ] . 430 ] .
424 431
425 rhspin:baaById 432 rhspin:baaById
...@@ -869,16 +876,16 @@ rhspin:ddrOfWeek ...@@ -869,16 +876,16 @@ rhspin:ddrOfWeek
869 ] ; 876 ] ;
870 spin:constraint 877 spin:constraint
871 [ rdf:type spl:Argument ; 878 [ rdf:type spl:Argument ;
872 - rdfs:comment "The well bore that the DDR must be about."^^xsd:string ;
873 - spl:predicate sp:arg2 ;
874 - spl:valueType <http://www.reportinghub.no/ep/schema/well#WellBore>
875 - ] ;
876 - spin:constraint
877 - [ rdf:type spl:Argument ;
878 rdfs:comment "The first day of the week."^^xsd:string ; 879 rdfs:comment "The first day of the week."^^xsd:string ;
879 spl:predicate sp:arg1 ; 880 spl:predicate sp:arg1 ;
880 spl:valueType xsd:date 881 spl:valueType xsd:date
881 ] ; 882 ] ;
883 + spin:constraint
884 + [ rdf:type spl:Argument ;
885 + rdfs:comment "The well bore that the DDR must be about."^^xsd:string ;
886 + spl:predicate sp:arg2 ;
887 + spl:valueType <http://www.reportinghub.no/ep/schema/well#WellBore>
888 + ] ;
882 spin:returnType <http://www.reportinghub.no/ep/schema/report#DailyDrillingReport> . 889 spin:returnType <http://www.reportinghub.no/ep/schema/report#DailyDrillingReport> .
883 890
884 rhspin:ddrWellBoreId 891 rhspin:ddrWellBoreId
...@@ -965,15 +972,15 @@ rhspin:dtypeValue ...@@ -965,15 +972,15 @@ rhspin:dtypeValue
965 ] ; 972 ] ;
966 spin:constraint 973 spin:constraint
967 [ rdf:type spl:Argument ; 974 [ rdf:type spl:Argument ;
968 - rdfs:comment "The subject of the value."^^xsd:string ;
969 - spl:predicate sp:arg1 ;
970 - spl:valueType rdfs:Resource
971 - ] ;
972 - spin:constraint
973 - [ rdf:type spl:Argument ;
974 rdfs:comment "The predicate that points to the reified value."^^xsd:string ; 975 rdfs:comment "The predicate that points to the reified value."^^xsd:string ;
975 spl:predicate sp:arg2 ; 976 spl:predicate sp:arg2 ;
976 spl:valueType rdf:Property 977 spl:valueType rdf:Property
978 + ] ;
979 + spin:constraint
980 + [ rdf:type spl:Argument ;
981 + rdfs:comment "The subject of the value."^^xsd:string ;
982 + spl:predicate sp:arg1 ;
983 + spl:valueType rdfs:Resource
977 ] . 984 ] .
978 985
979 rhspin:facilityById 986 rhspin:facilityById
...@@ -1519,10 +1526,10 @@ rhspin:npdId ...@@ -1519,10 +1526,10 @@ rhspin:npdId
1519 spl:valueType <http://www.reportinghub.no/np/schema/npd#NPDIndividual> 1526 spl:valueType <http://www.reportinghub.no/np/schema/npd#NPDIndividual>
1520 ] . 1527 ] .
1521 1528
1522 -rhspin:npdIndividualByName 1529 +rhspin:npdIndividualById
1523 rdf:type spin:Function ; 1530 rdf:type spin:Function ;
1524 - rdfs:comment "Finds an NPD individual by its npd:name (?name). The individual also has to have the given class (?type) as a direct or indirect rdf:type."^^xsd:string ; 1531 + rdfs:comment "Finds an NPD individual by its npd:id (?ud). The individual also has to have the given class (?type) as a direct or indirect rdf:type."^^xsd:string ;
1525 - rdfs:label "NPD individual by name"^^xsd:string ; 1532 + rdfs:label "NPD individual by id"^^xsd:string ;
1526 rdfs:subClassOf spin:Functions ; 1533 rdfs:subClassOf spin:Functions ;
1527 spin:body 1534 spin:body
1528 [ rdf:type sp:Select ; 1535 [ rdf:type sp:Select ;
...@@ -1562,9 +1569,9 @@ rhspin:npdIndividualByName ...@@ -1562,9 +1569,9 @@ rhspin:npdIndividualByName
1562 ])) 1569 ]))
1563 ] [ rdf:type sp:NamedGraph ; 1570 ] [ rdf:type sp:NamedGraph ;
1564 sp:elements ([ sp:object 1571 sp:elements ([ sp:object
1565 - [ sp:varName "name"^^xsd:string 1572 + [ sp:varName "id"^^xsd:string
1566 ] ; 1573 ] ;
1567 - sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ; 1574 + sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
1568 sp:subject 1575 sp:subject
1569 [ sp:varName "individual"^^xsd:string 1576 [ sp:varName "individual"^^xsd:string
1570 ] 1577 ]
...@@ -1581,17 +1588,92 @@ rhspin:npdIndividualByName ...@@ -1581,17 +1588,92 @@ rhspin:npdIndividualByName
1581 ] ; 1588 ] ;
1582 spin:constraint 1589 spin:constraint
1583 [ rdf:type spl:Argument ; 1590 [ rdf:type spl:Argument ;
1591 + rdfs:comment "The NPD id to match."^^xsd:string ;
1592 + spl:predicate arg:id ;
1593 + spl:valueType xsd:string
1594 + ] ;
1595 + spin:constraint
1596 + [ rdf:type spl:Argument ;
1584 rdfs:comment "The rdf:type that the result must have."^^xsd:string ; 1597 rdfs:comment "The rdf:type that the result must have."^^xsd:string ;
1585 spl:optional "true"^^xsd:boolean ; 1598 spl:optional "true"^^xsd:boolean ;
1586 spl:predicate arg:type ; 1599 spl:predicate arg:type ;
1587 spl:valueType rdfs:Class 1600 spl:valueType rdfs:Class
1588 ] ; 1601 ] ;
1602 + spin:returnType <http://www.reportinghub.no/np/schema/npd#Individual> .
1603 +
1604 +rhspin:npdIndividualByName
1605 + rdf:type spin:Function ;
1606 + rdfs:comment "Finds an NPD individual by its npd:name (?name). The individual also has to have the given class (?type) as a direct or indirect rdf:type."^^xsd:string ;
1607 + rdfs:label "NPD individual by name"^^xsd:string ;
1608 + rdfs:subClassOf spin:Functions ;
1609 + spin:body
1610 + [ rdf:type sp:Select ;
1611 + sp:resultVariables ([ sp:varName "individual"^^xsd:string
1612 + ]) ;
1613 + sp:where ([ rdf:type sp:Union ;
1614 + sp:elements (([ rdf:type sp:NamedGraph ;
1615 + sp:elements ([ rdf:type sp:TriplePath ;
1616 + sp:object
1617 + [ sp:varName "type"^^xsd:string
1618 + ] ;
1619 + sp:path [ rdf:type sp:ModPath ;
1620 + sp:modMax -2 ;
1621 + sp:modMin 0 ;
1622 + sp:subPath rdfs:subClassOf
1623 + ] ;
1624 + sp:subject
1625 + [ sp:varName "a"^^xsd:string
1626 + ]
1627 + ]) ;
1628 + sp:graphNameNode <http://www.reportinghub.no/np/schema/1.0/npd>
1629 + ]) ([ rdf:type sp:NamedGraph ;
1630 + sp:elements ([ rdf:type sp:TriplePath ;
1631 + sp:object
1632 + [ sp:varName "type"^^xsd:string
1633 + ] ;
1634 + sp:path [ rdf:type sp:ModPath ;
1635 + sp:modMax -2 ;
1636 + sp:modMin 0 ;
1637 + sp:subPath rdfs:subClassOf
1638 + ] ;
1639 + sp:subject
1640 + [ sp:varName "a"^^xsd:string
1641 + ]
1642 + ]) ;
1643 + sp:graphNameNode <http://www.reportinghub.no/ep/schema/1.0/facility>
1644 + ]))
1645 + ] [ rdf:type sp:NamedGraph ;
1646 + sp:elements ([ sp:object
1647 + [ sp:varName "name"^^xsd:string
1648 + ] ;
1649 + sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
1650 + sp:subject
1651 + [ sp:varName "individual"^^xsd:string
1652 + ]
1653 + ] [ sp:object
1654 + [ sp:varName "a"^^xsd:string
1655 + ] ;
1656 + sp:predicate rdf:type ;
1657 + sp:subject
1658 + [ sp:varName "individual"^^xsd:string
1659 + ]
1660 + ]) ;
1661 + sp:graphNameNode npdata:npd
1662 + ])
1663 + ] ;
1589 spin:constraint 1664 spin:constraint
1590 [ rdf:type spl:Argument ; 1665 [ rdf:type spl:Argument ;
1591 rdfs:comment "The NPD name to match."^^xsd:string ; 1666 rdfs:comment "The NPD name to match."^^xsd:string ;
1592 spl:predicate arg:name ; 1667 spl:predicate arg:name ;
1593 spl:valueType xsd:string 1668 spl:valueType xsd:string
1594 ] ; 1669 ] ;
1670 + spin:constraint
1671 + [ rdf:type spl:Argument ;
1672 + rdfs:comment "The rdf:type that the result must have."^^xsd:string ;
1673 + spl:optional "true"^^xsd:boolean ;
1674 + spl:predicate arg:type ;
1675 + spl:valueType rdfs:Class
1676 + ] ;
1595 spin:returnType <http://www.reportinghub.no/np/schema/npd#Individual> . 1677 spin:returnType <http://www.reportinghub.no/np/schema/npd#Individual> .
1596 1678
1597 rhspin:npdName 1679 rhspin:npdName
...@@ -1637,9 +1719,8 @@ rhspin:npdTripleExists ...@@ -1637,9 +1719,8 @@ rhspin:npdTripleExists
1637 ] ; 1719 ] ;
1638 spin:constraint 1720 spin:constraint
1639 [ rdf:type spl:Argument ; 1721 [ rdf:type spl:Argument ;
1640 - rdfs:comment "The subject to find"^^xsd:string ; 1722 + rdfs:comment "The object to match."^^xsd:string ;
1641 - spl:predicate sp:arg1 ; 1723 + spl:predicate sp:arg3
1642 - spl:valueType rdfs:Resource
1643 ] ; 1724 ] ;
1644 spin:constraint 1725 spin:constraint
1645 [ rdf:type spl:Argument ; 1726 [ rdf:type spl:Argument ;
...@@ -1649,8 +1730,9 @@ rhspin:npdTripleExists ...@@ -1649,8 +1730,9 @@ rhspin:npdTripleExists
1649 ] ; 1730 ] ;
1650 spin:constraint 1731 spin:constraint
1651 [ rdf:type spl:Argument ; 1732 [ rdf:type spl:Argument ;
1652 - rdfs:comment "The object to match."^^xsd:string ; 1733 + rdfs:comment "The subject to find"^^xsd:string ;
1653 - spl:predicate sp:arg3 1734 + spl:predicate sp:arg1 ;
1735 + spl:valueType rdfs:Resource
1654 ] ; 1736 ] ;
1655 spin:returnType xsd:boolean . 1737 spin:returnType xsd:boolean .
1656 1738
......