Examples

aftiqb edited this page Oct 1, 2012 · 3 revisions
Clone this wiki locally

1) Electricity generated from renewable sources (1990-). Query provided by Soren Roug

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX qb: <http://purl.org/linked-data/cube#>
PREFIX estat: <http://eurostat.linked-statistics.org/property#>
PREFIX sdmx-dimension: <http://purl.org/linked-data/sdmx/2009/dimension#>
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#>
PREFIX geo: <http://eurostat.linked-statistics.org/dic/geo#>
PREFIX dataset: <http://eurostat.linked-statistics.org/data/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX eont: <http://rdfdata.eionet.europa.eu/estat/ontology/>

SELECT ?country  xsd:double(?percentage) AS ?percentage ?year
FROM <http://eurostat.linked-statistics.org/data/nrg_ind_333a.rdf>
FROM <http://eurostat.linked-statistics.org/dic/geo.rdf>
WHERE {
?obsrec qb:dataSet dataset:nrg_ind_333a ;
sdmx-dimension:timePeriod ?year;
sdmx-dimension:freq <http://purl.org/linked-data/sdmx/2009/code#freq-A>;
estat:unit <http://eurostat.linked-statistics.org/dic/unit#PC>;
estat:geo ?ucountry;
sdmx-measure:obsValue ?percentage.
?ucountry rdfs:label ?country
} ORDER BY ?country ?year

2) Biotechnology patent applications to the EPO by priority year at the national level. Query example provided by Amrapali

PREFIX qb: <http://purl.org/linked-data/cube#>
PREFIX e: <http://ontologycentral.com/2009/01/eurostat/ns#>
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX g:<http://eurostat.linked-statistics.org/ontologies/geographic.rdf#>
PREFIX dataset: <http://eurostat.linked-statistics.org/data/>
PREFIX ns: <http://eurostat.linked-statistics.org/property#>
PREFIX dimension: <http://purl.org/linked-data/sdmx/2009/dimension#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?country ?observation ?year
FROM <http://eurostat.org/>
WHERE
{?val qb:dataSet dataset:pat_ep_nbio;
sdmx-measure:obsValue ?observation;
ns:geo ?country;
ns:unit ?unit;
dimension:timePeriod ?year.
FILTER ((?year="1999-01-01"^^xsd:date) || (?year="2000-01-01"^^xsd:date)
|| (?year="2001-01-01"^^xsd:date) || (?year="2002-01-01"^^xsd:date) ||
(?year="2003-01-01"^^xsd:date) || (?year="2004-01-01"^^xsd:date) ||
(?year="2005-01-01"^^xsd:date) || (?year="2006-01-01"^^xsd:date) ||
(?year="2007-01-01"^^xsd:date) || (?year="2008-01-01"^^xsd:date) ||
(?year="2009-01-01"^^xsd:date))
FILTER (regex(?unit, "MIO_ACT"))
FILTER (regex(?country, "AT") || regex(?country, "BE")  ||
regex(?country, "BG") || regex(?country, "CZ") || regex(?country, "DK")
|| regex(?country, "DE") || regex(?country, "EE") || regex(?country,
"IE") || regex(?country, "EL") || regex(?country, "ES") ||
regex(?country, "FR") || regex(?country, "IT") || regex(?country, "CY")
|| regex(?country, "LV") || regex(?country, "LT")  || regex(?country,
"LU") || regex(?country, "HU") || regex(?country, "MT") ||
regex(?country, "NL") || regex(?country, "PL") || regex(?country, "PT")
|| regex(?country, "RO") || regex(?country, "SI") || regex(?country,
"SK") || regex(?country, "FI") || regex(?country, "SE") ||
regex(?country, "UK"))
} ORDER BY ?country

3) Annual expenditure on public and private educational institutions per pupil/student. Query example provided by Amrapali

PREFIX qb: <http://purl.org/linked-data/cube#>
PREFIX e: <http://ontologycentral.com/2009/01/eurostat/ns#>
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX g: <http://eurostat.linked-statistics.org/ontologies/geographic.rdf#>
PREFIX dataset: <http://eurostat.linked-statistics.org/data/>
PREFIX ns: <http://eurostat.linked-statistics.org/property#>
PREFIX dimension: <http://purl.org/linked-data/sdmx/2009/dimension#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?country ?observation ?year
FROM <http://eurostat.org/>
WHERE
{?val qb:dataSet dataset:tps00067;
sdmx-measure:obsValue ?observation;
ns:geo ?country;
ns:indic_ed ?unit;
dimension:timePeriod ?year.
FILTER ((?year="1999-01-01"^^xsd:date) || (?year="2000-01-01"^^xsd:date)
|| (?year="2001-01-01"^^xsd:date) || (?year="2002-01-01"^^xsd:date) ||
(?year="2003-01-01"^^xsd:date) || (?year="2004-01-01"^^xsd:date) ||
(?year="2005-01-01"^^xsd:date) || (?year="2006-01-01"^^xsd:date) ||
(?year="2007-01-01"^^xsd:date) || (?year="2008-01-01"^^xsd:date) ||
(?year="2009-01-01"^^xsd:date))
FILTER regex(?unit, "FT01_1")
FILTER (regex(?country, "AT") || regex(?country, "BE")  ||
regex(?country, "BG") || regex(?country, "CZ") || regex(?country, "DK")
|| regex(?country, "DE") || regex(?country, "EE") || regex(?country,
"IE") || regex(?country, "EL") || regex(?country, "ES") ||
regex(?country, "FR") || regex(?country, "IT") || regex(?country, "CY")
|| regex(?country, "LV") || regex(?country, "LT")  || regex(?country,
"LU") || regex(?country, "HU") || regex(?country, "MT") ||
regex(?country, "NL") || regex(?country, "PL") || regex(?country, "PT")
|| regex(?country, "RO") || regex(?country, "SI") || regex(?country,
"SK") || regex(?country, "FI") || regex(?country, "SE") ||
regex(?country, "UK"))
} ORDER BY ?country

4) Financial aid to students. Query example provided by Amrapali

PREFIX qb: <http://purl.org/linked-data/cube#>
PREFIX e: <http://ontologycentral.com/2009/01/eurostat/ns#>
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX g: <http://eurostat.linked-statistics.org/ontologies/geographic.rdf#>
PREFIX dataset: <http://eurostat.linked-statistics.org/data/>
PREFIX ns: <http://eurostat.linked-statistics.org/property#>
PREFIX dimension: <http://purl.org/linked-data/sdmx/2009/dimension#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?country ?observation ?year
FROM <http://eurostat.org/>
WHERE
{?val qb:dataSet dataset:educ_fiaid;
sdmx-measure:obsValue ?observation;
ns:geo ?country;
ns:indic_ed ?unit;
dimension:timePeriod ?year.
FILTER ((?year="1999-01-01"^^xsd:date) || (?year="2000-01-01"^^xsd:date)
|| (?year="2001-01-01"^^xsd:date) || (?year="2002-01-01"^^xsd:date) ||
(?year="2003-01-01"^^xsd:date) || (?year="2004-01-01"^^xsd:date) ||
(?year="2005-01-01"^^xsd:date) || (?year="2006-01-01"^^xsd:date) ||
(?year="2007-01-01"^^xsd:date) || (?year="2008-01-01"^^xsd:date) ||
(?year="2009-01-01"^^xsd:date))
FILTER regex(?unit, "FD01_1")
FILTER (regex(?country, "AT") || regex(?country, "BE")  ||
regex(?country, "BG") || regex(?country, "CZ") || regex(?country, "DK")
|| regex(?country, "DE") || regex(?country, "EE") || regex(?country,
"IE") || regex(?country, "EL") || regex(?country, "ES") ||
regex(?country, "FR") || regex(?country, "IT") || regex(?country, "CY")
|| regex(?country, "LV") || regex(?country, "LT")  || regex(?country,
"LU") || regex(?country, "HU") || regex(?country, "MT") ||
regex(?country, "NL") || regex(?country, "PL") || regex(?country, "PT")
|| regex(?country, "RO") || regex(?country, "SI") || regex(?country,
"SK") || regex(?country, "FI") || regex(?country, "SE") ||
regex(?country, "UK"))
} ORDER BY ?country

5) Economically active population by sex and age, at NUTS levels 1, 2 and 3. Since this data had several values for one country e.g., AT1, AT11 etc., for Austria, had to replace FILTER to match exact country codes. Also sex was taken as total. Query example provided by Amrapali

PREFIX qb: <http://purl.org/linked-data/cube#>
PREFIX e: <http://ontologycentral.com/2009/01/eurostat/ns#>
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX g: <http://eurostat.linked-statistics.org/ontologies/geographic.rdf#>
PREFIX dataset: <http://eurostat.linked-statistics.org/data/>
PREFIX ns: <http://eurostat.linked-statistics.org/property#>
PREFIX dimension: <http://purl.org/linked-data/sdmx/2009/dimension#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?country ?observation ?year
FROM <http://eurostat.org/>
WHERE
{?val qb:dataSet dataset:lfst_r_lfp3pop;
sdmx-measure:obsValue ?observation;
ns:geo ?country;
ns:age ?age;
ns:sex ?sex;
dimension:timePeriod ?year.
FILTER regex(?age, "Y15-24")
FILTER regex(?sex, "T")
FILTER ((?year="1999-01-01"^^xsd:date) || (?year="2000-01-01"^^xsd:date)
|| (?year="2001-01-01"^^xsd:date) || (?year="2002-01-01"^^xsd:date) ||
(?year="2003-01-01"^^xsd:date) || (?year="2004-01-01"^^xsd:date) ||
(?year="2005-01-01"^^xsd:date) || (?year="2006-01-01"^^xsd:date) ||
(?year="2007-01-01"^^xsd:date) || (?year="2008-01-01"^^xsd:date) ||
(?year="2009-01-01"^^xsd:date))
FILTER ((?country=<http://eurostat.linked-statistics.org/dic/geo#AT>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#BG>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#BE>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#CZ>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#DK>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#DE>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#EE>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#IE>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#EL>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#ES>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#FR>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#PL>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#IT>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#PT>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#CY>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#RO>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#LV>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#SI>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#LT>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#SK>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#LU>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#FI>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#HU>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#SE>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#MT>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#UK>) ||
(?country=<http://eurostat.linked-statistics.org/dic/geo#NL>))
} ORDER BY ?country ?year

6) Research and development personnel, by sectors of performance head count (% of the labour force). Query example provided by Amrapali

PREFIX qb: <http://purl.org/linked-data/cube#>
PREFIX e: <http://ontologycentral.com/2009/01/eurostat/ns#>
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX g: <http://eurostat.linked-statistics.org/ontologies/geographic.rdf#>
PREFIX dataset: <http://eurostat.linked-statistics.org/data/>
PREFIX ns: <http://eurostat.linked-statistics.org/property#>
PREFIX dimension: <http://purl.org/linked-data/sdmx/2009/dimension#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?country ?observation ?year
FROM <http://eurostat.org/>
WHERE
{?val qb:dataSet dataset:tsc00002;
sdmx-measure:obsValue ?observation;
ns:geo ?country;
ns:sectperf ?unit;
dimension:timePeriod ?year.
FILTER ((?year="1999-01-01"^^xsd:date) || (?year="2000-01-01"^^xsd:date)
|| (?year="2001-01-01"^^xsd:date) || (?year="2002-01-01"^^xsd:date) ||
(?year="2003-01-01"^^xsd:date) || (?year="2004-01-01"^^xsd:date) ||
(?year="2005-01-01"^^xsd:date) || (?year="2006-01-01"^^xsd:date) ||
(?year="2007-01-01"^^xsd:date) || (?year="2008-01-01"^^xsd:date) ||
(?year="2009-01-01"^^xsd:date))
FILTER regex(?unit, "TOTAL")
FILTER (regex(?country, "AT") || regex(?country, "BE")  ||
regex(?country, "BG") || regex(?country, "CZ") || regex(?country, "DK")
|| regex(?country, "DE") || regex(?country, "EE") || regex(?country,
"IE") || regex(?country, "EL") || regex(?country, "ES") ||
regex(?country, "FR") || regex(?country, "IT") || regex(?country, "CY")
|| regex(?country, "LV") || regex(?country, "LT")  || regex(?country,
"LU") || regex(?country, "HU") || regex(?country, "MT") ||
regex(?country, "NL") || regex(?country, "PL") || regex(?country, "PT")
|| regex(?country, "RO") || regex(?country, "SI") || regex(?country,
"SK") || regex(?country, "FI") || regex(?country, "SE") ||
regex(?country, "UK"))
} ORDER BY ?country ?year