query-a624c6ba5a9ecd65652a7a3d49342112

rq turtle/ttl

TODO

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?item ?itemLabel (GROUP_CONCAT(?CountryLabel; separator=", ") AS ?Countrys) WHERE
{
   {
  SELECT ?item ?itemLabel ?CountryLabel ?sort where {
  ?item wdt:P1440 "900206".
  ?item p:P1532 [ps:P1532 ?Country].
  BIND(xsd:integer(STRAFTER(STR(?Country),"Q")) as ?sort)
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
    ?item rdfs:label ?itemLabel .
    ?Country rdfs:label ?CountryLabel           
  }
} order by desc(?sort) }}          
GROUP BY ?item ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?Country") v5("?CountryLabel"):::projected v6("?Countrys") v2("?item"):::projected v4("?itemLabel"):::projected v4("?sort") a1((" ")) c2(["900206"]):::literal c6(["bd:serviceParam"]):::iri c8(["en"]):::literal v2 --"p:direct/P1440"--> c2 a1 --"p:statement/P1532"--> v3 v2 --"p:P1532"--> a1 bind0[/"http://www.w3.org/2001/XMLSchema#integer(substring-after(str(?Country),'Q'))"/] v3 --o bind0 bind0 --as--o v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 v2 --"rdfs:label"--> v4 v3 --"rdfs:label"--> v5 end bind2[/"?CountryLabel"/] v5 --o bind2 bind2 --as--o v6