Skip to content

Instantly share code, notes, and snippets.

@michimau
Created April 28, 2020 08:32
Show Gist options
  • Save michimau/57a910a7eadf942a80abec27f2052869 to your computer and use it in GitHub Desktop.
Save michimau/57a910a7eadf942a80abec27f2052869 to your computer and use it in GitHub Desktop.
Article21Questionnaire x F.S.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rod: <http://rod.eionet.europa.eu/schema.rdf#>
PREFIX obligations: <http://rod.eionet.europa.eu/obligations/>
PREFIX contreg: <http://cr.eionet.europa.eu/ontologies/contreg.rdf#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX xmlSchema: <http://dd.eionet.europa.eu/schemas/eu-ets-article21-1.1/Article21Questionnaire.xsd>
PREFIX obligationsNumber: <http://rod.eionet.europa.eu/obligations/556>
SELECT DISTINCT
?iso2
?delivery
?hasFile
?period
?firstSeen
?year
bif:concat("wget ",?hasFile, " -o ", LCASE(?iso2), "_eu-ets-art21_report.xml") as ?download
WHERE {
?delivery rdf:type rod:Delivery .
?delivery rod:locality ?locality .
?locality skos:notation ?iso2 .
?delivery rod:hasFile ?hasFile .
?hasFile contreg:mediaType ?mediaType .
FILTER (?mediaType = 'text/xml')
?delivery rod:obligation obligationsNumber: .
?hasFile contreg:xmlSchema xmlSchema:
{
SELECT
xsd:integer(substr(xsd:string(bif:either(!bound(?period), ?released, ?period)), 1, 4)) as ?year
?released as ?firstSeen
?period
?delivery
WHERE {
?delivery rdf:type rod:Delivery .
OPTIONAL { ?delivery rod:period ?period } .
?delivery rod:released ?released .
}
}
{
SELECT DISTINCT
?iso2
max(xsd:integer(substr(xsd:string(bif:either(!bound(?period), ?released, ?period)), 1, 4))) as ?year
WHERE {
?delivery rdf:type rod:Delivery .
?delivery rod:locality ?locality .
?locality skos:notation ?iso2 .
?delivery rod:hasFile ?hasFile .
OPTIONAL { ?delivery rod:period ?period } .
?delivery rod:released ?released .
?hasFile contreg:mediaType ?mediaType .
?hasFile contreg:xmlSchema xmlSchema:
FILTER (?mediaType = 'text/xml')
?delivery rod:obligation obligationsNumber: .
}
}
#FILTER (?iso2 = 'ES')
}
ORDER BY ?iso2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment