4b.qr.SPARQL11-D.dong 1.23 KB
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX erhi: <http://www.reportinghub.no/erhi/schema/1.0/interface-model#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?fieldName ?productKind ?startAt ?endAt 
	((?mass*?percentageOfShare/100) as ?myMass) ?massUnit ((?volume*?percentageOfShare/100) as ?myVolume) ?volumeUnit 
WHERE {
	?licence rdf:type erhi:LicenceOrBaa .
	?licence erhi:npdname ?licenceName .
	?licence erhi:npdid ?licenceNpdID .
	?licenceShare erhi:licenceOrBaaShared ?licence.
	?licenceShare erhi:licenceOrBaaShareHolder ?licenceOwner.
	?licenceOwner erhi:npdid "4070011".
	?licenceShare erhi:percentageOfShare  ?percentageOfShare.
	?licence erhi:ownsField ?field .
	?field a erhi:Field;
	erhi:npdid "18081500";
		erhi:npdname ?fieldName.	
	?flow erhi:flowIntoOrOutOf ?field;
	a erhi:AllocatedFlow, erhi:ProductionExploitation.
	?flow erhi:hasProduct ?flowProduct.
	?flowProduct erhi:productStartAt ?startDate.
	?flowProduct erhi:productEndAt  ?endDate.
	?flowProduct 	erhi:hasProductKind ?productKind.
	OPTIONAL {
		?flowProduct	erhi:hasMass	?mass;
		erhi:hasMassUnit		?massUnit.
	}
	OPTIONAL {
		?flowProduct erhi:hasVolume	?volume;
		erhi:hasVolumeUnit	?volumeUnit.
	}
	VALUES  ?productKind {"oil net" "water" "gas"}	
}