Skip to content

Instantly share code, notes, and snippets.

@ocorcho
Created April 10, 2015 08:24
Show Gist options
  • Save ocorcho/2d8e171ac6bf2d1a1797 to your computer and use it in GitHub Desktop.
Save ocorcho/2d8e171ac6bf2d1a1797 to your computer and use it in GitHub Desktop.
Two queries on http://3cixty.eurecom.fr/sparql with different behaviour: bug in query processing related to geo-related filters
Virtuoso 22023 Error GEO..: Function st_distance() expects a geometry of type 1 as argument 0, not geometry of type 26626
PREFIX schema: <http://schema.org/>
PREFIX ma-ont: <http://www.w3.org/ns/ma-ont#>
SELECT ?venue ?img ?title ?description ?long ?lat ?cell (bif:st_distance(?geo, bif:st_point(xsd:decimal(?longValues), xsd:decimal(?latValues))) as ?distance0)
WHERE {
{
SELECT ?venue ?img ?title ?description ?long ?lat ?geo ?longValues ?latValues ?cell
WHERE {
?venue locationOnt:cell ?cell .
?venue a dul:Place .
?venue <http://data.linkedevents.org/def/location#businessType> ?cat.
?cat skos:prefLabel ?catRead.
FILTER (STR(?catRead) = "Hotel").
?venue geo:location ?geometry .
?geometry locn:geometry ?geo .
?geometry geo:long ?long .
?geometry geo:lat ?lat .
?venue rdfs:label ?title .
OPTIONAL{?venue schema:description ?description. FILTER (lang(?description) IN ( "en','en_tr"))}
OPTIONAL{?venue lode:poster ?img.}
VALUES (?longValues ?latValues) {("9.1495346623792" "45.432253565163")}
FILTER (bif:st_distance(?geo, bif:st_point(xsd:decimal(?longValues), xsd:decimal(?latValues))) >= 0 && bif:st_distance(?geo, bif:st_point(xsd:decimal(?longValues), xsd:decimal(?latValues))) <= 2 ).
}
}
}
ORDER BY ASC (?distance0)
OFFSET 0 LIMIT 100
PREFIX schema: <http://schema.org/>
PREFIX ma-ont: <http://www.w3.org/ns/ma-ont#>
SELECT ?venue ?img ?title ?description ?long ?lat ?cell (bif:st_distance(?geo, bif:st_point(xsd:decimal(?longValues), xsd:decimal(?latValues))) as ?distance0)
WHERE {
{
SELECT ?venue ?img ?title ?description ?long ?lat ?geo ?longValues ?latValues ?cell
WHERE {
?venue locationOnt:cell ?cell .
?venue a dul:Place .
?venue <http://data.linkedevents.org/def/location#businessType> ?cat.
?cat skos:prefLabel ?catRead.
FILTER (STR(?catRead) = "Hotel").
?venue geo:location ?geometry .
?geometry locn:geometry ?geo .
?geometry geo:long ?long .
?geometry geo:lat ?lat .
OPTIONAL{?venue schema:description ?description. FILTER (lang(?description) IN ( "en','en_tr"))}
OPTIONAL{?venue lode:poster ?img.}
?venue rdfs:label ?title .
VALUES (?longValues ?latValues) {("9.1495346623792" "45.432253565163")}
FILTER (bif:st_distance(?geo, bif:st_point(xsd:decimal(?longValues), xsd:decimal(?latValues))) >= 0 && bif:st_distance(?geo, bif:st_point(xsd:decimal(?longValues), xsd:decimal(?latValues))) <= 2 ).
}
}
}
ORDER BY ASC (?distance0)
OFFSET 0 LIMIT 100
@rtroncy
Copy link

rtroncy commented May 17, 2015

The first query does not produce anymore errors in the Virtuoso version run on http://3cixty.eurecom.fr/sparql ... see the results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment