query-3b2228a77003c2ddd83ac079da9dc6c1

rq turtle/ttl

Articles around a central location - here Trondheim city square (Q15693034).

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Articles around a central location - here Trondheim city square (Q15693034).
#defaultView:Map{"hide":["?rgb","?layer","?location"]}
SELECT
  ?place ?placeLabel ?location ?article_no ?article_en ?rgb ?layer
  (ROUND(?dist * 1000) AS ?distance)
WHERE {
  wd:Q15693034 wdt:P625 ?centralLoc
  SERVICE wikibase:around {
    ?place wdt:P625 ?location .
    bd:serviceParam wikibase:center ?centralLoc;
      wikibase:radius "3";
      wikibase:distance ?dist
  }
  OPTIONAL {
    ?article_no schema:about ?place;
      schema:isPartOf <https://no.wikipedia.org/>
  }
  OPTIONAL {
    ?article_en schema:about ?place;
      schema:isPartOf <https://en.wikipedia.org/>
  }
  FILTER(BOUND(?article_no)|| BOUND(?article_en))
  BIND (IF(BOUND(?article_en) && BOUND(?article_no),"00ff00",IF(BOUND(?article_en),"ff0000",IF(BOUND(?article_no),"0000ff","000000" ))) as ?rgb)
  BIND (IF(BOUND(?article_en) && BOUND(?article_no),"EN & NO",IF(BOUND(?article_en),"EN",IF(BOUND(?article_no),"NO","NIL" ))) as ?layer)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "nb,en" }
}
ORDER BY ?dist

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?article_en"):::projected v2("?article_no"):::projected v4("?centralLoc") v1("?dist"):::projected v9("?distance") v8("?layer"):::projected v6("?location"):::projected v5("?place"):::projected v7("?rgb"):::projected c1(["wd:Q15693034"]):::iri c12([https://en.wikipedia.org/]):::iri c4(["bd:serviceParam"]):::iri c7(["3"]):::literal c11([https://no.wikipedia.org/]):::iri c15(["nb,en"]):::literal f0[["(bound(?article_no) || bound(?article_en))"]] f0 --> v2 f0 --> v3 c1 --"wdt:P625"--> v4 subgraph s1["http://wikiba.se/ontology#around"] style s1 stroke-width:4px; v5 --"wdt:P625"--> v6 c4 --"wikibase:center"--> v4 c4 --"wikibase:radius"--> c7 c4 --"wikibase:distance"--> v1 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."schema:about".-> v5 v2 --"schema:isPartOf"--> c11 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."schema:about".-> v5 v3 --"schema:isPartOf"--> c12 end bind1[/"if(bound(?article_en)bound(?article_no),'00ff00',if(bound(?article_en),'ff0000',if(bound(?article_no),'0000ff','000000')))"/] v3 --o bind1 v2 --o bind1 bind1 --as--o v7 bind2[/"if(bound(?article_en)bound(?article_no),'EN & NO',if(bound(?article_en),'EN',if(bound(?article_no),'NO','NIL')))"/] v3 --o bind2 v2 --o bind2 bind2 --as--o v8 subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c4 --"wikibase:language"--> c15 end bind3[/"numeric-round(?dist * '1000^^xsd:integer')"/] v1 --o bind3 bind3 --as--o v9