Constrinat synatx (was Re: OUTER JOIN and DISJUNCTION)

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 UTC