org.d2rq.algebra
Class NodeRelationUtil

java.lang.Object
  extended by org.d2rq.algebra.NodeRelationUtil

public class NodeRelationUtil
extends Object

Utility operations for manipulating NodeRelations. Basically provides a number of relational operators.

Author:
Richard Cyganiak (richard@cyganiak.de)

Method Summary
static NodeRelation extendWith(NodeRelation table, Binding binding)
          Joins this NodeRelation with a Binding.
static NodeRelation limit(NodeRelation table, int limit)
           
static NodeRelation order(NodeRelation nodeRelation, Var orderByVar, boolean ascending)
           
static NodeRelation project(NodeRelation original, Set<Var> vars)
           
static NodeRelation renameSingleRelation(NodeRelation table, TableName oldName, TableName newName)
           
static NodeRelation renameWithPrefix(NodeRelation table, int index)
           
static NodeRelation select(NodeRelation original, Expression expression)
           
static NodeRelation select(NodeRelation original, Var var, Node value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

extendWith

public static NodeRelation extendWith(NodeRelation table,
                                      Binding binding)
Joins this NodeRelation with a Binding. Any row in this NodeRelation that is incompatible with the binding will be dropped, and any compatible row will be extended with FixedNodeMakers whose node is taken from the binding. FIXME: This doesn't behave correctly when a node maker is available for a given variable but produces unbound results. Everything is compatible with unbound. FIXME: This ignores the condition of the binding maker, if any is present.

Parameters:
binding - A binding to join with this NodeRelation
Returns:
The joined NodeRelation

limit

public static NodeRelation limit(NodeRelation table,
                                 int limit)

order

public static NodeRelation order(NodeRelation nodeRelation,
                                 Var orderByVar,
                                 boolean ascending)

project

public static NodeRelation project(NodeRelation original,
                                   Set<Var> vars)

renameWithPrefix

public static NodeRelation renameWithPrefix(NodeRelation table,
                                            int index)

renameSingleRelation

public static NodeRelation renameSingleRelation(NodeRelation table,
                                                TableName oldName,
                                                TableName newName)

select

public static NodeRelation select(NodeRelation original,
                                  Expression expression)

select

public static NodeRelation select(NodeRelation original,
                                  Var var,
                                  Node value)