W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2010

Re: 4 MINUS and NOT EXISTS test cases

From: Andy Seaborne <andy.seaborne@talis.com>
Date: Mon, 19 Jul 2010 21:07:36 +0100
Message-ID: <4C44B088.6060409@talis.com>
To: Chimezie Ogbuji <ogbujic@ccf.org>
CC: SPARQL Working Group WG <public-rdf-dawg@w3.org>


On 19/07/2010 5:59 PM, Chimezie Ogbuji wrote:
> I've committed these tests into the CVS (all but the last one, which I
> cannot reconcile with the behavior of Minus - see below):
>
> RCS file:
> /w3ccvs/WWW/2009/sparql/docs/tests/data-sparql11/negation/manifest.ttl,v
> Working file: manifest.ttl
> head: 1.1
> branch:
> locks: strict
> access list:
> symbolic names:
> keyword substitution: kv
> total revisions: 1;    selected revisions: 1
> description:
> ----------------------------
> revision 1.1
> date: 2010/07/19 16:38:23;  author: cogbuji;  state: Exp;

Problems:

1/ All the tests have the same subject resource:

:subset-by-exclusion-nex-1

Each begins:
:subset-by-exclusion-nex-1 rdf:type mf:QueryEvaluationTest ;
    ...

Fixed to align with the list at start of manifest:

2/ temporalProximity01.srx

<binding attr="date"> ==> <binding name="date">

then 3 tests pass.

Changes checked in.

> On 7/5/10 5:49 PM, "Andy Seaborne"<andy.seaborne@talis.com>  wrote:
>> ..snip ..
>> I don't agree with this.
>> The matching part of the MINUS is:
>> { ?otherExam a ex:PhysicalExamination; dc:date ?otherExDT } gives:
>> and then the FILTER:
>> FILTER(?date<   ?otherExDT&&   ?otherExDT<   ?opDT)
>> uses ?date which is out of scope for the clause MINUS so the FILTER is
>> error always so nothing matches for MINUS {}
>
> Hmm, I've been staring at this test for a while and cannot determine an
> alternative.  This query is meant to implement an exclusion criteria that
> rules out the possibility that there is a physical examination that is
> closer to the operation (based on lexical ordering of the associated dates),
> so any resulting ?exam binding should be the 'closest' examination prior to
> the operation.
>
> However, in order to use the MINUS operator in the same way the EXIST
> operator was used in the previous test, I would essentially need to use
> ?exam as the join condition between the LHS and RHS.  It doesn't seem
> possible to use it for this kind of problem since the Minus algebra operator
> is defined such that the operands are independent of each other:
>
> Minus(Ω1, Ω2)
> = { μ | μ in Ω1?
>      such that for all μ' in Ω2, either μ and μ' are not compatible or dom(μ)
> and dom(μ') are disjoint }
>
> Am I missing something?
>
> I have left this particular test out.
>
> -- Chime

One way might be to put the ?date and ?opDT to put them in-scope of the RHS:

PREFIX ex: <negation/temporal-exclusion#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
# The closest pre-operative physical examination
SELECT ?exam ?date {
   ?exam a ex:PhysicalExamination;
         dc:date ?date .
   ?op   a ex:SurgicalProcedure; dc:date ?opDT .
   MINUS {
     ## Get ?date1 for the FILTER
     ?exam a ex:PhysicalExamination;
         dc:date ?date1 .
     ?op1   a ex:SurgicalProcedure; dc:date ?opDT1 .
     ##
     ?otherExam a ex:PhysicalExamination; dc:date ?otherExDT
     FILTER(?date1 < ?otherExDT && ?otherExDT < ?opDT1)
   }
   FILTER(?date < ?opDT)
}

Observation:

This is the same situation as a LeftJoin except, like SQL, a FILTER is 
part of the LeftJoin condition itself and in Minus it's not.

The LeftJoin without FILTER is the one proposed by our Chilean friends. 
  It requires repeating part of the query pattern to achiev the same 
effects hence the rewrite for MINUS above.

	Andy
Received on Monday, 19 July 2010 20:08:08 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:43 GMT