query-a240e636aea2e6c7171eb4b0a5ba0f97

rq turtle/ttl

Bouzinac

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?country ?countryLabel (COUNT(DISTINCT ?shares_border_with) AS ?border_count)
WHERE
{
  ?country wdt:P31 / wdt:P279 * wd:Q6256 . # ?country is country
  FILTER NOT EXISTS { ?country wdt:P576 ?dissolved . } # ?country is not dissolved
  ?country p:P47 ?shares_border_with_statement .
  ?shares_border_with_statement a wikibase:BestRank .
  ?shares_border_with_statement ps:P47 ?shares_border_with .
  ?shares_border_with wdt:P31 / wdt:P279 * wd:Q6256 . # ?shares_border_with is country
  FILTER NOT EXISTS { ?shares_border_with wdt:P582 ?end_time . } # No end time 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}
GROUP BY ?country ?countryLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?border_count") v3("?country"):::projected v4("?dissolved") v2("?end_time") v1("?shares_border_with"):::projected v5("?shares_border_with_statement") a1((" ")) a2((" ")) c8(["wikibase:BestRank"]):::iri c11(["bd:serviceParam"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal c5(["wd:Q6256"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"p:direct/P582"--> e0v2 e0v2("?end_time"):::projected e0v1("?shares_border_with"):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> v2 v1 --"p:direct/P582"--> v2 f1[["not "]] subgraph f1e1["Exists Clause"] e1v1 --"p:direct/P576"--> e1v2 e1v1("?country"):::projected e1v2("?dissolved"):::projected end f1--EXISTS--> f1e1 f1 --> v3 f1 --> c2 f1 --> v4 v3 --"p:direct/P576"--> v4 v3 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c5 v3 --"p:P47"--> v5 v5 --"a"--> c8 v5 --"p:statement/P47"--> v1 v1 --"p:direct/P31"--> a2 a2 --"p:direct/P279"--> c5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end bind3[/"count(?shares_border_with)"/] v1 --o bind3 bind3 --as--o v6