Showing
6 changed files
with
238 additions
and
12 deletions
... | @@ -6,18 +6,14 @@ | ... | @@ -6,18 +6,14 @@ |
6 | 6 | ||
7 | <script type="text/javascript" src="lib/rh/jquery/jquery.js"></script> | 7 | <script type="text/javascript" src="lib/rh/jquery/jquery.js"></script> |
8 | <script type="text/javascript" src="lib/rh/jquery/jquery-ui.js"></script> | 8 | <script type="text/javascript" src="lib/rh/jquery/jquery-ui.js"></script> |
9 | + <script type="text/javascript" src="lib/rh/js/rh.js"></script> | ||
9 | 10 | ||
10 | <script> | 11 | <script> |
11 | 12 | ||
12 | function updateWellBores() { | 13 | function updateWellBores() { |
14 | + // Updates the content of the well bores list based on selected well | ||
13 | $("#wellSelect option:selected").each(function() { | 15 | $("#wellSelect option:selected").each(function() { |
14 | - $.getJSON("getWellBores.json.swp",{ well: $(this).val(), ajax: 'true'}, function(j) { | 16 | + updateSelect('#wellBoreSelect', '{= rhspin:GetWellBoresOfWell }', { well: $(this).val() }); |
15 | - var options = ''; | ||
16 | - for (var i = 0; i < j.length; i++) { | ||
17 | - options += '<option value="' + j[i].value + '">' + j[i].label + '</option>'; | ||
18 | - } | ||
19 | - $("#wellBoreSelect").html(options); | ||
20 | - }); | ||
21 | }); | 17 | }); |
22 | } | 18 | } |
23 | 19 | ... | ... |
www.reportinghub.no/examples/npd.ttl
0 → 100644
1 | +# Saved by TopBraid on Thu Jul 28 15:55:54 BST 2011 | ||
2 | +# baseURI: http://www.reportinghub.no/1.1/schema/npd | ||
3 | +# imports: http://topbraid.org/spin/spinmapl | ||
4 | +# imports: http://spinrdf.org/spin | ||
5 | + | ||
6 | +@prefix npd: <http://www.reportinghub.no/schema/npd#> . | ||
7 | +@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
8 | +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
9 | +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
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://www.reportinghub.no/1.1/schema/npd> | ||
16 | + rdf:type owl:Ontology ; | ||
17 | + owl:imports <http://spinrdf.org/spin> , <http://topbraid.org/spin/spinmapl> ; | ||
18 | + owl:versionInfo "Created with TopBraid Composer"^^xsd:string . | ||
19 | + | ||
20 | +npd:Company | ||
21 | + rdf:type owl:Class ; | ||
22 | + rdfs:subClassOf npd:npdIndividual . | ||
23 | + | ||
24 | +npd:CompanyLicense | ||
25 | + rdf:type owl:Class ; | ||
26 | + rdfs:comment "A class that relates a Company to a License it has been granted."^^xsd:string ; | ||
27 | + rdfs:subClassOf npd:Individual . | ||
28 | + | ||
29 | +npd:Facility | ||
30 | + rdf:type owl:Class ; | ||
31 | + rdfs:subClassOf npd:npdIndividual . | ||
32 | + | ||
33 | +npd:Field | ||
34 | + rdf:type owl:Class ; | ||
35 | + rdfs:subClassOf npd:npdIndividual . | ||
36 | + | ||
37 | +npd:FixedFacility | ||
38 | + rdf:type owl:Class ; | ||
39 | + rdfs:subClassOf npd:Facility . | ||
40 | + | ||
41 | +npd:Individual | ||
42 | + rdf:type owl:Class ; | ||
43 | + rdfs:subClassOf owl:Thing . | ||
44 | + | ||
45 | +npd:License | ||
46 | + rdf:type owl:Class ; | ||
47 | + rdfs:subClassOf npd:npdIndividual . | ||
48 | + | ||
49 | +npd:MoveableFacility | ||
50 | + rdf:type owl:Class ; | ||
51 | + rdfs:subClassOf npd:Facility . | ||
52 | + | ||
53 | +npd:OperatingCompany | ||
54 | + rdf:type owl:Class ; | ||
55 | + rdfs:subClassOf npd:Company . | ||
56 | + | ||
57 | +npd:ParentCompany | ||
58 | + rdf:type owl:Class ; | ||
59 | + rdfs:subClassOf npd:Company . | ||
60 | + | ||
61 | +npd:SubSurfaceFixedFacility | ||
62 | + rdf:type owl:Class ; | ||
63 | + rdfs:subClassOf npd:FixedFacility . | ||
64 | + | ||
65 | +npd:SurfaceFixedFacility | ||
66 | + rdf:type owl:Class ; | ||
67 | + rdfs:subClassOf npd:FixedFacility . | ||
68 | + | ||
69 | +npd:Well | ||
70 | + rdf:type owl:Class ; | ||
71 | + rdfs:subClassOf npd:Individual . | ||
72 | + | ||
73 | +npd:WellBore | ||
74 | + rdf:type owl:Class ; | ||
75 | + rdfs:subClassOf npd:npdIndividual . | ||
76 | + | ||
77 | +npd:awardedTo | ||
78 | + rdf:type owl:ObjectProperty ; | ||
79 | + rdfs:domain npd:CompanyLicense ; | ||
80 | + rdfs:range npd:Company . | ||
81 | + | ||
82 | +npd:belongsTo | ||
83 | + rdf:type owl:ObjectProperty ; | ||
84 | + rdfs:domain npd:Facility ; | ||
85 | + rdfs:range npd:Field . | ||
86 | + | ||
87 | +npd:currentActivityStatus | ||
88 | + rdf:type owl:DatatypeProperty ; | ||
89 | + rdfs:domain npd:Field ; | ||
90 | + rdfs:range xsd:string . | ||
91 | + | ||
92 | +npd:currentOperator | ||
93 | + rdf:type owl:ObjectProperty ; | ||
94 | + rdfs:comment "Corresponds to Current Operator field in fixed facility tables"^^xsd:string ; | ||
95 | + rdfs:domain npd:FixedFacility ; | ||
96 | + rdfs:range npd:Company . | ||
97 | + | ||
98 | +npd:currentlyResponsibleCompany | ||
99 | + rdf:type owl:ObjectProperty ; | ||
100 | + rdfs:comment "Corresponds to Currently Reponsible Company field in moveable facility tables"^^xsd:string ; | ||
101 | + rdfs:domain npd:MoveableFacility ; | ||
102 | + rdfs:range npd:Company . | ||
103 | + | ||
104 | +npd:discoverWellBore | ||
105 | + rdf:type owl:ObjectProperty ; | ||
106 | + rdfs:domain npd:Field ; | ||
107 | + rdfs:range npd:WellBore . | ||
108 | + | ||
109 | +npd:endDate | ||
110 | + rdf:type owl:DatatypeProperty ; | ||
111 | + rdfs:domain npd:Individual ; | ||
112 | + rdfs:range xsd:date . | ||
113 | + | ||
114 | +npd:facilityKind | ||
115 | + rdf:type owl:DatatypeProperty ; | ||
116 | + rdfs:comment "corresponds to Kind field in both the fixed and moveable facility tables"^^xsd:string ; | ||
117 | + rdfs:domain npd:Facility ; | ||
118 | + rdfs:range xsd:string . | ||
119 | + | ||
120 | +npd:fieldOperator | ||
121 | + rdf:type owl:ObjectProperty ; | ||
122 | + rdfs:domain npd:Field ; | ||
123 | + rdfs:range npd:Company . | ||
124 | + | ||
125 | +npd:fixedFacilityPhase | ||
126 | + rdf:type owl:DatatypeProperty ; | ||
127 | + rdfs:comment "corresponds to Phase field in fixed facility tables"^^xsd:string ; | ||
128 | + rdfs:domain npd:FixedFacility ; | ||
129 | + rdfs:range xsd:string . | ||
130 | + | ||
131 | +npd:id | ||
132 | + rdf:type owl:DatatypeProperty ; | ||
133 | + rdfs:domain npd:npdIndividual ; | ||
134 | + rdfs:range xsd:string . | ||
135 | + | ||
136 | +npd:licenseAwarded | ||
137 | + rdf:type owl:ObjectProperty ; | ||
138 | + rdfs:domain npd:CompanyLicense ; | ||
139 | + rdfs:range npd:Company . | ||
140 | + | ||
141 | +npd:name | ||
142 | + rdf:type owl:DatatypeProperty ; | ||
143 | + rdfs:domain npd:Individual ; | ||
144 | + rdfs:range xsd:string . | ||
145 | + | ||
146 | +npd:npdIndividual | ||
147 | + rdf:type owl:Class ; | ||
148 | + rdfs:comment "An npd:Individual that has an npd:id"^^xsd:string ; | ||
149 | + rdfs:subClassOf npd:Individual . | ||
150 | + | ||
151 | +npd:parentCo | ||
152 | + rdf:type owl:ObjectProperty ; | ||
153 | + rdfs:domain npd:OperatingCompany ; | ||
154 | + rdfs:range npd:ParentCompany . | ||
155 | + | ||
156 | +npd:partOfWell | ||
157 | + rdf:type owl:ObjectProperty ; | ||
158 | + rdfs:domain npd:WellBore ; | ||
159 | + rdfs:range npd:Well . | ||
160 | + | ||
161 | +npd:percentageInterest | ||
162 | + rdf:type owl:DatatypeProperty ; | ||
163 | + rdfs:domain npd:CompanyLicense ; | ||
164 | + rdfs:range xsd:float . | ||
165 | + | ||
166 | +npd:startDate | ||
167 | + rdf:type owl:DatatypeProperty ; | ||
168 | + rdfs:domain npd:Individual ; | ||
169 | + rdfs:range xsd:date . |
... | @@ -11,8 +11,8 @@ | ... | @@ -11,8 +11,8 @@ |
11 | } ORDER By ?wellBoreName | 11 | } ORDER By ?wellBoreName |
12 | }" ui:indexVar="i"><ui:if ui:condition="{= ?i > 0 }">,</ui:if> | 12 | }" ui:indexVar="i"><ui:if ui:condition="{= ?i > 0 }">,</ui:if> |
13 | { | 13 | { |
14 | - "value" : "{= ui:json(?wellBore) }", | 14 | + "value" : "{= ui:escapeJSON(xsd:string(?wellBore)) }", |
15 | - "label" : "{= ?wellBoreName }" | 15 | + "label" : "{= ui:escapeJSON(?wellBoreName) }" |
16 | }</ui:forEach> | 16 | }</ui:forEach> |
17 | ] | 17 | ] |
18 | </ui:setContext> | 18 | </ui:setContext> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | -# Saved by TopBraid on Tue Jul 26 13:13:38 EST 2011 | ||
2 | # baseURI: http://www.reportinghub.no/spin/rh | 1 | # baseURI: http://www.reportinghub.no/spin/rh |
3 | # imports: http://www.reportinghub.no/1.1,1/schema/ddr | 2 | # imports: http://www.reportinghub.no/1.1,1/schema/ddr |
4 | # imports: http://spinrdf.org/spin | 3 | # imports: http://spinrdf.org/spin |
4 | +# imports: http://www.reportinghub.no/1.1/schema/npd | ||
5 | 5 | ||
6 | @prefix owl: <http://www.w3.org/2002/07/owl#> . | 6 | @prefix owl: <http://www.w3.org/2002/07/owl#> . |
7 | @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | 7 | @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . |
... | @@ -12,15 +12,52 @@ | ... | @@ -12,15 +12,52 @@ |
12 | @prefix spl: <http://spinrdf.org/spl#> . | 12 | @prefix spl: <http://spinrdf.org/spl#> . |
13 | @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | 13 | @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . |
14 | 14 | ||
15 | +<http://spinrdf.org/arg#well> | ||
16 | + rdf:type rdf:Property ; | ||
17 | + rdfs:label "well"^^xsd:string . | ||
18 | + | ||
15 | <http://www.reportinghub.no/spin/rh> | 19 | <http://www.reportinghub.no/spin/rh> |
16 | rdf:type owl:Ontology ; | 20 | rdf:type owl:Ontology ; |
17 | rdfs:comment "A collection of SPIN functions and templates to support working with the ReportingHub schemas."^^xsd:string ; | 21 | rdfs:comment "A collection of SPIN functions and templates to support working with the ReportingHub schemas."^^xsd:string ; |
18 | - owl:imports <http://spinrdf.org/spin> , <http://www.reportinghub.no/1.1,1/schema/ddr> ; | 22 | + owl:imports <http://www.reportinghub.no/1.1/schema/npd> , <http://www.reportinghub.no/1.1,1/schema/ddr> , <http://spinrdf.org/spin> ; |
19 | owl:versionInfo "0.1.0"^^xsd:string . | 23 | owl:versionInfo "0.1.0"^^xsd:string . |
20 | 24 | ||
25 | +rhspin:GetWellBoresOfWell | ||
26 | + rdf:type spin:SelectTemplate ; | ||
27 | + rdfs:comment "Gets an ordered list of well bores that belong to a given Well. Result variables are ?wellBore and ?wellBoreName."^^xsd:string ; | ||
28 | + rdfs:label "Get well bores of well"^^xsd:string ; | ||
29 | + rdfs:subClassOf spin:SelectTemplates ; | ||
30 | + spin:body | ||
31 | + [ rdf:type sp:Select ; | ||
32 | + sp:orderBy (_:b1) ; | ||
33 | + sp:resultVariables (_:b2 _:b1) ; | ||
34 | + sp:where ([ rdf:type sp:NamedGraph ; | ||
35 | + sp:elements ([ sp:object | ||
36 | + [ sp:varName "well"^^xsd:string | ||
37 | + ] ; | ||
38 | + sp:predicate <http://www.reportinghub.no/schema/npd#partOfWell> ; | ||
39 | + sp:subject _:b2 | ||
40 | + ] [ sp:object _:b1 ; | ||
41 | + sp:predicate <http://www.reportinghub.no/schema/npd#name> ; | ||
42 | + sp:subject _:b2 | ||
43 | + ]) ; | ||
44 | + sp:graphNameNode <https://www.reportinghub.no/data/npd> | ||
45 | + ]) | ||
46 | + ] ; | ||
47 | + spin:constraint | ||
48 | + [ rdf:type spl:Argument ; | ||
49 | + rdfs:comment "The Well to get the bores of."^^xsd:string ; | ||
50 | + spl:predicate <http://spinrdf.org/arg#well> ; | ||
51 | + spl:valueType <http://www.reportinghub.no/schema/npd#Well> | ||
52 | + ] . | ||
53 | + | ||
21 | rhspin:userName | 54 | rhspin:userName |
22 | rdf:type spin:Function ; | 55 | rdf:type spin:Function ; |
23 | rdfs:comment "Gets the name of the currently logged in user."^^xsd:string ; | 56 | rdfs:comment "Gets the name of the currently logged in user."^^xsd:string ; |
24 | rdfs:label "user name"^^xsd:string ; | 57 | rdfs:label "user name"^^xsd:string ; |
25 | rdfs:subClassOf spin:Functions ; | 58 | rdfs:subClassOf spin:Functions ; |
26 | spin:returnType xsd:string . | 59 | spin:returnType xsd:string . |
60 | + | ||
61 | +_:b2 sp:varName "wellBore"^^xsd:string . | ||
62 | + | ||
63 | +_:b1 sp:varName "wellBoreName"^^xsd:string . | ... | ... |
www.reportinghub.no/swp/rh.www/js/rh.js
0 → 100644
1 | +/** | ||
2 | + * Updates the options inside of a given HTML select tag from a SPARQL | ||
3 | + * result set delivered by a SPIN template call. | ||
4 | + * The template call must return the value as first column, and the | ||
5 | + * display label as second column. | ||
6 | + * @param id the ID of the select element, e.g. "#mySelect") | ||
7 | + * @param template the URI of the template to call | ||
8 | + * @param args an object with the argument to the template call | ||
9 | + */ | ||
10 | +function updateSelect(id, template, args) { | ||
11 | + args['_template'] = template; | ||
12 | + args['ajax'] = true; | ||
13 | + $.getJSON("template", args, function(j) { | ||
14 | + var vars = j['head'].vars; | ||
15 | + var valueVar = vars[0]; | ||
16 | + var labelVar = vars[1]; | ||
17 | + var bindings = j['results'].bindings; | ||
18 | + var options = ''; | ||
19 | + for (var i = 0; i < bindings.length; i++) { | ||
20 | + var binding = bindings[i]; | ||
21 | + options += '<option value="' + binding[valueVar].value + '">' + binding[labelVar].value + '</option>'; | ||
22 | + } | ||
23 | + $(id).html(options); | ||
24 | + }); | ||
25 | +} |
-
Please register or login to post a comment