# Re: Test cases

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Wed, 15 Jun 2005 16:32:15 +0100
Message-ID: <42B049FF.50509@hp.com>
To: Geoff Chappell <geoff@sover.net>

```
Geoff,

Let me reduce this to a simple test case to see if we are have the same
understanding of the problem:

Data:
:book :title "Title" .

Query:
SELECT ?x
WHERE
{
OPTIONAL { :book :title ?x }
}

in other words, a single optional.

Solutions: (desired)
?x = "Title"

The issue as I see it is why isn't
?x = "Junk"

a solution as well because ?x="Junk" is a solution to OPTIONAL(P).

[[Related, but different, is that any solution can be extended with other,
unrelated bindings of variables without afecting the matching.  This is a result
of the pattern composition - subpatterns may not involve all variables.]]

Andy

Geoff Chappell wrote:
>
>>-----Original Message-----
>>From: Seaborne, Andy [mailto:andy.seaborne@hp.com]
>>Sent: Wednesday, June 08, 2005 8:24 AM
>>To: Geoff Chappell
>>Subject: Re: Test cases
>>
>>
>>
>>Geoff Chappell wrote:
>>
>>>OK, the first is the test OPTIONAL-FILTER.
>>>
>>
>>Geoff,
>>
>>I agree with the rewriting in logical terms but I think it needs to take
>>into
>>account when variables are being bound.
>>
>>OPTIONAL
>>         { ?book x:price ?price .
>>           FILTER ?price < 15 .
>>         } .
>>
>>means that the FILTER is applied when "?book x:price ?price" matches.
>>When
>>rewriting, that additional piece of information needs to be catered for as
>>well.
>>  I think this is covered by requiring S, a group solution, to be a
>>solution of
>>the OPTIONAL within the group.
>
>
> But isn't it a solution? I get the interpretation you're shooting for, but I
> don't see how you get there from your current definitions. Maybe I'm just
> being dense -- if so can you point out why the following is not a solution:
>
> 	?book=:book1
> 	?title="TITLE 1"
> 	?price=
>
> For it to be a solution, it must be a solution to both parts of the group
> pattern.
>
> It's clearly a solution to the first since:
>
> 	 {:book1 dc:title "TITLE 1"}
>
> is a subgraph of the dataset's default graph.
>
> As for the second... isn't any substitution a solution of an optional
> pattern? i.e. optional A is defined as A or not A - how can anything fail?
> For that matter, why isn't:
>
> 	?book=:book1
> 	?title="TITLE 1"
> 	?price=:book2
>
> a valid solution? It seems like it should be by the current definitions but
> it's not a solution we'd like to see (in the same sense that solutions
> derived from treating optional A as A or true aren't really helpful).
>
> So the question is what are valid substitutions (or how do you distinguish
> between the valid, but unhelpful solutions)? The only scheme I've been able
> to come up with is to convert the query to nnf and treat any variable not
> mentioned in a basic pattern as unbound. But that gets me e.g. to the
> solution I posted earlier that you disagree with (note that the result
> really doesn't depend upon whether filter is treated as a distinct pattern
> or as the rhs of a constrained pattern).
>
> Best,
>
> Geoff
>
>
>
>
>
>
>
```
Received on Wednesday, 15 June 2005 15:32:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:48 GMT