org.openanzo.glitter.query
Class Projection

java.lang.Object
  extended by org.openanzo.glitter.query.Projection
All Implemented Interfaces:
QueryResultForm

public class Projection
extends java.lang.Object
implements QueryResultForm

Projection handles the SELECT SPARQL query form, in which the result set is returned after being projected out to only the selected variables.

Author:
lee

Constructor Summary
Projection()
          Default constructor.
Projection(boolean distinct)
          Selects for all variables.
Projection(Variable[] variables, Variable[] groupByVars, boolean distinct, boolean reduced, boolean projectCount, boolean countDistinct)
           
 
Method Summary
 Variable[] getProjectedVariables()
           
 boolean isDistinct()
           
 boolean isReduced()
           
 boolean projectCount()
           
 SolutionSet refineSolutions(SolutionSet results)
          Result forms are given a chance to apply solution modifiers to the solution set before transforming the results.
 java.lang.Object serializeResults(SolutionSet results)
           
 SolutionSet serializeResultsAsResultSet(SolutionSet solutions)
          Serializing a Projection is a no-op.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Projection

public Projection(Variable[] variables,
                  Variable[] groupByVars,
                  boolean distinct,
                  boolean reduced,
                  boolean projectCount,
                  boolean countDistinct)
Parameters:
variables - The variables being selected for
distinct - If true, return only distinct resultset rows
reduced - If true (and distinct is false), indicates that the implementation is free to return anywhere between 1 and the standard (algebra-defined) cardinality of each solution.
projectCount - If true, calculate aggregate function COUNT on all grouped solutions.
countDistinct - If true, only sum up distinct solutions when calculating count.

Projection

public Projection()
Default constructor. Selects for all variables and all duplicate rows.


Projection

public Projection(boolean distinct)
Selects for all variables.

Parameters:
distinct - If true, return only distinct resultset rows
Method Detail

isDistinct

public boolean isDistinct()
Returns:
Whether this projection eliminates duplicate result rows

isReduced

public boolean isReduced()
Returns:
Whether this is a REDUCED query. See #Projection(Variable[], boolean, boolean).

projectCount

public boolean projectCount()

getProjectedVariables

public Variable[] getProjectedVariables()
Returns:
The array of selected variables.

serializeResults

public java.lang.Object serializeResults(SolutionSet results)
Specified by:
serializeResults in interface QueryResultForm
Parameters:
results - The solution set after all solution modified have been applied.
Returns:
A form of the solution set specific to this QueryResultForm.

serializeResultsAsResultSet

public SolutionSet serializeResultsAsResultSet(SolutionSet solutions)
Serializing a Projection is a no-op.

Parameters:
solutions - The refined SolutionSet
Returns:
The refined SolutionSet

refineSolutions

public SolutionSet refineSolutions(SolutionSet results)
Description copied from interface: QueryResultForm
Result forms are given a chance to apply solution modifiers to the solution set before transforming the results. (For example, Projection might apply DISTINCT here.

Specified by:
refineSolutions in interface QueryResultForm
Parameters:
results - The original solution set
Returns:
The (possibly) modified solution set

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


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