cz-pairs-of-pois-with-equal-name-and-type.sparql 758 B

123456789101112131415161718192021
  1. PREFIX geo: <http://www.opengis.net/ont/geosparql#>
  2. PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
  3. PREFIX unit: <http://www.opengis.net/def/uom/OGC/1.0/>
  4. SELECT DISTINCT ?Resource1 ?Resource2 ?distance
  5. FROM <http://www.sdi4apps.eu/poi/czech>
  6. WHERE {
  7. ?Resource1 a ?type1 .
  8. ?Resource1 rdfs:label ?label1 .
  9. ?Resource1 geo:asWKT ?geo1 .
  10. ?Resource2 a ?type2 .
  11. ?Resource2 rdfs:label ?label2 .
  12. ?Resource2 geo:asWKT ?geo2 .
  13. FILTER (lcase(str(?label1)) = lcase(str(?label2) )) .
  14. FILTER ( ?Resource1 != ?Resource2 && ?Resource1 < ?Resource2)
  15. FILTER (NOT EXISTS {?x a ?Resource1} && NOT EXISTS {?y a ?Resource2}) .
  16. BIND (geof:distance ( ?geo1 , ?geo2 , unit:metre ) as ?distance) .
  17. FILTER ( ?distance < 100 )
  18. }
  19. LIMIT 1000
  20. OFFSET 0