Holger Knublauch

New template call backs

......@@ -6,18 +6,14 @@
<script type="text/javascript" src="lib/rh/jquery/jquery.js"></script>
<script type="text/javascript" src="lib/rh/jquery/jquery-ui.js"></script>
<script type="text/javascript" src="lib/rh/js/rh.js"></script>
<script>
function updateWellBores() {
// Updates the content of the well bores list based on selected well
$("#wellSelect option:selected").each(function() {
$.getJSON("getWellBores.json.swp",{ well: $(this).val(), ajax: 'true'}, function(j) {
var options = '';
for (var i = 0; i &lt; j.length; i++) {
options += '<option value="' + j[i].value + '">' + j[i].label + '</option>';
}
$("#wellBoreSelect").html(options);
});
updateSelect('#wellBoreSelect', '{= rhspin:GetWellBoresOfWell }', { well: $(this).val() });
});
}
......
# Saved by TopBraid on Thu Jul 28 15:55:54 BST 2011
# baseURI: http://www.reportinghub.no/1.1/schema/npd
# imports: http://topbraid.org/spin/spinmapl
# imports: http://spinrdf.org/spin
@prefix npd: <http://www.reportinghub.no/schema/npd#> .
@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 xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://www.reportinghub.no/1.1/schema/npd>
rdf:type owl:Ontology ;
owl:imports <http://spinrdf.org/spin> , <http://topbraid.org/spin/spinmapl> ;
owl:versionInfo "Created with TopBraid Composer"^^xsd:string .
npd:Company
rdf:type owl:Class ;
rdfs:subClassOf npd:npdIndividual .
npd:CompanyLicense
rdf:type owl:Class ;
rdfs:comment "A class that relates a Company to a License it has been granted."^^xsd:string ;
rdfs:subClassOf npd:Individual .
npd:Facility
rdf:type owl:Class ;
rdfs:subClassOf npd:npdIndividual .
npd:Field
rdf:type owl:Class ;
rdfs:subClassOf npd:npdIndividual .
npd:FixedFacility
rdf:type owl:Class ;
rdfs:subClassOf npd:Facility .
npd:Individual
rdf:type owl:Class ;
rdfs:subClassOf owl:Thing .
npd:License
rdf:type owl:Class ;
rdfs:subClassOf npd:npdIndividual .
npd:MoveableFacility
rdf:type owl:Class ;
rdfs:subClassOf npd:Facility .
npd:OperatingCompany
rdf:type owl:Class ;
rdfs:subClassOf npd:Company .
npd:ParentCompany
rdf:type owl:Class ;
rdfs:subClassOf npd:Company .
npd:SubSurfaceFixedFacility
rdf:type owl:Class ;
rdfs:subClassOf npd:FixedFacility .
npd:SurfaceFixedFacility
rdf:type owl:Class ;
rdfs:subClassOf npd:FixedFacility .
npd:Well
rdf:type owl:Class ;
rdfs:subClassOf npd:Individual .
npd:WellBore
rdf:type owl:Class ;
rdfs:subClassOf npd:npdIndividual .
npd:awardedTo
rdf:type owl:ObjectProperty ;
rdfs:domain npd:CompanyLicense ;
rdfs:range npd:Company .
npd:belongsTo
rdf:type owl:ObjectProperty ;
rdfs:domain npd:Facility ;
rdfs:range npd:Field .
npd:currentActivityStatus
rdf:type owl:DatatypeProperty ;
rdfs:domain npd:Field ;
rdfs:range xsd:string .
npd:currentOperator
rdf:type owl:ObjectProperty ;
rdfs:comment "Corresponds to Current Operator field in fixed facility tables"^^xsd:string ;
rdfs:domain npd:FixedFacility ;
rdfs:range npd:Company .
npd:currentlyResponsibleCompany
rdf:type owl:ObjectProperty ;
rdfs:comment "Corresponds to Currently Reponsible Company field in moveable facility tables"^^xsd:string ;
rdfs:domain npd:MoveableFacility ;
rdfs:range npd:Company .
npd:discoverWellBore
rdf:type owl:ObjectProperty ;
rdfs:domain npd:Field ;
rdfs:range npd:WellBore .
npd:endDate
rdf:type owl:DatatypeProperty ;
rdfs:domain npd:Individual ;
rdfs:range xsd:date .
npd:facilityKind
rdf:type owl:DatatypeProperty ;
rdfs:comment "corresponds to Kind field in both the fixed and moveable facility tables"^^xsd:string ;
rdfs:domain npd:Facility ;
rdfs:range xsd:string .
npd:fieldOperator
rdf:type owl:ObjectProperty ;
rdfs:domain npd:Field ;
rdfs:range npd:Company .
npd:fixedFacilityPhase
rdf:type owl:DatatypeProperty ;
rdfs:comment "corresponds to Phase field in fixed facility tables"^^xsd:string ;
rdfs:domain npd:FixedFacility ;
rdfs:range xsd:string .
npd:id
rdf:type owl:DatatypeProperty ;
rdfs:domain npd:npdIndividual ;
rdfs:range xsd:string .
npd:licenseAwarded
rdf:type owl:ObjectProperty ;
rdfs:domain npd:CompanyLicense ;
rdfs:range npd:Company .
npd:name
rdf:type owl:DatatypeProperty ;
rdfs:domain npd:Individual ;
rdfs:range xsd:string .
npd:npdIndividual
rdf:type owl:Class ;
rdfs:comment "An npd:Individual that has an npd:id"^^xsd:string ;
rdfs:subClassOf npd:Individual .
npd:parentCo
rdf:type owl:ObjectProperty ;
rdfs:domain npd:OperatingCompany ;
rdfs:range npd:ParentCompany .
npd:partOfWell
rdf:type owl:ObjectProperty ;
rdfs:domain npd:WellBore ;
rdfs:range npd:Well .
npd:percentageInterest
rdf:type owl:DatatypeProperty ;
rdfs:domain npd:CompanyLicense ;
rdfs:range xsd:float .
npd:startDate
rdf:type owl:DatatypeProperty ;
rdfs:domain npd:Individual ;
rdfs:range xsd:date .
......@@ -11,8 +11,8 @@
} ORDER By ?wellBoreName
}" ui:indexVar="i"><ui:if ui:condition="{= ?i &gt; 0 }">,</ui:if>
{
"value" : "{= ui:json(?wellBore) }",
"label" : "{= ?wellBoreName }"
"value" : "{= ui:escapeJSON(xsd:string(?wellBore)) }",
"label" : "{= ui:escapeJSON(?wellBoreName) }"
}</ui:forEach>
]
</ui:setContext>
\ No newline at end of file
......
# Saved by TopBraid on Tue Jul 26 13:13:38 EST 2011
# baseURI: http://www.reportinghub.no/spin/rh
# imports: http://www.reportinghub.no/1.1,1/schema/ddr
# imports: http://spinrdf.org/spin
# imports: http://www.reportinghub.no/1.1/schema/npd
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
......@@ -12,15 +12,52 @@
@prefix spl: <http://spinrdf.org/spl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://spinrdf.org/arg#well>
rdf:type rdf:Property ;
rdfs:label "well"^^xsd:string .
<http://www.reportinghub.no/spin/rh>
rdf:type owl:Ontology ;
rdfs:comment "A collection of SPIN functions and templates to support working with the ReportingHub schemas."^^xsd:string ;
owl:imports <http://spinrdf.org/spin> , <http://www.reportinghub.no/1.1,1/schema/ddr> ;
owl:imports <http://www.reportinghub.no/1.1/schema/npd> , <http://www.reportinghub.no/1.1,1/schema/ddr> , <http://spinrdf.org/spin> ;
owl:versionInfo "0.1.0"^^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 ?wellBore and ?wellBoreName."^^xsd:string ;
rdfs:label "Get well bores of well"^^xsd:string ;
rdfs:subClassOf spin:SelectTemplates ;
spin:body
[ rdf:type sp:Select ;
sp:orderBy (_:b1) ;
sp:resultVariables (_:b2 _:b1) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object
[ sp:varName "well"^^xsd:string
] ;
sp:predicate <http://www.reportinghub.no/schema/npd#partOfWell> ;
sp:subject _:b2
] [ sp:object _:b1 ;
sp:predicate <http://www.reportinghub.no/schema/npd#name> ;
sp:subject _:b2
]) ;
sp:graphNameNode <https://www.reportinghub.no/data/npd>
])
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The Well to get the bores of."^^xsd:string ;
spl:predicate <http://spinrdf.org/arg#well> ;
spl:valueType <http://www.reportinghub.no/schema/npd#Well>
] .
rhspin:userName
rdf:type spin:Function ;
rdfs:comment "Gets the name of the currently logged in user."^^xsd:string ;
rdfs:label "user name"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:returnType xsd:string .
_:b2 sp:varName "wellBore"^^xsd:string .
_:b1 sp:varName "wellBoreName"^^xsd:string .
......
# Saved by TopBraid on Tue Jul 26 13:13:38 EST 2011
# baseURI: null
@prefix composite: <http://www.topbraid.org/2007/05/composite.owl#> .
......
/**
* Updates the options inside of a given HTML select tag from a SPARQL
* result set delivered by a SPIN template call.
* The template call must return the value as first column, and the
* display label as second column.
* @param id the ID of the select element, e.g. "#mySelect")
* @param template the URI of the template to call
* @param args an object with the argument to the template call
*/
function updateSelect(id, template, args) {
args['_template'] = template;
args['ajax'] = true;
$.getJSON("template", args, function(j) {
var vars = j['head'].vars;
var valueVar = vars[0];
var labelVar = vars[1];
var bindings = j['results'].bindings;
var options = '';
for (var i = 0; i < bindings.length; i++) {
var binding = bindings[i];
options += '<option value="' + binding[valueVar].value + '">' + binding[labelVar].value + '</option>';
}
$(id).html(options);
});
}