[redland-dev] query range in SPARQL

Eyal Oren eyal.oren at deri.org
Tue Oct 3 09:37:25 UTC 2006


On 10/03/06/10/06 09:05 +0200, Andre Meyer wrote:
>Hi all
>
>Maybe you give me a hint on implementing the following query in SPARQL.
>
>I have an RDF graph with statements that represent the x/y attributes
>of subjects, ie. their locations in 2D space. Now, I need to query
>which subjects are within a certain distance from some point in the
>plane (x0, y0, d0). The function, thus, is:
>
>x0 = 100
>y0 = 100
>d0 = 25
>dx = ?x - x0
>dy = ?y - y0
>d = math.sqrt(dx*dx + dy*dy)
>if d <= d0:
>    return True
>else:
>    return False
>
>How can I include this function in the where clause of a SPARQL
>statement? In particular: how can I pass the (x0, y0, d0) parameters?
Can you not do this with a filter using the built-in operators, as in 
section 11.3 of the SPARQL specification [2]. 

If not, isn't this question discussed in section 11.6 [1] on extension 
functions? That would mean that the SPARQL engine (i.e.  Redland) should 
know about your extension function, but I dont think there is yet a way to 
tell Redland about some extension function?

 -eyal

[1] http://www.w3.org/TR/rdf-sparql-query/#extensionFunctions
[2] http://www.w3.org/TR/rdf-sparql-query/#OperatorMapping


More information about the redland-dev mailing list