[redland-dev] query range in SPARQL

Benno Blumenthal benno at iri.columbia.edu
Wed Oct 4 17:43:59 UTC 2006


Andre Meyer wrote:

> Thanks for the idea. It seems, however, that filters are not
> sufficient because they do not support mathematical functions like
> sqrt().

sqrt would be nice, but you don't need square root:   just test dx*dx + 
dy*dy < d*d
Even if you had sqrt, this test would be faster.

Benno

P.S.  Thanks for asking the question -- the dialog has been very 
informative.




>
> 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
>>
>
>



More information about the redland-dev mailing list