- From: Axel Polleres <axel.polleres@deri.org>
- Date: Tue, 26 May 2009 21:18:00 +0100
- To: Ivan Mikhailov <imikhailov@openlinksw.com>
- CC: Simon Schenk <sschenk@uni-koblenz.de>, Steve Harris <steve.harris@garlik.com>, "Seaborne, Andy" <andy.seaborne@hp.com>, "public-rdf-dawg@w3.org" <public-rdf-dawg@w3.org>
Ivan Mikhailov wrote:
> 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) } } ) } }
Let me try to phrase this query into "English"
Give me books and their list prices and optionally their disount prices
and the date the discount ends if either
- the discount price is less than a third of the list price, or
- there is a second offer for that book with a discount that ends
later, but with a worse ratio of price to discount price?
... aehm, I assume there is a not missing in front of the ASK?
(assuming because otherwise, it is not about Negation anyways, which we
started)
So, do you mean:
Give me books and their list prices and optionally their disount prices
and the date the discount ends if either
- the discount price is less than a third of the list price, or
- there is no offer which ends later with a better price to
discount price ratio
?
Was that what you mean? Anyway, thanks for the use case, if clarified,
it would make sense to add that to the negation use cases on the wiki,
probably.
Axel
> 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
>
>
>
--
Dr. Axel Polleres
Digital Enterprise Research Institute, National University of Ireland,
Galway
email: axel.polleres@deri.org url: http://www.polleres.net/
Received on Tuesday, 26 May 2009 20:18:37 UTC