org.openanzo.glitter.util
Class Glitter

java.lang.Object
  extended by org.openanzo.glitter.util.Glitter

public class Glitter
extends java.lang.Object

The Glitter class provides a variety of static utility methods.

Author:
lee

Method Summary
static java.net.URI createURI(java.lang.String s)
          Synonym for URI.create(String).
static org.apache.commons.logging.Log getLog()
          Provides access to a common log.
static java.lang.String getReadableQueryPlan(TreeNode n, QueryExecutionPlan plan)
          Pretty-printer for QueryExecutionPlan.
static boolean isUsedOutsideOfNode(Bindable b, TreeNode n, QueryInformation qc)
          Tests if a given variable (or blank node) appears in the query outside of a given node and its descendants.
static TreeNode rewriteTree(TreeNode node, TreeRewriter rewriter)
          Implements a post-order traversal which rewrites tree nodes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLog

public static org.apache.commons.logging.Log getLog()
Provides access to a common log.

Returns:
the common log for Glitter

createURI

public static java.net.URI createURI(java.lang.String s)
Synonym for URI.create(String).

Parameters:
s - String representation of URI
Returns:
the URI representation of the given string

getReadableQueryPlan

public static java.lang.String getReadableQueryPlan(TreeNode n,
                                                    QueryExecutionPlan plan)
Pretty-printer for QueryExecutionPlan.

Parameters:
n - The root node for query planning.
plan - The plan.
Returns:
A human-readable string explaining the query plan.

rewriteTree

public static TreeNode rewriteTree(TreeNode node,
                                   TreeRewriter rewriter)
Implements a post-order traversal which rewrites tree nodes.

Parameters:
node - The root of the nodes to rewrite.
rewriter - A TreeRewriter that examines each node.
Returns:
null, if node should be removed. Otherwise, the return value is substituted in-plcae for node in the query tree.

isUsedOutsideOfNode

public static boolean isUsedOutsideOfNode(Bindable b,
                                          TreeNode n,
                                          QueryInformation qc)
Tests if a given variable (or blank node) appears in the query outside of a given node and its descendants.

Parameters:
b - The variable or blank node to test.
n - The root node of the tree segment that should be excluded from a search
qc - The QueryInformation that provides a look at the entire query
Returns:
true if the given variable appears in the query outside of a given node and its descendants.


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