- From: Dan Connolly <connolly@w3.org>
- Date: Thu, 12 Jan 2006 17:28:21 -0600
- To: Fred Zemke <fred.zemke@oracle.com>
- Cc: public-rdf-dawg-comments@w3.org
On Thu, 2006-01-12 at 13:43 -0800, Fred Zemke wrote: > There is no ability to perform aggregates, ie, computations on a > set of results. Example: find authors who have written 2 or more books. > Solution: SELECT ?author WHERE { ?author v:wrote ?book1 . > ?author v:wrote ?book2 . FILTER (?book1 != ?book2) } > Now try to find authors who have written 50 or more books. > This will require 50 book variables and 50*49/2 filter predicates. > It would be easier if there were a way to count the number of books > that an author has and then filter on the count. Other commonly used > aggregates are sum, average, maximum, minimum. I don't know of any > workaround at all for computing sum or average in SPARQL. Quite. We didn't identify this as a requirement in our requirements gathering. http://www.w3.org/TR/rdf-dawg-uc/ It did come up in design discussions, but we... RESOLVED: to add a count/aggregate issue and postpone it, due to schedule considerations -- http://www.w3.org/2001/sw/DataAccess/issues#countAggregate That is: the working group is of the opinion that SPARQL can meet the use cases and requirements that we identified, and should advance thru the W3C process despite lack ofcount/aggregate features. I hope you find this justification satisfactory. Please let us know whether you do. > There is > a workaround for maximum and minimum, though it is messy. > Example: find the vendor with the lowest price for a widget. > SELECT ?vendor > WHERE { ?vendor v:sells ?product . > ?product a w:idget . > ?product v:price ?price . > ?vendor2 v:sells ?product2 . > ?product2 a w:idget . > ?product2 v:price ?price2 . > FILTER (?price2 > ?price) } > > Fred Zemke -- Dan Connolly, W3C http://www.w3.org/People/Connolly/ D3C2 887B 0F92 6005 C541 0875 0F91 96DE 6E52 C29E
Received on Thursday, 12 January 2006 23:28:25 UTC