Test cases for blank node label scope - and a case for discussion

Attached are some tests (positive and negative) for reuse of blank nodes 
labels only within BGPs.

There is one case to point out: syn-bad-39.rq

{
    _:a ?p ?v .  FILTER(true) . <x> ?q _:a
}

1/ By the principle that FILTERs apply to the whole group, it could be taken 
as like:
   { _:a ?p ?v . <x> ?q _:a . FILTER(true) }
which is one BGP.

[Filter true
   [BGP
     _:b0 ?p ?v
     <x> ?q _:b0
   ]]

2/ By the principle that BGPs are adjacent triple patterns, it has appearance 
as if it were two BGPs like:

   { BGP( _:a ?p ?v . ) FILTER(true) BGP( [] ?q _:a . ) }

so it would be:
[Filter true
   [Join
     [BGP _:a ?p ?v]
     [BGP <x> ?q _:a]
   ]]
which is illegal (_:a spans BGPs).

Blank node labels can't appear in FILTERs so this also makes sense by saying 
FILTERs end the blank node label scope.



Just at the moment, I think I prefer (2), emphasizing the immediate 
appearance, and the fact blank node labels can't appear in filters.

(This example, either way round, will affect optimizations moving the filter 
around if BGPs are sent to an external systems like a DL reasoner.)

 Andy
PREFIX : <http://example.org/>
SELECT *
WHERE
{
  _:a ?p ?v . { _:a ?q 1 }
}
PREFIX : <http://example.org/>
SELECT *
WHERE
{
  { _:a ?p ?v . } _:a ?q 1 }
}
PREFIX : <http://example.org/>
SELECT *
WHERE
{
  { _:a ?p ?v . } UNION { _:a ?q 1 } }
}
PREFIX : <http://example.org/>
SELECT *
WHERE
{
  { _:a ?p ?v . } _:a ?q 1 }
}
PREFIX : <http://example.org/>
SELECT *
WHERE
{
  _:a ?p ?v . OPTIONAL {_:a ?q 1 }
}
PREFIX : <http://example.org/>
SELECT *
WHERE
{
  _:a ?p ?v .  _:a ?q 1 
}
PREFIX : <http://example.org/>
SELECT *
WHERE
{
  { _:a ?p ?v .  _:a ?q _:a } UNION { _:b ?q _:c }
}
PREFIX : <http://example.org/>
SELECT *
WHERE
{
  _:a ?p ?v .  FILTER(true) . [] ?q _:a
}

Received on Sunday, 28 January 2007 20:51:45 UTC