Ralph Hodgson

Merge branch 'master' of github.com:TopQuadrant/EPIM-Ontologies

...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
36 <http://www.reportinghub.no/ep/spin/report-constraints> 36 <http://www.reportinghub.no/ep/spin/report-constraints>
37 rdf:type owl:Ontology ; 37 rdf:type owl:Ontology ;
38 rdfs:comment "Constraints that need to be executed after ep-report:Report generation (without SXML triples)."^^xsd:string ; 38 rdfs:comment "Constraints that need to be executed after ep-report:Report generation (without SXML triples)."^^xsd:string ;
39 - owl:imports <http://www.reportinghub.no/spin/rh> , <http://spinrdf.org/spin> , <http://www.reportinghub.no/ep/schema/1.0/report> , <http://www.reportinghub.no/ep/schema/1.0/facility> , <http://www.reportinghub.no/np/schema/1.0/npd> , <http://www.reportinghub.no/ep/schema/1.0/organization> , <http://www.reportinghub.no/ep/schema/1.0/core> , <http://www.reportinghub.no/ep/schema/1.0/well> , <http://www.reportinghub.no/ep/schema/1.0/equipment> , <http://www.reportinghub.no/ep/schema/1.0/activity> , <http://www.reportinghub.no/ep/schema/1.0/ddr> ; 39 + owl:imports <http://spinrdf.org/spin> , <http://www.reportinghub.no/ep/schema/1.0/activity> , <http://www.reportinghub.no/ep/schema/1.0/core> , <http://www.reportinghub.no/ep/schema/1.0/ddr> , <http://www.reportinghub.no/ep/schema/1.0/equipment> , <http://www.reportinghub.no/ep/schema/1.0/facility> , <http://www.reportinghub.no/ep/schema/1.0/organization> , <http://www.reportinghub.no/ep/schema/1.0/report> , <http://www.reportinghub.no/ep/schema/1.0/well> , <http://www.reportinghub.no/np/schema/1.0/npd> , <http://www.reportinghub.no/spin/rh> ;
40 owl:versionInfo "0.1.0"^^xsd:string . 40 owl:versionInfo "0.1.0"^^xsd:string .
41 41
42 :DDRSuperclass 42 :DDRSuperclass
...@@ -52,12 +52,16 @@ ...@@ -52,12 +52,16 @@
52 ] [ sp:object spin:_this ; 52 ] [ sp:object spin:_this ;
53 sp:predicate spin:violationRoot ; 53 sp:predicate spin:violationRoot ;
54 sp:subject _:b1 54 sp:subject _:b1
55 - ] [ sp:object _:b2 ; 55 + ] [ sp:object
56 + [ sp:varName "message"^^xsd:string
57 + ] ;
56 sp:predicate rdfs:label ; 58 sp:predicate rdfs:label ;
57 sp:subject _:b1 59 sp:subject _:b1
58 ]) ; 60 ]) ;
59 sp:where ([ rdf:type sp:TriplePath ; 61 sp:where ([ rdf:type sp:TriplePath ;
60 - sp:object _:b3 ; 62 + sp:object
63 + [ sp:varName "wellBore"^^xsd:string
64 + ] ;
61 sp:path [ rdf:type sp:SeqPath ; 65 sp:path [ rdf:type sp:SeqPath ;
62 sp:path1 66 sp:path1
63 [ rdf:type sp:SeqPath ; 67 [ rdf:type sp:SeqPath ;
...@@ -71,41 +75,59 @@ ...@@ -71,41 +75,59 @@
71 sp:expression 75 sp:expression
72 [ rdf:type rhspin:companyName 76 [ rdf:type rhspin:companyName
73 ] ; 77 ] ;
74 - sp:variable _:b4 78 + sp:variable
79 + [ sp:varName "companyName"^^xsd:string
80 + ]
75 ] [ rdf:type sp:Bind ; 81 ] [ rdf:type sp:Bind ;
76 sp:expression 82 sp:expression
77 [ rdf:type rhspin:companyWithName ; 83 [ rdf:type rhspin:companyWithName ;
78 - arg:name _:b4 84 + arg:name
85 + [ sp:varName "companyName"^^xsd:string
86 + ]
79 ] ; 87 ] ;
80 - sp:variable _:b5 88 + sp:variable
89 + [ sp:varName "company"^^xsd:string
90 + ]
81 ] [ rdf:type sp:Filter ; 91 ] [ rdf:type sp:Filter ;
82 sp:expression 92 sp:expression
83 [ rdf:type sp:bound ; 93 [ rdf:type sp:bound ;
84 - sp:arg1 _:b5 94 + sp:arg1 [ sp:varName "company"^^xsd:string
95 + ]
85 ] 96 ]
86 ] [ rdf:type sp:NotExists ; 97 ] [ rdf:type sp:NotExists ;
87 - sp:elements ([ sp:object _:b3 ; 98 + sp:elements ([ sp:object
99 + [ sp:varName "wellBore"^^xsd:string
100 + ] ;
88 sp:predicate rhspin:companyHasLicenceForWellBore ; 101 sp:predicate rhspin:companyHasLicenceForWellBore ;
89 - sp:subject _:b5 102 + sp:subject
103 + [ sp:varName "company"^^xsd:string
104 + ]
90 ]) 105 ])
91 ] [ rdf:type sp:Bind ; 106 ] [ rdf:type sp:Bind ;
92 sp:expression 107 sp:expression
108 + [ rdf:type sp:coalesce ;
109 + sp:arg1 [ rdf:type rhspin:npdName ;
110 + arg:resource
111 + [ sp:varName "wellBore"^^xsd:string
112 + ]
113 + ] ;
114 + sp:arg2 "Unknown well bore"
115 + ] ;
116 + sp:variable
117 + [ sp:varName "displayName"^^xsd:string
118 + ]
119 + ] [ rdf:type sp:Bind ;
120 + sp:expression
93 [ rdf:type fn:concat ; 121 [ rdf:type fn:concat ;
94 sp:arg1 "Your company (" ; 122 sp:arg1 "Your company (" ;
95 - sp:arg2 _:b4 ; 123 + sp:arg2 [ sp:varName "companyName"^^xsd:string
124 + ] ;
96 sp:arg3 ") does not hold a licence for well bore " ; 125 sp:arg3 ") does not hold a licence for well bore " ;
97 - sp:arg4 [ rdf:type rhspin:npdName ; 126 + sp:arg4 [ sp:varName "displayName"^^xsd:string
98 - arg:resource _:b3
99 ] 127 ]
100 ] ; 128 ] ;
101 - sp:variable _:b2 129 + sp:variable
130 + [ sp:varName "message"^^xsd:string
131 + ]
102 ]) 132 ])
103 ] . 133 ] .
104 -
105 -_:b5 sp:varName "company"^^xsd:string .
106 -
107 -_:b4 sp:varName "companyName"^^xsd:string .
108 -
109 -_:b3 sp:varName "wellBore"^^xsd:string .
110 -
111 -_:b2 sp:varName "message"^^xsd:string .
......
1 +# baseURI: http://www.reportinghub.no/system/schema/reporting
2 +# imports: http://purl.org/dc/terms/
3 +
4 +@prefix foaf: <http://xmlns.com/foaf/0.1/> .
5 +@prefix owl: <http://www.w3.org/2002/07/owl#> .
6 +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
7 +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
8 +@prefix report: <http://www.reportinghub.no/system/schema/reporting#> .
9 +@prefix sioc: <http://rdfs.org/sioc/ns#> .
10 +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
11 +
12 +sioc:id
13 + rdf:type owl:DatatypeProperty ;
14 + rdfs:label "id"^^xsd:string .
15 +
16 +<http://www.reportinghub.no/system/schema/reporting>
17 + rdf:type owl:Ontology ;
18 + rdfs:comment "The schema of metadata kept by the ReportingHub system to keep track of submitted reports. The starting point is the class foaf:Document."^^xsd:string ;
19 + owl:imports <http://purl.org/dc/terms/> ;
20 + owl:versionInfo "0.1.0"^^xsd:string .
21 +
22 +report:DDR
23 + rdf:type rdfs:Class ;
24 + rdfs:comment "The metadata about a Daily Drilling Report."^^xsd:string ;
25 + rdfs:label "DDR"^^xsd:string ;
26 + rdfs:subClassOf foaf:Document ;
27 + rdfs:subClassOf
28 + [ rdf:type owl:Restriction ;
29 + owl:allValuesFrom xsd:string ;
30 + owl:onProperty sioc:id
31 + ] ;
32 + rdfs:subClassOf
33 + [ rdf:type owl:Restriction ;
34 + owl:cardinality "1"^^xsd:nonNegativeInteger ;
35 + owl:onProperty <http://purl.org/dc/terms/date>
36 + ] ;
37 + rdfs:subClassOf
38 + [ rdf:type owl:Restriction ;
39 + owl:cardinality "1"^^xsd:nonNegativeInteger ;
40 + owl:onProperty report:wellBoreId
41 + ] ;
42 + rdfs:subClassOf
43 + [ rdf:type owl:Restriction ;
44 + owl:cardinality "1"^^xsd:nonNegativeInteger ;
45 + owl:onProperty <http://purl.org/dc/terms/created>
46 + ] ;
47 + rdfs:subClassOf
48 + [ rdf:type owl:Restriction ;
49 + owl:cardinality "1"^^xsd:nonNegativeInteger ;
50 + owl:onProperty sioc:id
51 + ] .
52 +
53 +report:wellBoreId
54 + rdf:type owl:DatatypeProperty ;
55 + rdfs:label "well bore id"^^xsd:string .
56 +
57 +foaf:Document
58 + rdf:type rdfs:Class ;
59 + rdfs:label "Document"^^xsd:string .
1 +# baseURI: http://www.reportinghub.no/system/spin/reporting
2 +# imports: http://spinrdf.org/spin
3 +# imports: http://www.reportinghub.no/system/schema/reporting
4 +
5 +@prefix fn: <http://www.w3.org/2005/xpath-functions#> .
6 +@prefix owl: <http://www.w3.org/2002/07/owl#> .
7 +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
8 +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
9 +@prefix reportspin: <http://www.reportinghub.no/system/spin/reporting#> .
10 +@prefix sp: <http://spinrdf.org/sp#> .
11 +@prefix spin: <http://spinrdf.org/spin#> .
12 +@prefix spl: <http://spinrdf.org/spl#> .
13 +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
14 +
15 +<http://spinrdf.org/arg#date>
16 + rdf:type rdf:Property ;
17 + rdfs:label "date"^^xsd:string ;
18 + rdfs:subPropertyOf sp:arg .
19 +
20 +<http://spinrdf.org/arg#id>
21 + rdf:type rdf:Property ;
22 + rdfs:label "id"^^xsd:string ;
23 + rdfs:subPropertyOf sp:arg .
24 +
25 +<http://spinrdf.org/arg#wellBoreId>
26 + rdf:type rdf:Property ;
27 + rdfs:label "well bore id"^^xsd:string ;
28 + rdfs:subPropertyOf sp:arg .
29 +
30 +<http://www.reportinghub.no/system/spin/reporting>
31 + rdf:type owl:Ontology ;
32 + rdfs:comment "SPIN functions and templates to support querying report metadata."^^xsd:string ;
33 + owl:imports <http://spinrdf.org/spin> , <http://www.reportinghub.no/system/schema/reporting> ;
34 + owl:versionInfo "0.1.0"^^xsd:string .
35 +
36 +reportspin:graphByDDRId
37 + rdf:type spin:Function ;
38 + rdfs:comment "Gets the URI of the named graph containing the triples submitted by a report:DDR (metadata) with a given id."^^xsd:string ;
39 + rdfs:label "graph by DDRId"^^xsd:string ;
40 + rdfs:subClassOf spin:Functions ;
41 + spin:body
42 + [ rdf:type sp:Select ;
43 + sp:resultVariables ([ rdf:type sp:iri ;
44 + sp:arg1 [ sp:varName "uri"^^xsd:string
45 + ]
46 + ]) ;
47 + sp:where ([ rdf:type sp:Bind ;
48 + sp:expression
49 + [ rdf:type fn:concat ;
50 + sp:arg1 "http://www.reportinghub.no/system/ddr/" ;
51 + sp:arg2 [ sp:varName "id"^^xsd:string
52 + ]
53 + ] ;
54 + sp:variable
55 + [ sp:varName "uri"^^xsd:string
56 + ]
57 + ])
58 + ] ;
59 + spin:constraint
60 + [ rdf:type spl:Argument ;
61 + rdfs:comment "The id of the DDR metadata."^^xsd:string ;
62 + spl:predicate <http://spinrdf.org/arg#id> ;
63 + spl:valueType xsd:string
64 + ] ;
65 + spin:returnType rdfs:Resource .
66 +
67 +reportspin:idOfDDRByDateAndWellBoreId
68 + rdf:type spin:Function ;
69 + rdfs:comment "Gets the id of a DDR defined by date and well bore id. If preliminary reports have been created, this will return the most recent one only."^^xsd:string ;
70 + rdfs:label "id of DDR by date and well bore id"^^xsd:string ;
71 + rdfs:subClassOf spin:Functions ;
72 + spin:body
73 + [ rdf:type sp:Select ;
74 + sp:orderBy ([ rdf:type sp:Desc ;
75 + sp:expression
76 + [ sp:varName "created"^^xsd:string
77 + ]
78 + ]) ;
79 + sp:resultVariables ([ sp:varName "id"^^xsd:string
80 + ]) ;
81 + sp:where ([ sp:object
82 + [ sp:varName "wellBoreId"^^xsd:string
83 + ] ;
84 + sp:predicate <http://www.reportinghub.no/system/schema/reporting#wellBoreId> ;
85 + sp:subject
86 + [ sp:varName "report"^^xsd:string
87 + ]
88 + ] [ sp:object
89 + [ sp:varName "date"^^xsd:string
90 + ] ;
91 + sp:predicate <http://purl.org/dc/terms/date> ;
92 + sp:subject
93 + [ sp:varName "report"^^xsd:string
94 + ]
95 + ] [ sp:object
96 + [ sp:varName "created"^^xsd:string
97 + ] ;
98 + sp:predicate <http://purl.org/dc/terms/created> ;
99 + sp:subject
100 + [ sp:varName "report"^^xsd:string
101 + ]
102 + ] [ sp:object
103 + [ sp:varName "id"^^xsd:string
104 + ] ;
105 + sp:predicate <http://rdfs.org/sioc/ns#id> ;
106 + sp:subject
107 + [ sp:varName "report"^^xsd:string
108 + ]
109 + ])
110 + ] ;
111 + spin:constraint
112 + [ rdf:type spl:Argument ;
113 + rdfs:comment "The date of the DDR (not the submission date, but the start date of the report)."^^xsd:string ;
114 + spl:predicate <http://spinrdf.org/arg#date> ;
115 + spl:valueType xsd:date
116 + ] ;
117 + spin:constraint
118 + [ rdf:type spl:Argument ;
119 + rdfs:comment "The id of the well bore."^^xsd:string ;
120 + spl:predicate <http://spinrdf.org/arg#wellBoreId> ;
121 + spl:valueType xsd:string
122 + ] ;
123 + spin:returnType xsd:string .