query-a56644a2a517b03ec8eb61d579847a99

rq turtle/ttl

Countries spanning more than one continentAf few soverign countries span more than one continent:

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#>
SELECT ?state ?stateLabel (COUNT(?continent) AS ?contCount) (GROUP_CONCAT(?continent_label; separator=", ") AS ?continents)
WHERE
{
    ?state wdt:P31 wd:Q3624078;
      wdt:P30 ?continent.
    OPTIONAL {?continent rdfs:label ?continent_label. FILTER (LANG(?continent_label) = "en"). }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?state ?stateLabel
HAVING (COUNT(?continent) > 1)
ORDER BY DESC(?contCount) ?stateLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?_anon_42b5416610844a34809f33a099ae9de188227") v7("?contCount") v5("?continent"):::projected v3("?continent_label"):::projected v7("?continents") v4("?state"):::projected v2("?stateLabel"):::projected a1((" ")) c4(["wd:Q3624078"]):::iri c8(["bd:serviceParam"]):::iri c2(["en"]):::literal f0[[" > '1^^xsd:integer'"]] f0 --> a1 v4 --"wdt:P31"--> c4 v4 --"wdt:P30"--> v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."rdfs:label".-> v3 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c2 end bind4[/"count(?continent)"/] v5 --o bind4 bind4 --as--o v6 bind5[/"count(?continent)"/] v5 --o bind5 bind5 --as--o v7 bind6[/"?continent_label"/] v3 --o bind6 bind6 --as--o v7