W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > November 2011

When is HAVING processed?

From: Alex Miller <amiller@revelytix.com>
Date: Thu, 3 Nov 2011 10:06:57 -0500
Message-ID: <CANFyktFHpO2k9r3+5nWkqq9viv7nJm-FzzNrOXEHC0qgmCQd=w@mail.gmail.com>
To: public-rdf-dawg-comments@w3.org
I've been puzzling over the SPARQL spec trying to determine the intent as
to when the HAVING clause is executed.

In particular, re section 18.2.4:

   1. The link above lists processing in the order of: Grouping,
   Aggregates, Bindings, Select exprs, and Having.
   2. However, the sub-sections of 18.2.4 are listed in the order of:
   Grouping and Aggregation, HAVING, BINDINGS, SELECT Expressions.  Note that
   HAVING is listed in a different order than #1.
   3. In the Grouping and Aggregation section (, the algorithm
   given shows the HAVING filters being executed at the end of the Grouping
   4. In the Having section ( it says "Note that, due to the logic
   position in which the HAVING clause is evaluated, expressions projected by
   the SELECT clause are not visible to the HAVING clause."  This seems to be
   in alignment with #2.

#2-4 seem consistent and I thus conclude that the list at the beginning of
18.2.4 is ordered incorrectly and should say:

   - Grouping
   - Aggregates
   - Having   // moved from end
   - Bindings
   - Select exprs

Have I correctly interpreted the intent?  If so, can this issue be resolved
in a future draft?

Alex Miller
Received on Thursday, 3 November 2011 17:52:54 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:52:12 UTC