query-4ed59193b9885191ec69feecfb834935
Order of resultsHi! I am trying to get countries with this query:
Use at
- https://query.wikidata.org/sparql
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 {
?item wdt:P1440 "900206".
?item p:P1532 [ps:P1532 ?Country].
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
?item rdfs:label ?itemLabel .
?Country rdfs:label ?CountryLabel
}
}
GROUP BY ?item ?itemLabel
Query found at
- https://www.wikidata.org/wiki/User_talk:Dipsacus_fullonum
- https://www.wikidata.org/wiki/Wikidata:Request_a_query/Archive/2022/11
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?Country")
v4("?CountryLabel"):::projected
v5("?Countrys")
v1("?item"):::projected
v3("?itemLabel"):::projected
a1((" "))
c2(["900206"]):::literal
c6(["bd:serviceParam"]):::iri
c8(["en"]):::literal
v1 --"p:direct/P1440"--> c2
a1 --"p:statement/P1532"--> v2
v1 --"p:P1532"--> a1
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
v1 --"rdfs:label"--> v3
v2 --"rdfs:label"--> v4
end
bind1[/"?CountryLabel"/]
v4 --o bind1
bind1 --as--o v5