Re: [ACTION-18] use case on !ASK in FILTERS to emulate negation

Hello Axel,

> aehm... you won. :-)
> It starts to look to me like that nesting in FILTERs doesn't really have 
> any advantages. Anybody arguments in favor of the FILTERed version?

I'd prefer to not rewrite at all a BI query like

select ?book ?p1 ?dp1 ?end1 where
  { ?offer1 :itm ?book ;
     :price ?p1 .
     OPTIONAL {
       ?offer1 :discountPrice ?dp1 ;
         :endDate ?end1 .
       filter ((?dp1/?p1 < 0.3) ||
         ASK { 
           ?offer2 :itm ?book ;
           :price ?p2 .
           OPTIONAL {
             ?offer2 :discountPrice ?dp2 ;
               :endDate ?end2 .
             filter (?end2 >= ?end1) }
           filter (?dp1/?p1 < ?dp2/?p2) } } ) } }

because the semantics of FILTER in OPTIONAL is "interesting enough":
it's hard to move the expression to some other place without affecting
cardinality of the result set. Of course it is possible to replace left
outer join with UNION but it easily doubles the length of the query for
each OPTIONAL, mere 5 OPTIONALs would explode the query 32 times.

Best Regards,

Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com

Received on Tuesday, 26 May 2009 16:19:53 UTC