EuKnowledgeGraph:SPARQL query service/queries/examples

From EU Knowledge Graph
Jump to navigation Jump to search

This page is parsed by the web interface of the query service to fill the query example dialog.


Queries about the European Union

Countries in the EU with their french name

SELECT DISTINCT ?c ?country WHERE 
{ 
   wd:Q1 wdt:P104  ?c .
   ?c rdfs:label ?country .
   FILTER (lang(?country)="fr")
}
Try it! (en)

European Countries with their population

SELECT DISTINCT ?country ?population WHERE 
{ 
   wd:Q1 wdt:P104  ?c .
   ?c wdt:P9  ?population .  
   ?c rdfs:label ?country .
   FILTER (lang(?country)="en")
}  order by desc(?population)
Try it! (en)

Kohesio queries

Query to find the top 50 beneficiaries of Kohesio projects

select ?beneficiaryID ?totalBudget ?name ?country (uri(CONCAT('https://wikidata.org/entity/',STR( ?wikidata_id ))) as ?wikidata) where {
{
   select ?beneficiaryID (round(sum(?b) *100)/100 as ?totalBudget) where {
      ?project wdt:P889 ?beneficiaryID .
      ?project wdt:P835 ?b .
  } group by ?beneficiaryID  order by desc(?totalBudget) limit 50
}
OPTIONAL {?beneficiaryID wdt:P1 ?wikidata_id . }
OPTIONAL {?beneficiaryID rdfs:label ?name . FILTER (lang(?name)="cs")}
}
Try it! (en)

Query to find the top 50 beneficiaries of Kohesio projects in Czechia

select ?beneficiaryID ?totalBudget ?name ?country (uri(CONCAT('https://wikidata.org/entity/',STR( ?wikidata_id ))) as ?wikidata) where {
{
   select ?beneficiaryID (round(sum(?b)*100)/100 as ?totalBudget) where {
      ?project wdt:P889 ?beneficiaryID .
      ?project wdt:P835 ?b .
      ?project wdt:P32 wd:Q25 .
   } group by ?beneficiaryID  order by desc(?totalBudget) limit 50
}
OPTIONAL {?beneficiaryID wdt:P1 ?wikidata_id . }
OPTIONAL {?beneficiaryID rdfs:label ?name . FILTER (lang(?name)="cs")}
}
Try it! (en)

All Kohesio project in France on a map

#defaultView:Map
select ?project ?coordinates where {
?project wdt:P35 wd:Q9934 .
?project wdt:P32 wd:Q20 .
?project wdt:P127 ?coordinates .
}
Try it! (en)

Number of Kohesio project in Italy

select (xsd:integer(count(?s)) as ?sum) where {
    ?s wdt:P35 wd:Q9934 .
    ?s wdt:P32 wd:Q15 .
}
Try it! (en)

Number of Kohesio project by country

#defaultView:BarChart
select ?countryLabel ?sum {
{
  select ?country (xsd:integer(count(?s)) as ?sum) where {
    ?s wdt:P35 wd:Q9934 .
    ?s wdt:P32 ?country .
  } group by ?country
}
  wd:Q1 wdt:P104 ?country .
  OPTIONAL {?country rdfs:label ?countryLabel .
  FILTER (lang(?countryLabel)='en')}
}
Try it! (en)

Total Budget of Kohesio project by intervention field

#defaultView:BarChart
SELECT ?interventionLabel ?sum WHERE 
{
   {
      select ?intervention (xsd:integer(sum(?o)) as ?sum) where 
      {
         ?project wdt:P35 wd:Q9934 .
         ?project wdt:P888 ?intervention .
         ?project wdt:P835 ?o .
      } group by ?intervention
   }
   ?intervention wdt:P35 wd:Q200769 .
   OPTIONAL {?intervention rdfs:label ?interventionLabel .
   FILTER (lang(?interventionLabel)='en')}
}
Try it! (en)

Total Budget of Kohesio project by country

#defaultView:BarChart
select ?countryLabel ?sum WHERE 
{
  {
    select ?country (xsd:integer(sum(?euBudget)) as ?sum) where {
       ?project wdt:P35 wd:Q9934 .
       ?project wdt:P32 ?country .
       ?project wdt:P835 ?euBudget .
    } group by ?country
  }
  wd:Q1 wdt:P104 ?country .
  ?country rdfs:label ?countryLabel .
  FILTER (lang(?countryLabel)='en')
}
Try it! (en)

Linked Data Solutions

Linked Data Solutions currently in this catalogue

#title:Linked Data Solutions currently in this catalogue, maintained by the Publications Office of EU

PREFIX wdt: <https://linkedopendata.eu/prop/direct/>
PREFIX wd: <https://linkedopendata.eu/entity/>

SELECT DISTINCT ?solution ?solutionLabel ?description

{?solution wdt:P35 wd:Q2839858;

    
    OPTIONAL {?solution schema:description ?description 
              FILTER (LANG(?description) = "en")}
 
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }

ORDER BY DESC(?description)
Linked Data Solutions currently in this catalogue, maintained by the Publications Office of EU

(Linked Data Solution) - uses -> (Component or another Linked Data Solution)

#defaultView:Graph
#title: (Linked Data Solution) - uses -> (Component or another Linked Data Solution)
SELECT DISTINCT ?LDS ?LDSLabel ?used ?usedLabel

{?LDS wdt:P35 wd:Q2839858;
    wdt:P531+ ?used .

 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

}
(Linked Data Solution) - uses -> (Component or another Linked Data Solution)