query-c76b1b7c2d88c65d7cc2fae993dd7a14

rq turtle/ttl

PropertiesDrobné památky ID (P6736)coordinate location (P625)

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
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 ?itemLabel ?place ?placeLabel ?distance WHERE {
      {
        SELECT ?item ?coord {
          BIND( (19 - 12) * RAND() + 12 AS ?rand ) .
          ?item wdt:P6736 []; p:P625 [ ps:P625 ?coord; psv:P625/wikibase:geoLongitude ?long ] .
          bind(substr(str(?item),33) as ?no ) filter((xsd:integer(?no)) > 111268976).

          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 ) .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "cs" } .
    }
  } .
  FILTER( SUBSTR( STR( ?itemLabel ), 1, 1 ) = SUBSTR( STR( ?placeLabel ), 1, 1 ) ) .
} ORDER BY ?itemLabel ?placeLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?coord") v10("?distance"):::projected v3("?item"):::projected v1("?itemLabel"):::projected v9("?location") v5("?long") v9("?no") v4("?place"):::projected v2("?placeLabel"):::projected v8("?rand") a1((" ")) a4((" ")) a2((" ")) a3((" ")) c17(["cs"]):::literal c10(["bd:serviceParam"]):::iri c13(["0.05"]):::literal f0[["substring(str(?itemLabel),'1^^xsd:integer','1^^xsd:integer') = substring(str(?placeLabel),'1^^xsd:integer','1^^xsd:integer')"]] f0 --> v1 f0 --> v2 f1[["?item != ?place"]] f1 --> v3 f1 --> v4 f2[["numeric-abs(?long - ?rand) < '1^^xsd:integer'"]] f2 --> v5 f2 --> v8 f3[["http://www.w3.org/2001/XMLSchema#integer(?no) > '111268976^^xsd:integer'"]] f3 --> v9 bind4[/"'19^^xsd:integer' - '12^^xsd:integer' * RAND() + '12^^xsd:integer'"/] bind4 --as--o v8 v3 --"p:direct/P6736"--> a1 a2 --"p:statement/P625"--> v8 a2 --"p:statement/value/P625"--> a3 a3 --"wikibase:geoLongitude"--> v5 v3 --"p:P625"--> a2 bind5[/"substring(str(?item),'33^^xsd:integer')"/] v3 --o bind5 bind5 --as--o v9 subgraph s1["http://wikiba.se/ontology#around"] style s1 stroke-width:4px; v4 --"p:direct/P625"--> v9 c10 --"wikibase:center"--> v8 c10 --"wikibase:radius"--> c13 c10 --"wikibase:distance"--> v10 end subgraph minus6["MINUS"] style minus6 stroke-width:6px,fill:pink,stroke:red; v4 --"p:direct/P6736"--> a4 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c10 --"wikibase:language"--> c17 end