Skip to content

Instantly share code, notes, and snippets.

@michimau
Created May 8, 2019 10:16
Show Gist options
  • Select an option

  • Save michimau/c2477418073da7434dc767d040c82859 to your computer and use it in GitHub Desktop.

Select an option

Save michimau/c2477418073da7434dc767d040c82859 to your computer and use it in GitHub Desktop.
5/8/2019 12:15:07 PM PREFIX a: <http://www.eea.europa.eu/portal_types/Data#>
5/8/2019 12:15:07 PMPREFIX dt: <http://www.eea.europa.eu/portal_types/DataTable#>
5/8/2019 12:15:07 PMPREFIX org: <http://www.eea.europa.eu/portal_types/Organisation#>
5/8/2019 12:15:07 PMPREFIX dct: <http://purl.org/dc/terms/>
5/8/2019 12:15:07 PMPREFIX ecodp: <http://open-data.europa.eu/ontologies/ec-odp#>
5/8/2019 12:15:07 PMPREFIX dcat: <http://www.w3.org/ns/dcat#>
5/8/2019 12:15:07 PMPREFIX owl: <http://www.w3.org/2002/07/owl#>
5/8/2019 12:15:07 PMPREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
5/8/2019 12:15:07 PMPREFIX datafilelink: <http://www.eea.europa.eu/portal_types/DataFileLi
5/8/2019 12:15:07 PM PREFIX a: <http://www.eea.europa.eu/portal_types/Data#>
5/8/2019 12:15:07 PMPREFIX dt: <http://www.eea.europa.eu/portal_types/DataTable#>
5/8/2019 12:15:07 PMPREFIX org: <http://www.eea.europa.eu/portal_types/Organisation#>
5/8/2019 12:15:07 PMPREFIX dct: <http://purl.org/dc/terms/>
5/8/2019 12:15:07 PMPREFIX ecodp: <http://open-data.europa.eu/ontologies/ec-odp#>
5/8/2019 12:15:07 PMPREFIX dcat: <http://www.w3.org/ns/dcat#>
5/8/2019 12:15:07 PMPREFIX owl: <http://www.w3.org/2002/07/owl#>
5/8/2019 12:15:07 PMPREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
5/8/2019 12:15:07 PMPREFIX datafilelink: <http://www.eea.europa.eu/portal_types/DataFileLink#>
5/8/2019 12:15:07 PMPREFIX datafile: <http://www.eea.europa.eu/portal_types/DataFile#>
5/8/2019 12:15:07 PMPREFIX sparql: <http://www.eea.europa.eu/portal_types/Sparql#>
5/8/2019 12:15:07 PMPREFIX file: <http://www.eea.europa.eu/portal_types/File#>
5/8/2019 12:15:07 PMPREFIX skos: <http://www.w3.org/2004/02/skos/core#>
5/8/2019 12:15:07 PMPREFIX cr: <http://cr.eionet.europa.eu/ontologies/contreg.rdf#>
5/8/2019 12:15:07 PMPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
5/8/2019 12:15:07 PMCONSTRUCT {
5/8/2019 12:15:07 PM ?dataset a dcat:Dataset;
5/8/2019 12:15:07 PM dct:publisher <http://publications.europa.eu/resource/authority/corporate-body/EEA>;
5/8/2019 12:15:07 PM ecodp:datasetStatus <http://data.europa.eu/euodp/kos/dataset-status/Completed>;
5/8/2019 12:15:07 PM dct:license <http://opendatacommons.org/licenses/by/>;
5/8/2019 12:15:07 PM dct:license ?odp_license;
5/8/2019 12:15:07 PM dct:title ?title;
5/8/2019 12:15:07 PM #workaround so we can have a default value if object is missing an attribute
5/8/2019 12:15:07 PM #this is needed because we are running on an older virtuoso, and has no support for BIND
5/8/2019 12:15:07 PM dct:description ?description_real;
5/8/2019 12:15:07 PM dct:description ?description_default;
5/8/2019 12:15:07 PM dct:identifier 'large-combustion-plants-lcp-opted-out-under-article-4-4-of-directive-2001-80-ec-3';
5/8/2019 12:15:07 PM ecodp:ckan-name 'data_large-combustion-plants-lcp-opted-out-under-article-4-4-of-directive-2001-80-ec-3';
5/8/2019 12:15:07 PM dct:issued ?effective;
5/8/2019 12:15:07 PM dct:modified ?modified;
5/8/2019 12:15:07 PM ecodp:keyword ?theme;
5/8/2019 12:15:07 PM dct:spatial ?pubspatial;
5/8/2019 12:15:07 PM dct:subject ?subject;
5/8/2019 12:15:07 PM dcat:theme ?dcat_theme;
5/8/2019 12:15:07 PM dct:isReplacedBy ?isreplaced;
5/8/2019 12:15:07 PM dct:replaces ?replaces;
5/8/2019 12:15:07 PM ecodp:contactPoint ?ecodp_contactPoint .
5/8/2019 12:15:07 PM ?ecodp_contactPoint rdf:type ?ecodp_contactPoint_type .
5/8/2019 12:15:07 PM ?ecodp_contactPoint foaf:phone ?foaf_phone .
5/8/2019 12:15:07 PM ?ecodp_contactPoint foaf:name ?foaf_name .
5/8/2019 12:15:07 PM ?ecodp_contactPoint ecodp:contactAddress ?ecodp_contactAddres .
5/8/2019 12:15:07 PM ?ecodp_contactPoint foaf:workplaceHomepage ?foaf_workplaceHomepage.
5/8/2019 12:15:07 PM ?dataset dcat:distribution ?datafile .
5/8/2019 12:15:07 PM ?datafile dcat:accessURL ?downloadUrl.
5/8/2019 12:15:07 PM ?datafile a <http://www.w3.org/TR/vocab-dcat#Download>;
5/8/2019 12:15:07 PM ecodp:distributionFormat ?format;
5/8/2019 12:15:07 PM dct:description ?dftitle;
5/8/2019 12:15:07 PM dct:modified ?dfmodified
5/8/2019 12:15:07 PM}
5/8/2019 12:15:07 PMWHERE
5/8/2019 12:15:07 PM{
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM ?dataset a a:Data ;
5/8/2019 12:15:07 PM a:id ?id;
5/8/2019 12:15:07 PM dct:title ?title.
5/8/2019 12:15:07 PM OPTIONAL { ?dataset dct:issued ?effective }
5/8/2019 12:15:07 PM OPTIONAL { ?dataset dct:modified ?modified }
5/8/2019 12:15:07 PM OPTIONAL { ?dataset dct:isReplacedBy ?isreplaced }
5/8/2019 12:15:07 PM OPTIONAL { ?dataset dct:replaces ?replaces }
5/8/2019 12:15:07 PM {select (<https://www.eea.europa.eu/address.html> as ?ecodp_contactPoint) where {}}
5/8/2019 12:15:07 PM {select (<http://xmlns.com/foaf/0.1/Agent> as ?ecodp_contactPoint_type) where {}}
5/8/2019 12:15:07 PM {select ("+4533367100" as ?foaf_phone) where {}}
5/8/2019 12:15:07 PM {select ("European Environment Agency"@en as ?foaf_name) where {}}
5/8/2019 12:15:07 PM {select ("Kongens Nytorv 6, 1050 Copenhagen K, Denmark"@en as ?ecodp_contactAddres) where {}}
5/8/2019 12:15:07 PM {select (<https://www.eea.europa.eu> as ?foaf_workplaceHomepage) where {}}
5/8/2019 12:15:07 PM {select (STRDT("http://open-data.europa.eu/kos/licence/EuropeanCommission", skos:Concept) as ?odp_license) where {}}
5/8/2019 12:15:07 PM #use the real description if available
5/8/2019 12:15:07 PM OPTIONAL { ?dataset dct:description ?description_real }
5/8/2019 12:15:07 PM #set a default description if object has no description
5/8/2019 12:15:07 PM OPTIONAL {
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM SELECT ("No description available" as ?description_default)
5/8/2019 12:15:07 PM WHERE
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM ?dataset a a:Data
5/8/2019 12:15:07 PM OPTIONAL { ?dataset dct:description ?description }
5/8/2019 12:15:07 PM FILTER (!bound(?description))
5/8/2019 12:15:07 PM FILTER (?dataset = <http://www.eea.europa.eu/data-and-maps/data/large-combustion-plants-lcp-opted-out-under-article-4-4-of-directive-2001-80-ec-3> )
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM UNION
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM ?dataset dct:hasPart ?datatable.
5/8/2019 12:15:07 PM ?datatable dct:hasPart ?datafile.
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM SELECT DISTINCT ?datafile STRDT(bif:concat(?datafile,'/at_download/file'), xsd:anyURI) AS ?downloadUrl ?format
5/8/2019 12:15:07 PM WHERE
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM ?datafile a datafile:DataFile;
5/8/2019 12:15:07 PM dct:format ?format
5/8/2019 12:15:07 PM filter(str(?format) = "application/zip")
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM UNION
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM SELECT DISTINCT ?datafile STRDT(bif:concat(?datafile,'/at_download/file'), xsd:anyURI) AS ?downloadUrl ?format
5/8/2019 12:15:07 PM WHERE
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM SELECT DISTINCT ?datafile count(?format) as ?formatcnt
5/8/2019 12:15:07 PM WHERE
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM ?datafile a datafile:DataFile;
5/8/2019 12:15:07 PM dct:format ?format
5/8/2019 12:15:07 PM FILTER (str(?format) != 'application/zip')
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM . FILTER (?formatcnt = 1)
5/8/2019 12:15:07 PM ?datafile dct:format ?format
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM UNION
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM SELECT DISTINCT ?datafile STRDT(?remoteUrl, xsd:anyURI) AS ?downloadUrl 'application/octet-stream' AS ?format
5/8/2019 12:15:07 PM WHERE
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM ?datafile a datafilelink:DataFileLink;
5/8/2019 12:15:07 PM datafilelink:remoteUrl ?remoteUrl
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM UNION
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM SELECT DISTINCT ?datafile STRDT(bif:concat(?datafile,'/download.csv'), xsd:anyURI) AS ?downloadUrl 'text/csv' as ?format
5/8/2019 12:15:07 PM WHERE
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM ?datafile a sparql:Sparql
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM UNION
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM SELECT DISTINCT ?datafile STRDT(?datafile, xsd:anyURI) AS ?downloadUrl "file" as ?format
5/8/2019 12:15:07 PM WHERE {
5/8/2019 12:15:07 PM ?datafile a file:File
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM ?datafile dct:title ?dftitle .
5/8/2019 12:15:07 PM ?datafile dct:modified ?dfmodified
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM UNION
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM ?dataset dct:subject ?subject
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM UNION
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM ?dataset dct:subject ?theme FILTER (isLiteral(?theme) && !REGEX(?theme,'[()/]'))
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM UNION
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM ?dataset dct:spatial ?spatial .
5/8/2019 12:15:07 PM ?spatial owl:sameAs ?pubspatial
5/8/2019 12:15:07 PM FILTER(REGEX(?pubspatial, '^http://publications.europa.eu/resource/authority/country/'))
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM UNION
5/8/2019 12:15:07 PM {
5/8/2019 12:15:07 PM ?dataset cr:tag ?tag.
5/8/2019 12:15:07 PM ?dcat_theme a skos:Concept.
5/8/2019 12:15:07 PM ?dcat_theme rdfs:label ?tag.
5/8/2019 12:15:07 PM }
5/8/2019 12:15:07 PM FILTER (?dataset = <http://www.eea.europa.eu/data-and-maps/data/large-combustion-plants-lcp-opted-out-under-article-4-4-of-directive-2001-80-ec-3> )
5/8/2019 12:15:07 PM}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment