query-e619ccaac572012ed0f5f1e688022fbd

rq turtle/ttl

PropertiesDrobné památky ID (P6736)located in the administrative territorial entity (P131)coordinate location (P625)instance of (P31)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
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 ?place ?placeLabel ?distance WHERE {
  {
SELECT ?item ?place ?distance WHERE {
  {
    SELECT ?item ?itemLabel ?place ?placeLabel ?distance WHERE {
      {
        SELECT ?item ?coord {
          BIND( (19 - 12) * RAND() + 12 AS ?rand ) .
          ?item wdt:P6736 []; wdt:P131* wd:Q757240 ; p:P625 [ ps:P625 ?coord; psv:P625/wikibase:geoLongitude ?long ] .
          FILTER ( ABS( ?long - ?rand ) < 1 ) . # feel free to play with this...
        } 
      } .
      SERVICE wikibase:around {
        ?place wdt:P625 ?location .
        bd:serviceParam wikibase:center ?coord .
        bd:serviceParam wikibase:radius "0.05" .
        bd:serviceParam wikibase:distance ?distance .
      } .
      minus {?place wdt:P6736 [] .}
      FILTER ( ?item != ?place ) .
    }
  } .
} 

}
values ?instance {
wd:Q2309609
wd:Q179700
wd:Q14552192
wd:Q575759
wd:Q12661150
wd:Q860861
wd:Q721747
wd:Q5003624
wd:Q12029081
wd:Q108325
wd:Q2713614
wd:Q4989906
wd:Q1640496
wd:Q38395546
  }
?place wdt:P31 ?instance .
SERVICE wikibase:label { bd:serviceParam wikibase:language "cs,en". }
} order by asc(?distance)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?coord") v1("?distance"):::projected v8("?instance") v2("?item"):::projected v7("?location") v4("?long") v3("?place"):::projected v6("?rand") a1((" ")) a4((" ")) a2((" ")) a3((" ")) c19(["cs,en"]):::literal c4(["wd:Q757240"]):::iri c11(["bd:serviceParam"]):::iri c14(["0.05"]):::literal f0[["?item != ?place"]] f0 --> v2 f0 --> v3 f1[["numeric-abs(?long - ?rand) < '1^^xsd:integer'"]] f1 --> v4 f1 --> v6 bind2[/"'19^^xsd:integer' - '12^^xsd:integer' * RAND() + '12^^xsd:integer'"/] bind2 --as--o v6 v2 --"p:direct/P6736"--> a1 v2 --"p:direct/P131"--> c4 a2 --"p:statement/P625"--> v6 a2 --"p:statement/value/P625"--> a3 a3 --"wikibase:geoLongitude"--> v4 v2 --"p:P625"--> a2 subgraph s1["http://wikiba.se/ontology#around"] style s1 stroke-width:4px; v3 --"p:direct/P625"--> v7 c11 --"wikibase:center"--> v6 c11 --"wikibase:radius"--> c14 c11 --"wikibase:distance"--> v1 end subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; v3 --"p:direct/P6736"--> a4 end bind4[/VALUES ?instance/] bind4-->v8 bind40(["wd:Q2309609"]) bind40 --> bind4 bind41(["wd:Q179700"]) bind41 --> bind4 bind42(["wd:Q14552192"]) bind42 --> bind4 bind43(["wd:Q575759"]) bind43 --> bind4 bind44(["wd:Q12661150"]) bind44 --> bind4 bind45(["wd:Q860861"]) bind45 --> bind4 bind46(["wd:Q721747"]) bind46 --> bind4 bind47(["wd:Q5003624"]) bind47 --> bind4 bind48(["wd:Q12029081"]) bind48 --> bind4 bind49(["wd:Q108325"]) bind49 --> bind4 bind410(["wd:Q2713614"]) bind410 --> bind4 bind411(["wd:Q4989906"]) bind411 --> bind4 bind412(["wd:Q1640496"]) bind412 --> bind4 bind413(["wd:Q38395546"]) bind413 --> bind4 v3 --"p:direct/P31"--> v8 subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c11 --"wikibase:language"--> c19 end