org.openanzo.glitter.syntax.abstrakt
Class Group

java.lang.Object
  extended by org.openanzo.glitter.syntax.abstrakt.TreeNode
      extended by org.openanzo.glitter.syntax.abstrakt.GraphPattern
          extended by org.openanzo.glitter.syntax.abstrakt.Group

public class Group
extends GraphPattern

A group represents an ordered collection of graph patterns delimited by curly braces in a SPARQL query. A group also contains a set of filters that apply to the bindings generated from the patterns within the group.

Author:
lee

Constructor Summary
Group()
          Default constructor.
Group(java.util.ArrayList<GraphPattern> patterns)
          Construct a group with no filters from a list of graph patterns.
Group(java.util.ArrayList<GraphPattern> patterns, java.util.HashSet<Expression> filters)
          Construct a group from a list of patterns and a set of filter expressions.
Group(GraphPattern[] patterns, Expression[] filters)
          Construct a group from an array of patterns and of filter expressions.
 
Method Summary
 void addChild(TreeNode child)
          Adds the given child at the end of this node's children.
 void addFilter(Expression f)
          Add the given filter to this group.
 void addGraphPattern(GraphPattern gp)
          Adds the given graph pattern to this group.
 void addPatternsFrom(Group other)
          Add all the graph patterns from another Group to this group.
 Group clone()
           
 java.util.Iterator<GraphPattern> getChildren()
           
 java.util.Set<Expression> getFilters()
          Default implementation of TreeNode.getFilters().
 java.lang.Iterable<GraphPattern> getPatterns()
          Get an iterable collection of this group's graph patterns
 void makeLastPatternOptional(Group mayMatch)
          Converts the last pattern added to this group to be the required portion of an Optional.
 void removeAllFilters()
          Remove all filters from this group.
 boolean removeChild(TreeNode child)
          Removes the given child from the collection of children
 boolean removeFilter(Expression f)
          Remove the given filter from this group.
 boolean removeGraphPattern(GraphPattern gp)
          Removes the given graph pattern from this group.
 boolean replaceChild(TreeNode oldChild, TreeNode newChild)
          Changes the tree below this node by replacing oldChild with newChild
 java.lang.String toString()
           
 
Methods inherited from class org.openanzo.glitter.syntax.abstrakt.TreeNode
containsVariable, getBindableVariableCount, getBindableVariableSet, getInScopeFilterSet, getParent, getRoot, getVariableCount, getVariableSet, invalidateCache, invalidateCache, mightBindVariable, prettyPrint, prettyPrint
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Group

public Group()
Default constructor.


Group

public Group(GraphPattern[] patterns,
             Expression[] filters)
Construct a group from an array of patterns and of filter expressions.

Parameters:
patterns -
filters -

Group

public Group(java.util.ArrayList<GraphPattern> patterns,
             java.util.HashSet<Expression> filters)
Construct a group from a list of patterns and a set of filter expressions.

Parameters:
patterns -
filters -

Group

public Group(java.util.ArrayList<GraphPattern> patterns)
Construct a group with no filters from a list of graph patterns.

Parameters:
patterns - graph patterns to add to group
Method Detail

clone

public Group clone()
Overrides:
clone in class java.lang.Object

removeFilter

public boolean removeFilter(Expression f)
Remove the given filter from this group.

Parameters:
f - expression to remove from group
Returns:
true if given filter was removed from this group.

removeAllFilters

public void removeAllFilters()
Remove all filters from this group.


addFilter

public void addFilter(Expression f)
Add the given filter to this group.

Parameters:
f - expression to add group

getFilters

public java.util.Set<Expression> getFilters()
Description copied from class: TreeNode
Default implementation of TreeNode.getFilters(). Most tree nodes cannot contain filters.

Overrides:
getFilters in class TreeNode
Returns:
Default implementation of TreeNode.getFilters().

removeGraphPattern

public boolean removeGraphPattern(GraphPattern gp)
Removes the given graph pattern from this group.

Parameters:
gp - graph pattern to remove from group
Returns:
true if given patern was removed from the group

addGraphPattern

public void addGraphPattern(GraphPattern gp)
Adds the given graph pattern to this group.

Parameters:
gp - graph pattern to add to group

addPatternsFrom

public void addPatternsFrom(Group other)
Add all the graph patterns from another Group to this group.

Parameters:
other - source group from which all patterns will be added to this group

getPatterns

public java.lang.Iterable<GraphPattern> getPatterns()
Get an iterable collection of this group's graph patterns

Returns:
an iterable collection of this group's graph patterns

makeLastPatternOptional

public void makeLastPatternOptional(Group mayMatch)
Converts the last pattern added to this group to be the required portion of an Optional. The new Optional replaces the last pattern as a child of this group.

Parameters:
mayMatch - The optional part of the new optional.

toString

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

getChildren

public java.util.Iterator<GraphPattern> getChildren()
Specified by:
getChildren in class TreeNode
Returns:
An Iterator over the children of this node.

replaceChild

public boolean replaceChild(TreeNode oldChild,
                            TreeNode newChild)
Description copied from class: TreeNode
Changes the tree below this node by replacing oldChild with newChild

Specified by:
replaceChild in class TreeNode
Returns:
true if the oldChild was found and replaced; false otherwise.

removeChild

public boolean removeChild(TreeNode child)
Description copied from class: TreeNode
Removes the given child from the collection of children

Specified by:
removeChild in class TreeNode
Returns:
true if the child was found and removed; false otherwise.

addChild

public void addChild(TreeNode child)
Description copied from class: TreeNode
Adds the given child at the end of this node's children.

Specified by:
addChild in class TreeNode


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