query-db71b7d6d40e81f8ff87e8dd58d31c23

rq turtle/ttl

UEFA Euro 2016 teams

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?team ?teamLabel (SAMPLE(?countryName) AS ?country) (COUNT(?player) AS ?playerCount) (GROUP_CONCAT(DISTINCT(?playerName);separator=", ") AS ?players) WHERE {
  ?team wdt:P31 wd:Q24199684 .
  OPTIONAL{?team wdt:P31 ?nationalTeam . ?nationalTeam wdt:P31 wd:Q6979593 . ?nationalTeam wdt:P1532 ?country . ?country rdfs:label ?countryName . FILTER(lang(?countryName) = "en")}
  OPTIONAL{?team wdt:P710 ?player . ?player rdfs:label ?playerName . FILTER(lang(?playerName) = "en")}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en,de"}
}
GROUP BY ?team ?teamLabel
ORDER BY ?playerCount

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?country") v3("?countryName"):::projected v5("?nationalTeam") v7("?player"):::projected v8("?playerCount") v2("?playerName"):::projected v8("?players") v4("?team"):::projected c4(["wd:Q6979593"]):::iri c9(["bd:serviceParam"]):::iri c11(["en,de"]):::literal c3(["wd:Q24199684"]):::iri v4 --"p:direct/P31"--> c3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:direct/P31".-> v5 v5 --"p:direct/P31"--> c4 v5 --"p:direct/P1532"--> v8 v8 --"rdfs:label"--> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:direct/P710".-> v7 v7 --"rdfs:label"--> v2 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end bind3[/"sample(?countryName)"/] v3 --o bind3 bind3 --as--o v8 bind4[/"count(?player)"/] v7 --o bind4 bind4 --as--o v8 bind5[/"?playerName"/] v2 --o bind5 bind5 --as--o v8