[redland-dev] query range in SPARQL
Andre Meyer
meyer at acm.org
Wed Oct 4 17:24:45 UTC 2006
Thanks for the idea. It seems, however, that filters are not
sufficient because they do not support mathematical functions like
sqrt().
I have not yet figured out whether extension functions work in
Redland. Where would I need to look for these?
thanks
Andre
On 10/3/06, Eyal Oren <eyal.oren at deri.org> wrote:
> 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 with
> > Redland/Python.
> >
> >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
> _______________________________________________
> redland-dev mailing list
> redland-dev at lists.librdf.org
> http://lists.gnomehack.com/mailman/listinfo/redland-dev
>
--
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