cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: split expressions
Date Wed, 13 Jan 2010 12:02:23 GMT

On Jan 13, 2010, at 12:45 PM, Aristedes Maniatis wrote:

> Split paths can already be added to the Path with "|" in some  
> circumstances. They can be added to the Expression with matchAll().  
> And in this case, they are deeply relevant to the AND because that's  
> what the developer cares about. Do they get zero results when  
> searching across a many join (which you always do with ANDed  
> expressions and no split path)? Merging the path is never useful  
> when you are ANDing two expressions.

Actually the following AND expression with reused joins is very common: = 'X' AND artist.dob = $date

Also "|" notation only works for a single repeated path (hence  
'matchAll()'). This is a very specific case. It is ambiguous in a  
general case as it doesn't allow to do join groupings, only split vs.  
shared. E.g.:

   paintings.exhibits.start > $date1 AND like  
   paintings.exhibits.start < $date2 AND like  
   paintings.exhibits.start = $date3 AND like  

here you can't describe the desired behavior with "|", but can with  

   a.start > $date1 AND like 'X%'
   b.start < $date2 AND like 'Y%'
   c.start = $date3 AND like 'Z%'

> It seems that aliases (used in this way) are merely a workaround to  
> the fact that Expressions need to know whether they should have  
> their paths combined or not.

Aliases were designed specifically to control joins. This is not a  
workaround, it is their intended use. There can be other uses for them  
in the future if we start merging EJBQL and SelectQuery, but for now  
their only intention is to control joins.

Now the goal is to evolve this further from just "working" API to  

> It is not immediately obvious to me why not. I guess I tend to think  
> of Path == Expression, since I always always create expressions  
> using matchExp() and friends. But what happens now if you AND an  
> expression created with matchAll with another expression with an  
> overlapping path?

See examples above. Expression is a tree that has (1) "primitive"  
clauses combined into (2) key/value expressions, and those combined  
into (3) AND/OR/NOT conditional expressions with the arbitrary level  
of nesting.


View raw message