org.openanzo.glitter.query
Class GroupByProjecton

java.lang.Object
  extended by org.openanzo.glitter.query.GroupByProjecton

public class GroupByProjecton
extends java.lang.Object

GroupByProjection handles the SELECT SPARQL query form when it includes a GROUP BY clause. For the SELECT query form without a GROUP BY see Projection. Also handles the COUNT(*) and COUNT(DISTINCT *) aggregate functions as they apply to GROUP BY. When

Author:
Joe Betz

Constructor Summary
GroupByProjecton(java.util.Set<Variable> groupByVars, java.util.Set<Variable> projectedVars, boolean projectCount, boolean countDistinct)
          Configures the projection.
 
Method Summary
 SolutionSet refineSolutions(SolutionSet results)
          Projects the provided SolutionSet using the provided group by var, projection vars and count criteria.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupByProjecton

public GroupByProjecton(java.util.Set<Variable> groupByVars,
                        java.util.Set<Variable> projectedVars,
                        boolean projectCount,
                        boolean countDistinct)
Configures the projection.

Parameters:
groupByVars - Variables to group the results by.
projectedVars - Variables to project out to the resulting SolutionList. These should be a subset of the groupByVars. If a projected var is not also in the groupByVars, no bindings will be returned for that var.
projectCount - If true, calculate aggregate function COUNT on all grouped solutions.
countDistinct - If true, only sum up distinct solutions when calculating count.
Method Detail

refineSolutions

public SolutionSet refineSolutions(SolutionSet results)
Projects the provided SolutionSet using the provided group by var, projection vars and count criteria.

Parameters:
results - SolutionSet to project.
Returns:
Projected SolutionList with group by, count and distinct applied as specified.


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.