W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2004

Constrinat synatx (was Re: OUTER JOIN and DISJUNCTION)

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Tue, 16 Nov 2004 09:40:27 +0000
Message-ID: <4199CB0B.9070607@hp.com>
To: Simon Raboczi <raboczi@tucanatech.com>
Cc: Eric Prud'hommeaux <eric@w3.org>, public-rdf-dawg@w3.org



Simon Raboczi wrote:
...

>>
>>The simple way would be to again reduce the sides of the conjunction
>>to a single triple as we did in SQL:
>>
>>SELECT ?a ?b WHERE (?s ?p ?o)
>>               AND ((?p=<x:p1> AND ?o=<x:o1>)
>>                 OR (?p=<x:p2> AND ?o=<x:o2>))
> 
> 
> Sneaky!  You've replaced UNION in the WHERE clause by OR in the AND 
> clause.  I didn't think of that because I'm still desperately hoping 
> the difference between the WHERE and AND clauses will somehow go away.  
> :)  

What difference? :-) "?x < 3" is saying for all solutions, the value of ?x is 
less than 3 in the same way that
   ?x math:lessThan "3"^^xsd:integer
says it, except the syntax is more natural (strictly it's op:numeric-less-than 
and you have to get all the corner cases right like "NaN", -0 and +0 etc if your 
implementation really cares.)  You could even implement it the triple way.

Triple patterns amd constriants can be freely mixed, there is no need for the 
AND word anymore.

I just tested with

PREFIX : <foo>
SELECT *
WHERE
   (<uri> :p ?v )   ?v < 3
   (<uri> :q ?name) ?name =~ /Smith/

and

PREFIX : <foo>
SELECT *
WHERE
   (<uri> :p ?v )   (( ?v < 3  ))
   (<uri> :q ?name) ( ?name =~ /Smith/ )

Some people like to write queries with AND in, some people like to put all the 
constraints last.  It's a style thing.

	Andy

 >
....
 >
Received on Tuesday, 16 November 2004 09:46:45 GMT

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