5g-oilnet-givenField-M.statoil 1.35 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 (sum(?volume*?percentageOfShare/100) as ?my_Total_Volume) ?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 "17237817".
	?licenceShare erhi:percentageOfShare  ?percentageOfShare.
	?licence erhi:ownsField ?field .
		?field a erhi:Field;
	erhi:npdname ?fieldName;
		erhi:npdid "43765".
	?flow erhi:flowIntoOrOutOf ?field;
		a erhi:AllocatedFlow, erhi:ProductionExploitation.
	?flow erhi:hasProduct ?flowProduct.
	?flowProduct erhi:productStartAt ?startProductDate.
	?flowProduct erhi:productEndAt ?endProductDate.
	?flowProduct erhi:hasTimePeriod "Monthly".
	?flowProduct 	erhi:hasProductKind "oil net".
	OPTIONAL {
		?flowProduct	erhi:hasMass	?mass;
		erhi:hasMassUnit		?massUnit.
	}
	OPTIONAL {
		?flowProduct erhi:hasVolume	?volume;
		erhi:hasVolumeUnit	?volumeUnit.
	}

	FILTER NOT EXISTS {?licenceShare erhi:npdEndDate ?endDate}.
	FILTER (?startProductDate >= "2011-12-01"^^xsd:date && ?endProductDate < "2012-06-30"^^xsd:date)
}
group by ?fieldName ?volumeUnit