Filter-scope-1 test

I've a question regarding the filter-scope-1 test, I would have  
expected the results below, which would be equivalent to FILTER(0)  
after http://www.w3.org/TR/rdf-sparql-query/
§ 6.2, but instead I see something equivalent to if the OPTIONAL  
block were missing entirely.

I can't find anything in the spec which suggests that evaluating a  
FILTER() expression with out of scope variables should cause the  
entire enclosing block to be disregarded. Though, I may have just  
missed it.

I'm also not sure I like this scoping rule, it rules out some  
potentially useful query forms, like:

SELECT *
WHERE {
   ?person :department ?dept .
   OPTIONAL {
     ?person :project ?proj .
     FILTER(?dept = :technology)
   }
}

Data:

@prefix : <http://example/> .

:x :p 1 .
:x :p 2 .
:x :p 3 .
:x :p 4 .

:x :q 1 .
:x :q 2 .
:x :q 3 .

Query:

PREFIX :    <http://example/>
SELECT *
{
     :x :p ?v .
     { :x :q ?w
       OPTIONAL {  :x :p ?v2 FILTER(?v = 1) }
     }
}

What I would expect: (excuse the use of NULL)

?v	?w	?v2	
1	1	NULL	
1	1	NULL	
1	1	NULL	
1	1	NULL	
1	3	NULL	
1	3	NULL	
1	3	NULL	
1	3	NULL	
1	2	NULL	
1	2	NULL	
1	2	NULL	
1	2	NULL	
3	1	NULL	
3	1	NULL	
3	1	NULL	
3	1	NULL	
3	3	NULL	
3	3	NULL	
3	3	NULL	
3	3	NULL	
3	2	NULL	
3	2	NULL	
3	2	NULL	
3	2	NULL	
2	1	NULL	
2	1	NULL	
2	1	NULL	
2	1	NULL	
2	3	NULL	
2	3	NULL	
2	3	NULL	
2	3	NULL	
2	2	NULL	
2	2	NULL	
2	2	NULL	
2	2	NULL	
4	1	NULL	
4	1	NULL	
4	1	NULL	
4	1	NULL	
4	3	NULL	
4	3	NULL	
4	3	NULL	
4	3	NULL	
4	2	NULL	
4	2	NULL	
4	2	NULL	
4	2	NULL	



-- 
Steve Harris
Garlik Limited
Gainsborough House
2 Sheen Road
Richmond  TW9 1AE

T   +44(0)20 8973 2465
F   +44(0)20 8973 2301
www.garlik.com

Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: 42-46 High Street, Esher, Surrey KT10 9QY

Received on Wednesday, 27 June 2007 15:42:58 UTC