[redland-dev] Re: query range in SPARQL

Andre Meyer meyer at acm.org
Tue Oct 3 07:21:24 UTC 2006


Sorry, forgot: how would this be implemented in Redland/Python?


On 10/3/06, Andre Meyer <meyer at acm.org> 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?
>
> thanks for your help
> Andre
>


-- 
Dr. Andre P. Meyer                        http://python.openspace.nl/meyer
TNO Defence, Security and Safety          http://www.tno.nl/
Delft Cooperation on Intelligent Systems  http://www.decis.nl/

Ah, this is obviously some strange usage of the word 'safe' that I
wasn't previously aware of. - Douglas Adams


More information about the redland-dev mailing list