Hi,

has anyone looked into the problem I described on March 7? See below.

Thanks & Regards,
Martin

Am 07.03.2011 12:09, schrieb Martin Gerlach:
> Hi,
>
> I observed the following SPARQL behavior with Virtuoso Open Source, 
> Version 06.01.3127, running on Linux version 2.6.27.56-0.1-xen 
> (geeko@buildhost) (gcc version 4.3.2 [gcc-4_3-branch revision 141291] 
> (SUSE Linux) ) #1 SMP 2010-12-01 16:57:58 +0100:
>
> Given the following test graph:
>
> create graph <http://alx.neofonie.de/test>
>
> prefix test:<http://alx.neofonie.de/test/>
> insert into <http://alx.neofonie.de/test> {
>    _:b1 a test:Relation .
>    _:b1 test:agent test:A1 .
>    _:b1 test:range test:R1 .
>    _:b2 a test:Relation .
>    _:b2 test:agent test:A2 .
>    _:b2 test:range test:R1 .
>    _:b3 a test:Relation .
>    _:b3 test:agent test:A2 .
>    _:b3 test:range test:R2 .
> }
>
> ... the following query:
>
> prefix test:<http://alx.neofonie.de/test/>
> select ?agent ?range
> from <http://alx.neofonie.de/test>
> where {
>    _:b a test:Relation .
>    filter (?agent = test:A1)
>    optional{ _:b test:agent ?agent.}
>    optional{ _:b test:range ?range.}
> }
>
> ... returns (as CSV):
>
> "agent","range"
> "http://alx.neofonie.de/test/A1","http://alx.neofonie.de/test/R1";
> "http://alx.neofonie.de/test/A1","http://alx.neofonie.de/test/R1";
> "http://alx.neofonie.de/test/A1","http://alx.neofonie.de/test/R2";
>
> ... which contains the wrong (because non existing) result A1/R2.
>
> Obviously, the filter expression binds ?agent to test:A1 if it is not 
> bound by the first optional sub query. This can easily be seen by 
> omitting the filter.
>
> The question is: Does this behavior conform to the SPARQL spec or is 
> this a Virtuoso bug?
>
> This sentence from http://www.w3.org/TR/rdf-sparql-query/ ,
> section 3, makes me think it is probably a bug:
>
> "Graph pattern matching produces a solution sequence, where each 
> solution has a set of bindings of variables to RDF terms. SPARQL FILTERs 
> restrict solutions to those for which the filter expression evaluates to 
> TRUE."
>
> The filter expression, ?agent = test:A1, should not evaluate to TRUE if 
> ?agent is not bound, and it should also not bind ?agent to test:A1.
>
> Regards,
> Martin
>
> --
>
> (Of course, one can just make the first optional binding a required 
> binding (result: A1/R1), or move the filter into the first optional 
> block (result: _/R1, A1/R1, _/R2) to obtain results that make more 
> sense. The example is a stripped down version of a more complex use case.)
>
>

-- 
------------------------------------------------------------------------

*Martin Gerlach*
Senior Softwareentwickler
Research

Neofonie GmbH
Robert-Koch-Platz 4
10115 Berlin

T +49.30 24627 *413*
F +49.30 24627 120
[email protected]
http://www.neofonie.de

Handelsregister
Berlin-Charlottenburg: HRB 67460

Geschäftsführung
Thomas Kitlitschko

Reply via email to