Skip to content

Instantly share code, notes, and snippets.

@michimau
Created June 2, 2020 18:46
Show Gist options
  • Save michimau/bc2cda0748f3de1edebf3d21d847650f to your computer and use it in GitHub Desktop.
Save michimau/bc2cda0748f3de1edebf3d21d847650f to your computer and use it in GitHub Desktop.
#create tew separate queries:
#countOnB
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX aq: <http://reference.eionet.europa.eu/aq/ontology/>
PREFIX aqd: <http://rdfdata.eionet.europa.eu/airquality/ontology/>
PREFIX prop: <http://dd.eionet.europa.eu/property/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX cr: <http://cr.eionet.europa.eu/ontologies/contreg.rdf#>
PREFIX aqd: <http://rdfdata.eionet.europa.eu/airquality/ontology/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREfIX contreg: <http://cr.eionet.europa.eu/ontologies/contreg.rdf#>
SELECT DISTINCT
?Pollutant
?ProtectionTarget
COUNT(DISTINCT bif:concat(str(?zoneURI), str(?pollURI), str(?polltargetURI))) AS ?countOnB
WHERE {
values ?envelope { <http://cdr.eionet.europa.eu/es/eu/aqd/b/envxs7ljw> }
?graph dcterms:isPartOf ?envelope .
?graph contreg:xmlSchema ?xmlSchema .
GRAPH ?graph {
?zoneURI a aqd:AQD_Zone .
?zoneURI aqd:zoneCode ?Zone .
?zoneURI aqd:pollutants ?polltargetURI .
?zoneURI aqd:inspireId ?inspireId .
?zoneURI aqd:designationPeriod ?designationPeriod .
}
?designationPeriod aqd:beginPosition ?beginPosition .
?inspireId aqd:namespace ?Namespace .
?polltargetURI aqd:protectionTarget ?ProtectionTarget .
?polltargetURI aqd:pollutantCode ?pollURI .
?pollURI rdfs:label ?Pollutant .
#OPTIONAL { ?designationPeriod aqd:endPosition ?endPosition . }
#FILTER (((year(?beginPosition) <= 2018) AND (!(bound(?endPosition)) || ?endPosition >= xsd:dateTime('2018-12-31')))) .
FILTER (year(?beginPosition) <= 2018)
}
#countOnC
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX aq: <http://reference.eionet.europa.eu/aq/ontology/>
PREFIX aqd: <http://rdfdata.eionet.europa.eu/airquality/ontology/>
PREFIX prop: <http://dd.eionet.europa.eu/property/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX cr: <http://cr.eionet.europa.eu/ontologies/contreg.rdf#>
PREFIX aqd: <http://rdfdata.eionet.europa.eu/airquality/ontology/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREfIX contreg: <http://cr.eionet.europa.eu/ontologies/contreg.rdf#>
SELECT DISTINCT
?Pollutant
?ProtectionTarget
COUNT(DISTINCT bif:concat(str(?Zone), str(?pollURI), str(?ProtectionTarget))) AS ?countOnC
WHERE {
values ?envelope { <http://cdr.eionet.europa.eu/es/eu/aqd/c/envxxofvq> }
?graph dcterms:isPartOf ?envelope .
?graph contreg:xmlSchema ?xmlSchema .
GRAPH ?graph {
?areURI a aqd:AQD_AssessmentRegime .
?areURI aqd:zone ?Zone .
?areURI aqd:pollutant ?pollURI .
?areURI aqd:assessmentThreshold ?areThre .
?areURI aqd:inspireId ?inspireId .
}
?inspireId aqd:namespace ?Namespace .
?areThre aqd:environmentalObjective ?envObj .
?envObj aqd:protectionTarget ?ProtectionTarget .
?pollURI rdfs:label ?Pollutant .
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment