[redland-dev] query range in SPARQL

Andre Meyer meyer at acm.org
Tue Oct 3 07:05:02 UTC 2006


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?

thanks for your help
Andre


More information about the redland-dev mailing list