Skip to content

Instantly share code, notes, and snippets.

@michimau
Created April 16, 2020 10:01
Show Gist options
  • Save michimau/7a3bfbfa7577e66c19c0013f2854c3a0 to your computer and use it in GitHub Desktop.
Save michimau/7a3bfbfa7577e66c19c0013f2854c3a0 to your computer and use it in GitHub Desktop.
aide-d wip
PREFIX aq: <http://rdfdata.eionet.europa.eu/airquality/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX cr: <http://cr.eionet.europa.eu/ontologies/contreg.rdf#>
PREFIX rod: <http://rod.eionet.europa.eu/schema.rdf#>
PREFIX ddaq: <http://dd.eionet.europa.eu/vocabulary/aq/#>
SELECT
#DISTINCT
md5(concat(?CountryOrTerritory,xsd:string(?startOfPeriod),?Namespace,?Network,?TimeZone,?responsibleParty,?StationName,?EoICode,?StationType,?StationArea,?Pollutant,?SamplingPointId,xsd:string(?Longitude),xsd:string(?Latitude),?MeasurementRegime,xsd:string(?beginPosition),xsd:string(?endPosition),?Sample,?SamplingProcess,?MeasurementEquipment,?MeasurementMethod,?SamplingMethod,?AnalyticalTechnique)) as ?_id
?CountryOrTerritory
YEAR(xsd:date(?startOfPeriod)) AS ?ReportingYear
?Namespace
?Network
?TimeZone
?responsibleParty AS ?ResponsibleParty
?StationName
?EoICode
?StationType
?StationArea
?Pollutant
?SamplingPointId
?Longitude
?Latitude
?Altitude
?MeasurementRegime
?beginPosition AS ?OperationalActivityBegin
?endPosition AS ?OperationalActivityEnd
?Sample
?SamplingProcess
?MeasurementEquipment
?MeasurementMethod
?SamplingMethod
?AnalyticalTechnique
?envelope
#?netURI
#?staURI
#?samplPointURI
#?sampleURI
#?processURI
WHERE {{
?source dcterms:isPartOf ?envelope .
?envelope rod:released ?released .
?envelope rod:locality ?locality .
?envelope rod:obligation ?obliURI .
?envelope rod:startOfPeriod ?startOfPeriod .
?locality rod:localityName ?CountryOrTerritory .
FILTER (?envelope = <http://cdr.eionet.europa.eu/cz/eu/aqd/d/envxx_y1q>) .
#FILTER (?envelope = <<envelope>>)
# {
# GRAPH ?source {
# ?netURI a aq:AQD_Network .
#
# }
# } UNION {
# GRAPH ?source {
# ?staURI a aq:AQD_Station .
#
# }
# } UNION {
# GRAPH ?source {
# ?sampleURI a aq:AQD_Sample .
#
# }
# } UNION {
# GRAPH ?source {
# ?processURI a aq:AQD_SamplingPointProcess .
#
# }
# } UNION {
# GRAPH ?source {
# ?samplPointURI aq:belongsTo ?net .
#
# }
?netURI aq:aggregationTimeZone ?TimeZoneURI .
?netURI aq:name ?Network .
?netURI aq:responsibleParty ?ResponsibleURI .
?netURI aq:declarationFor ?net .
?staURI aq:name ?StationName .
?staURI aq:EUStationCode ?EoICode .
?staURI aq:areaClassification ?areaClassification .
?staURI aq:altitude ?Altitude .
?staURI aq:declarationFor ?sta .
?sampleURI aq:inspireId ?inspireSAM .
?sampleURI aq:declarationFor ?sample .
?processURI aq:inspireId ?inspireSPP .
?processURI aq:declarationFor ?process .
?samplPointURI aq:broader ?sta .
?samplPointURI a aq:AQD_SamplingPoint .
?samplPointURI aq:inspireId ?inspireSPO .
?samplPointURI aq:observingCapability ?observingCapability .
?samplPointURI aq:relevantEmissions ?relevantEmissions .
?samplPointURI aq:measurementRegime ?measurementRegimeURI .
OPTIONAL{
?samplPointURI geo:lat ?Latitude .
?samplPointURI geo:long ?Longitude .
}
?inspireSPO aq:localId ?SamplingPointId .
?inspireSPO aq:namespace ?Namespace .
?observingCapability aq:featureOfInterest ?sample .
?observingCapability aq:procedure ?process .
?observingCapability aq:observedProperty ?observedProperty .
?observingCapability aq:observingTime ?observingTime .
?observingTime aq:beginPosition ?beginPosition .
OPTIONAL{?observingTime aq:endPosition ?endPosition} .
?sampleURI aq:declarationFor ?sample .
?sampleURI aq:inspireId ?inspireSAM .
?processURI aq:inspireId ?inspireSPP .
?processURI aq:declarationFor ?process .
?inspireSPP aq:localId ?SamplingProcess .
?inspireSAM aq:localId ?Sample .
OPTIONAL{?processURI aq:measurementEquipment ?measurementEquipment .
?measurementEquipment aq:equipment ?equipment .
?equipment rdfs:label ?MeasurementEquipment .
}
OPTIONAL{?processURI aq:measurementMethod ?measurementMethod1 .
?measurementMethod1 aq:measurementMethod ?measurementMethod2 .
?measurementMethod2 rdfs:label ?MeasurementMethod .
}
OPTIONAL{?processURI aq:samplingMethod ?samplingMethod1 .
?samplingMethod1 aq:samplingMethod ?samplingMethod2 .
?samplingMethod2 rdfs:label ?SamplingMethod .
}
OPTIONAL{?processURI aq:analyticalTechnique ?analyticalTechnique1 .
?analyticalTechnique1 aq:analyticalTechnique ?analyticalTechnique2 .
?analyticalTechnique2 rdfs:label ?AnalyticalTechnique .
}
OPTIONAL{?TimeZoneURI skos:notation ?TimeZone} .
OPTIONAL{
?relevantEmissions aq:stationClassification ?stationClassification .
?stationClassification skos:prefLabel ?StationType .
}
OPTIONAL{?areaClassification skos:prefLabel ?StationArea} .
OPTIONAL{?observedProperty rdfs:label ?Pollutant} .
OPTIONAL{?measurementRegimeURI rdfs:label ?MeasurementRegime} .
OPTIONAL{?ResponsibleURI aq:organisationName ?responsibleParty} .
#}
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment