org.openanzo.glitter.syntax.abstrakt
Class Optional

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.Optional

public class Optional
extends GraphPattern

Represents an OPTIONAL pattern in a SPARQL query, which consists possibly of a pattern that must match the underlying data, and a pattern that optionally might match the underlying data.

Author:
lee

Constructor Summary
Optional(GraphPattern mayMatch)
          Constructs an Optional only from an optional pattern.
Optional(GraphPattern mustMatch, GraphPattern mayMatch, java.lang.Iterable<Expression> filters)
          Constructs an Optional from a pattern that must match, one that optionally matches, and a collection of filter expressions.
 
Method Summary
 void addChild(TreeNode child)
          Adds the given child at the end of this node's children.
 java.util.Iterator<GraphPattern> getChildren()
           
 java.util.Set<Expression> getFilters()
          Default implementation of TreeNode.getFilters().
 GraphPattern getMayMatchPattern()
           
 GraphPattern getMustMatchPattern()
           
 boolean removeChild(TreeNode child)
          Removes the given child from the collection of children
 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

Optional

public Optional(GraphPattern mustMatch,
                GraphPattern mayMatch,
                java.lang.Iterable<Expression> filters)
Constructs an Optional from a pattern that must match, one that optionally matches, and a collection of filter expressions.

Parameters:
mustMatch -
mayMatch -
filters -

Optional

public Optional(GraphPattern mayMatch)
Constructs an Optional only from an optional pattern.

Parameters:
mayMatch -
Method Detail

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.

getMustMatchPattern

public GraphPattern getMustMatchPattern()
Returns:
The required part of the OPTIONAL.

getMayMatchPattern

public GraphPattern getMayMatchPattern()
Returns:
The optional part of the OPTIONAL

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().

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.