query-669636883c8bd8d7deafb2b48b1909c5

rq turtle/ttl

TODO ]reply[11:43, 10 June 2020 (UTC) JuraSomething like the above maybe --- ]reply[14:42, 10 June 2020 (UTC)) talk (Hannes RöstGreat! I added the "?linkTo" and now it works both as graph and as table. Now its quite easy to find issues in wikidata (missing bridges, self-links etc). Great, this helps a lot! --

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 pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?pic ?count ?coor ?dist (ROUND(?dist/10) as ?layer)
WHERE 
{

{
  SELECT ?item (COUNT(DISTINCT ?down) as ?count)
  {  ?item wdt:P177 wd:Q19686 ; wdt:P2674* ?down } 
  GROUP BY ?item
  ORDER BY DESC(?count) ?item
}  ?item wdt:P177 wd:Q19686 .
  OPTIONAL { ?item wdt:P18 ?pic }
  wd:Q19686 p:P625 [ ps:P625 ?coor_orig ; pq:P518 wd:Q7376362 ] .
  OPTIONAL { ?item wdt:P625 ?coor }
  FILTER ( ?item != wd:Q1868889 )
  BIND(ROUND(geof:distance(?coor_orig, ?coor)) as ?dist)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?count) DESC(?dist) ?item

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?coor"):::projected v6("?coor_orig") v5("?count"):::projected v8("?dist"):::projected v4("?down") v3("?item"):::projected v8("?layer") v5("?pic"):::projected a1((" ")) c12(["bd:serviceParam"]):::iri c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal c8(["wd:Q7376362"]):::iri c3(["wd:Q19686"]):::iri f0[["?item != 'wd:Q1868889'"]] f0 --> v3 v3 --"p:direct/P177"--> c3 v3 --"p:direct/P2674"--> v4 bind2[/"count(?down)"/] v4 --o bind2 bind2 --as--o v5 v3 --"p:direct/P177"--> c3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P18".-> v5 end a1 --"p:statement/P625"--> v6 a1 --"p:qualifier/P518"--> c8 c3 --"p:P625"--> a1 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P625".-> v7 end bind3[/"numeric-round(http://www.opengis.net/def/function/geosparql/distance(?coor_orig,?coor))"/] v6 --o bind3 v7 --o bind3 bind3 --as--o v8 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end bind4[/"numeric-round(?dist / '10^^xsd:integer')"/] v8 --o bind4 bind4 --as--o v8