Skip to content

Instantly share code, notes, and snippets.

@michimau
Created April 28, 2020 15:33
Show Gist options
  • Save michimau/f44bb5a4febe46186f4b065634d2950f to your computer and use it in GitHub Desktop.
Save michimau/f44bb5a4febe46186f4b065634d2950f to your computer and use it in GitHub Desktop.
aide-g 1
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX cr: <http://cr.eionet.europa.eu/ontologies/contreg.rdf#>
PREFIX aq: <http://rdfdata.eionet.europa.eu/airquality/ontology/>
PREFIX rod: <http://rod.eionet.europa.eu/schema.rdf#>
PREFIX obligations: <http://rod.eionet.europa.eu/obligations/>
PREFIX aqdd: <http://dd.eionet.europa.eu/property/>
SELECT DISTINCT
#?source
md5(concat(?Country, ?Namespace, ?AttainmentId, xsd:string(?startOfPeriod), ?ObjectiveType, ?ReportingMetric, xsd:string(?ExceedanceThreshold), xsd:string(?Exceedance), ?AggregationType,?Pollutant, ?ProtectionTarget, xsd:string(?FinalNumericalExceedance), xsd:string(?FinalNumberExceedances), xsd:string(?ClassificationArea), xsd:string(?SurfaceAreaFinal), xsd:string(?RoadLengthFinal), xsd:string(?PopulationExposedFinal),xsd:string(?ReferenceYearFinal),xsd:string(?BaseNumericalExceedance), xsd:string(?BaseNumberExceedances), xsd:string(?Adjustment),?AdjustmentSource, ?AdjustmentType, ?AssessmentType, ?ModelAssessmentMetadataURI, ?AssessmentTypeDescription, xsd:string(?ModellingAdjustment),xsd:string(?SamplingAdjustment), ?envelope)) as ?_id
#?attainmentURI
?Country as ?CountryOrTerritory
YEAR(xsd:date(?startOfPeriod)) AS ?ReportingYear
?Namespace
?AttainmentId
replace(str(?areURI),"http://reference.eionet.europa.eu/aq/","") as ?AssessmentId
replace(replace(replace(str(?ZoneURI),"http://reference.eionet.europa.eu/aq/",""),?Namespace ,""),"/","") as ?ZoneId
#?ResidentPopulation
?Pollutant
?ObjectiveType
?ReportingMetric
?ProtectionTarget
bif:either(?Exceedance > 0,"TRUE","FALSE") as ?ExceedanceFinal
?ExceedanceThreshold
?AggregationType
?FinalNumericalExceedance
?FinalNumberExceedances
?ClassificationArea
?SurfaceAreaFinal
?RoadLengthFinal
?PopulationExposedFinal
#?SensitivePopulationFinal
#?EcosystemAreaExposedFinal
#?InfrastructureServicesFinal
?ReferenceYearFinal
?BaseNumericalExceedance
?BaseNumberExceedances
?Adjustment
?AdjustmentSource
?AdjustmentType
?AssessmentType
?AssessmentTypeDescription
replace(replace(replace(str(?ModellingAdjustment),"http://reference.eionet.europa.eu/aq/",""),?Namespace ,""),"/","") as ?ModellingAdjustment
replace(replace(replace(str(?SamplingAdjustment),"http://reference.eionet.europa.eu/aq/",""),?Namespace ,""),"/","") as ?SamplingAdjustment
?Comment
?envelope
WHERE {{
values ?source { <http://cdr.eionet.europa.eu/at/eu/aqd/g/envvjfwsa/REP_D-AT_000820_20141211_G-001_corr.xml> } .
GRAPH ?source {
?attainmentURI a aq:AQD_Attainment .
?attainmentURI aq:environmentalObjective ?envURI .
?attainmentURI aq:assessment ?areURI .
?attainmentURI aq:zone ?ZoneURI .
?attainmentURI aq:pollutant ?PollutantURI .
?attainmentURI aq:inspireId ?inspireURI .
?inspireURI aq:localId ?AttainmentId .
#FILTER (?AttainmentId = 'ATT-AT_01_00001_LV_hrsAbove_2013')
OPTIONAL{ ?attainmentURI aq:comment ?Comment }
OPTIONAL{ ?attainmentURI aq:exceedanceDescriptionFinal ?exceedanceDescriptionFinal .
?exceedanceDescriptionFinal aq:exceedance ?Exceedance }
OPTIONAL{ ?attainmentURI aq:exceedanceDescriptionFinal ?exceedanceDescriptionFinal .
?exceedanceDescriptionFinal aq:exceedance ?Exceedance }
OPTIONAL{ ?attainmentURI aq:exceedanceDescriptionFinal ?exceedanceDescriptionFinal .
?exceedanceDescriptionFinal aq:numberExceedances ?FinalNumberExceedances }
OPTIONAL{ ?attainmentURI aq:exceedanceDescriptionFinal ?exceedanceDescriptionFinal .
?exceedanceDescriptionFinal aq:numericalExceedance ?FinalNumericalExceedance }
OPTIONAL{ ?attainmentURI aq:exceedanceDescriptionFinal ?exceedanceDescriptionFinal .
?attainmentURI aq:exceedanceDescriptionBase ?exceedanceDescriptionBase }
# OPTIONAL{ ?attainmentURI aq:exceedanceDescriptionFinal ?exceedanceDescriptionFinal .
# ?exceedanceDescriptionBase aq:numberExceedances ?BaseNumberExceedances }
# OPTIONAL{ ?attainmentURI aq:exceedanceDescriptionFinal ?exceedanceDescriptionFinal .
# ?exceedanceDescriptionBase aq:numericalExceedance ?BaseNumericalExceedance }
# OPTIONAL{ ?attainmentURI aq:exceedanceDescriptionFinal ?exceedanceDescriptionFinal }.
# OPTIONAL{ ?exceedanceDescriptionBase aq:numberExceedances ?BaseNumberExceedances }
# OPTIONAL{ ?exceedanceDescriptionBase aq:numericalExceedance ?BaseNumericalExceedance }
OPTIONAL{ ?attainmentURI aq:exceedanceDescriptionFinal ?exceedanceDescriptionFinal .
?exceedanceDescriptionFinal aq:exceedanceArea ?areaFinalURI .
?areaFinalURI aq:surfaceArea ?SurfaceAreaFinal }
OPTIONAL{ ?attainmentURI aq:exceedanceDescriptionFinal ?exceedanceDescriptionFinal .
?exceedanceDescriptionFinal aq:exceedanceArea ?areaFinalURI .
?areaFinalURI aq:roadLength ?RoadLengthFinal }
OPTIONAL{ ?attainmentURI aq:exceedanceDescriptionFinal ?exceedanceDescriptionFinal .
?exceedanceDescriptionFinal aq:exceedanceExposure ?exposureFinalURI .
?exposureFinalURI aq:populationExposed ?PopulationExposedFinal }
OPTIONAL{ ?attainmentURI aq:exceedanceDescriptionFinal ?exceedanceDescriptionFinal .
?exceedanceDescriptionFinal aq:exceedanceExposure ?exposureFinalURI .
?exposureFinalURI aq:referenceYear ?ReferenceYearURI .
?ReferenceYearURI aq:timePosition ?ReferenceYearFinal}
OPTIONAL{ ?attainmentURI aq:exceedanceDescriptionAdjustment ?ExceedanceDescriptionAdjustment .
?ExceedanceDescriptionAdjustment aq:deductionAssessmentMethod ?DeductionAssessmentMethod .
?DeductionAssessmentMethod aq:assessmentMethod ?AssessmentMethod .
?AssessmentMethod aq:assessmentTypeDescription ?AssessmentTypeDescription
}
OPTIONAL{ ?attainmentURI aq:exceedanceDescriptionAdjustment ?ExceedanceDescriptionAdjustment .
?ExceedanceDescriptionAdjustment aq:deductionAssessmentMethod ?DeductionAssessmentMethod .
?DeductionAssessmentMethod aq:adjustmentSource ?sourceAdjURI .
?sourceAdjURI rdfs:label ?AdjustmentSource
}
OPTIONAL{ ?attainmentURI aq:exceedanceDescriptionAdjustment ?ExceedanceDescriptionAdjustment .
?ExceedanceDescriptionAdjustment aq:deductionAssessmentMethod ?DeductionAssessmentMethod .
?DeductionAssessmentMethod aq:adjustmentType ?excAdjURI .
?excAdjURI rdfs:label ?AdjustmentType
}
?inspireURI aq:namespace ?Namespace .
}
GRAPH <http://cdr.eionet.europa.eu/at/eu/aqd/g/envvjfwsa/rdf> {
?source dcterms:isPartOf ?envelope .
?envelope rod:released ?released .
?envelope rod:locality ?locality .
?envelope rod:obligation ?obliURI .
?envelope rod:startOfPeriod ?startOfPeriod .
}
GRAPH <http://rod.eionet.europa.eu/spatial/rdf> { ?locality rod:localityName ?Country . }
GRAPH <http://rod.eionet.europa.eu/obligations/rdf> { ?obliURI rdfs:label ?Obligation . }
OPTIONAL{ ?envURI aq:protectionTarget ?ProtectionTargetURI .
?ProtectionTargetURI rdfs:label ?ProtectionTarget }
GRAPH <http://dd.eionet.europa.eu/vocabularyfolder/aq/rdf> {
?thresURI aqdd:relatedPollutant ?PollutantURI .
?thresURI aqdd:aggregationProcess ?AggregationTypeURI .
?AggregationTypeURI rdfs:label ?AggregationType .
?thresURI aqdd:hasReportingMetric ?ReportingMetricURI .
?ReportingMetricURI rdfs:label ?ReportingMetric .
?thresURI aqdd:hasObjectiveType ?ObjectiveTypeURI .
?ObjectiveTypeURI rdfs:label ?ObjectiveType .
?thresURI aqdd:hasProtectionTarget ?ProtectionTargetURI .
#?thresURI aqdd:exceedanceThreshold ?ExceedanceThreshold .
?thresURI skos:notation ?NrId .
?PollutantURI skos:notation ?Pollutant .
}
}}
ORDER BY ?_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment