query-9b1a1ab2dce937c92248a3f3ef04a34a
Help to discard duplicated coordinatedHi: I have this query:
Use at
- https://query.wikidata.org/sparql
 
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 geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?place ?placeLabel ?dist ?placeDescription (SAMPLE(?coords) as ?coord) (SAMPLE(?image) AS ?image)
          WHERE {
              SERVICE wikibase:around {
                ?place wdt:P625 ?coords.
                                bd:serviceParam wikibase:center 'Point(-3.2485 37.5873)'^^geo:wktLiteral.
                bd:serviceParam wikibase:radius '70'. }
              { ?place (wdt:P31/(wdt:P279*)) wd:Q386426. }
              UNION
              { ?place (wdt:P31/(wdt:P279*)) wd:Q20671979. }
              UNION
              {
                VALUES ?prop { wdt:P677 wdt:P757 wdt:P809 wdt:P1732 wdt:P1848 wdt:P2467
                wdt:P2516 wdt:P2520 wdt:P2525 wdt:P2584 wdt:P2621 wdt:P2763
                  wdt:P3009 wdt:P3296 wdt:P3327 wdt:P3401 wdt:P3412 wdt:P3425
                  wdt:P3498 wdt:P3515 wdt:P3516 wdt:P3609 wdt:P3613 wdt:P3810
                  wdt:P3974 wdt:P4001 wdt:P4029 wdt:P4083 wdt:P4154 wdt:P4171
                  wdt:P4170 wdt:P4172 wdt:P4182 wdt:P4190 wdt:P4762 wdt:P4800
                  wdt:P4977 wdt:P5965 wdt:P6070 wdt:P6230 wdt:P6280 wdt:P6478
                  wdt:P6560 wdt:P6602 wdt:P6659 wdt:P6700 wdt:P7129 wdt:P7308
                  wdt:P8114 wdt:P9516 wdt:P9552 wdt:P9755 wdt:P10015 wdt:P10392 wdt:P10513 wdt:P10514 }
                ?place ?prop ?natural.
              }
            SERVICE wikibase:label {
              bd:serviceParam wikibase:language 'es,en'.}
            SERVICE wikibase:label {
              bd:serviceParam wikibase:language "es,en".
             ?place schema:description ?placeDescription.
            }
            OPTIONAL { ?place wdt:P18 ?image. }
            OPTIONAL { ?place wdt:P17 ?country. }
  BIND(geof:distance("Point(-3.2485 37.5873 )"^^geo:wktLiteral, ?coords) AS ?dist)            FILTER NOT EXISTS {?place wdt:P576 ?bar.}
            FILTER NOT EXISTS {?place wdt:P582 ?bar.}
            }
            GROUP BY ?place ?placeLabel ?dist ?placeDescription
            ORDER BY ?dist
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?bar")
  v10("?coord")
  v4("?coords"):::projected 
  v9("?country")
  v10("?dist"):::projected 
  v11("?image"):::projected 
  v6("?natural")
  v2("?place"):::projected 
  v7("?placeDescription"):::projected 
  v5("?prop")
  a1((" "))
  a2((" "))
  c16(["es,en"]):::literal 
  c7([sPoint(-3.2485 37.5873)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]):::literal 
  c5(["bd:serviceParam"]):::iri 
  c13(["wd:Q20671979"]):::iri 
  c12(["wd:Q386426"]):::iri 
  c9(["70"]):::literal 
  f0[["not  "]]
  subgraph f0e0["Exists Clause"]
    e0v1 --"wdt:P582"-->  e0v2
    e0v2("?bar"):::projected 
    e0v1("?place"):::projected 
  end
  f0--EXISTS--> f0e0
  f0 --> v2
  f0 --> c1
  f0 --> v3
  v2 --"wdt:P582"-->  v3
  f1[["not  "]]
  subgraph f1e1["Exists Clause"]
    e1v1 --"wdt:P576"-->  e1v2
    e1v2("?bar"):::projected 
    e1v1("?place"):::projected 
  end
  f1--EXISTS--> f1e1
  f1 --> v2
  f1 --> c2
  f1 --> v3
  v2 --"wdt:P576"-->  v3
  subgraph s1["http://wikiba.se/ontology#around"]
    style s1 stroke-width:4px;
    v2 --"wdt:P625"-->  v4
    c5 --"wikibase:center"-->  c7
    c5 --"wikibase:radius"-->  c9
  end
  subgraph union0[" Union "]
  subgraph union0l[" "]
    style union0l fill:#abf,stroke-dasharray: 3 3;
    subgraph union1[" Union "]
    subgraph union1l[" "]
      style union1l fill:#abf,stroke-dasharray: 3 3;
      bind2[/VALUES ?prop/]
      bind2-->v5
      bind20(["wdt:P677"])
      bind20 --> bind2
      bind21(["wdt:P757"])
      bind21 --> bind2
      bind22(["wdt:P809"])
      bind22 --> bind2
      bind23(["wdt:P1732"])
      bind23 --> bind2
      bind24(["wdt:P1848"])
      bind24 --> bind2
      bind25(["wdt:P2467"])
      bind25 --> bind2
      bind26(["wdt:P2516"])
      bind26 --> bind2
      bind27(["wdt:P2520"])
      bind27 --> bind2
      bind28(["wdt:P2525"])
      bind28 --> bind2
      bind29(["wdt:P2584"])
      bind29 --> bind2
      bind210(["wdt:P2621"])
      bind210 --> bind2
      bind211(["wdt:P2763"])
      bind211 --> bind2
      bind212(["wdt:P3009"])
      bind212 --> bind2
      bind213(["wdt:P3296"])
      bind213 --> bind2
      bind214(["wdt:P3327"])
      bind214 --> bind2
      bind215(["wdt:P3401"])
      bind215 --> bind2
      bind216(["wdt:P3412"])
      bind216 --> bind2
      bind217(["wdt:P3425"])
      bind217 --> bind2
      bind218(["wdt:P3498"])
      bind218 --> bind2
      bind219(["wdt:P3515"])
      bind219 --> bind2
      bind220(["wdt:P3516"])
      bind220 --> bind2
      bind221(["wdt:P3609"])
      bind221 --> bind2
      bind222(["wdt:P3613"])
      bind222 --> bind2
      bind223(["wdt:P3810"])
      bind223 --> bind2
      bind224(["wdt:P3974"])
      bind224 --> bind2
      bind225(["wdt:P4001"])
      bind225 --> bind2
      bind226(["wdt:P4029"])
      bind226 --> bind2
      bind227(["wdt:P4083"])
      bind227 --> bind2
      bind228(["wdt:P4154"])
      bind228 --> bind2
      bind229(["wdt:P4171"])
      bind229 --> bind2
      bind230(["wdt:P4170"])
      bind230 --> bind2
      bind231(["wdt:P4172"])
      bind231 --> bind2
      bind232(["wdt:P4182"])
      bind232 --> bind2
      bind233(["wdt:P4190"])
      bind233 --> bind2
      bind234(["wdt:P4762"])
      bind234 --> bind2
      bind235(["wdt:P4800"])
      bind235 --> bind2
      bind236(["wdt:P4977"])
      bind236 --> bind2
      bind237(["wdt:P5965"])
      bind237 --> bind2
      bind238(["wdt:P6070"])
      bind238 --> bind2
      bind239(["wdt:P6230"])
      bind239 --> bind2
      bind240(["wdt:P6280"])
      bind240 --> bind2
      bind241(["wdt:P6478"])
      bind241 --> bind2
      bind242(["wdt:P6560"])
      bind242 --> bind2
      bind243(["wdt:P6602"])
      bind243 --> bind2
      bind244(["wdt:P6659"])
      bind244 --> bind2
      bind245(["wdt:P6700"])
      bind245 --> bind2
      bind246(["wdt:P7129"])
      bind246 --> bind2
      bind247(["wdt:P7308"])
      bind247 --> bind2
      bind248(["wdt:P8114"])
      bind248 --> bind2
      bind249(["wdt:P9516"])
      bind249 --> bind2
      bind250(["wdt:P9552"])
      bind250 --> bind2
      bind251(["wdt:P9755"])
      bind251 --> bind2
      bind252(["wdt:P10015"])
      bind252 --> bind2
      bind253(["wdt:P10392"])
      bind253 --> bind2
      bind254(["wdt:P10513"])
      bind254 --> bind2
      bind255(["wdt:P10514"])
      bind255 --> bind2
      v2 -->v5--> v6
    end
    subgraph union1r[" "]
      style union1r fill:#abf,stroke-dasharray: 3 3;
      v2 --"wdt:P31"-->  a2
      a2 --"wdt:P279"-->  c13
    end
    union1r <== or ==> union1l
    end
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
    v2 --"wdt:P31"-->  a1
    a1 --"wdt:P279"-->  c12
  end
  union0r <== or ==> union0l
  end
  subgraph s2["http://wikiba.se/ontology#label"]
    style s2 stroke-width:4px;
    c5 --"wikibase:language"-->  c16
  end
  subgraph s2["http://wikiba.se/ontology#label"]
    style s2 stroke-width:4px;
    c5 --"wikibase:language"-->  c16
    v2 --"schema:description"-->  v7
  end
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v2 -."wdt:P18".->  v11
  end
  subgraph optional1["(optional)"]
  style optional1 fill:#bbf,stroke-dasharray: 5 5;
    v2 -."wdt:P17".->  v9
  end
  bind3[/"http://www.opengis.net/def/function/geosparql/distance(sPoint(-3.2485 37.5873 )^^<http://www.opengis.net/ont/geosparql#wktLiteral>',?coords)"/]
  v4 --o bind3
  bind3 --as--o v10
  bind6[/"sample(?coords)"/]
  v4 --o bind6
  bind6 --as--o v10
  bind7[/"sample(?image)"/]
  v11 --o bind7
  bind7 --as--o v11