Strange behaviour of bif:st_intersects - incorrect geometry type

99 views
Skip to first unread message

Krzysztof Węcel

unread,
Oct 22, 2014, 8:22:34 AM10/22/14
to linked-...@googlegroups.com
Hi,

I've encountered some problems when querying LGD endpoint (http://linkedgeodata.org/sparql).

I know that bif:st_intersects is used to make querying efficient and that some optimisation happens behind the scenes.

Nevertheless, can anyone tell why it is changing the semantics of variables? It looks like bif:st_intersects and bif:st_x and similar cannot go into one query.

In all queries the following namespaces are used:
prefix lgd:<http://linkedgeodata.org/triplify/>
prefix lgdo:<http://linkedgeodata.org/ontology/>
prefix lgd-geom:<http://linkedgeodata.org/geometry/>
prefix lgdm:<http://linkedgeodata.org/meta/>
prefix spatial:<http://geovocab.org/spatial#>
prefix geom:<http://geovocab.org/geometry#>
prefix geo:<http://www.w3.org/2003/01/geo/wgs84_pos#>
prefix ogc:<http://www.opengis.net/ont/geosparql#>

Query 1. Works
SELECT ?b ?l ?geo ?x str(?geo)
WHERE
{
  ?b rdfs:label ?l .
  ?b a lgdm:Node .
  ?b geom:geometry [ogc:asWKT ?geo ] .
  bind(bif:st_x(?geo) as ?x)
}
LIMIT 100

Query 2. Also works
SELECT ?b ?l ?geo str(?geo)
WHERE
{
  ?b rdfs:label ?l .
  ?b a lgdm:Node .
  ?b geom:geometry [ogc:asWKT ?geo ] .
  filter(bif:st_intersects(?geo, bif:st_point(16.9,52.4),1 ))
}
LIMIT 100

Query 3. Fails with error:
"
Virtuoso 22023 Error GEO..: Function st_x() expects a geometry of type 1 or NULL as argument 0, not geometry of type 2
"
SELECT ?b ?l ?geo ?x str(?geo)
WHERE
{
  ?b rdfs:label ?l .
  ?b a lgdm:Node .
  ?b geom:geometry [ogc:asWKT ?geo ] .
  filter(bif:st_intersects(?geo, bif:st_point(16.9,52.4),1 ))
  bind(bif:st_x(?geo) as ?x)
}
LIMIT 100

Query 4. It does not even help to convert geometry via text.
SELECT ?b ?l ?geo ?x str(?geo)
WHERE
{
  ?b rdfs:label ?l .
  ?b a lgdm:Node .
  ?b geom:geometry [ogc:asWKT ?geo ] .
  filter(bif:st_contains(?geo, bif:st_point(16.9,52.4),1 ))
  bind(bif:st_x(bif:st_geomfromtext(bif:st_astext(?geo))) as ?x)
}
LIMIT 100


Moreover, how is precision in bif:st_intersects interpreted? Is it distance in km? Why it is interpreted differently for lgdm:Node and lgdm:Way?


Best regards,
Krzysztof

Claus Stadler

unread,
Oct 22, 2014, 9:27:13 AM10/22/14
to linked-...@googlegroups.com, krzyszt...@gmail.com
Hi Krzystof,


>> I've encountered some problems when querying LGD endpoint (http://linkedgeodata.org/sparql).

This appears to be a bug of Virtuoso (ca81fb6d6825120272fd8c9c4538663edd7fe771, develop7, from 2014-10-14).
If doing the projection in an outer query, it works (using your prefixes):

Select ?b ?l ?geo  str(?geo) (bif:st_x(?geo) as ?x) {
{
  SELECT ?b ?l ?geo

  WHERE {
    ?b rdfs:label ?l .
    ?b a lgdm:Node .
    ?b geom:geometry [ogc:asWKT ?geo ] .
    filter(bif:st_intersects(?geo, bif:st_point(16.9,52.4),1 ))
  } LIMIT 100 }
}


>> Moreover, how is precision in bif:st_intersects interpreted? Is it distance in km? Why it is interpreted differently for lgdm:Node and lgdm:Way?

Reading

http://docs.openlinksw.com/virtuoso/fn_st_intersects.html

Maybe the reason is that I should have explicitly set the SRID to 4326.
Can you give me a couple of related queries where you experience the different behavior?

I'll forward these issues to the virtuoso user mailing list (virtuos...@lists.sourceforge.net).


Cheers,
Claus
--
You received this message because you are subscribed to the Google Groups "Linked Geo Data" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linked-geo-da...@googlegroups.com.
To post to this group, send email to linked-...@googlegroups.com.
Visit this group at http://groups.google.com/group/linked-geo-data.
For more options, visit https://groups.google.com/d/optout.

-- 
Dipl. Inf. Claus Stadler
Department of Computer Science, University of Leipzig
Research Group: http://aksw.org/
Workpage & WebID: http://aksw.org/ClausStadler
Phone: +49 341 97-32260
Reply all
Reply to author
Forward
0 new messages