org.d2rq.db.op.util
Class OpUtil

java.lang.Object
  extended by org.d2rq.db.op.util.OpUtil

public class OpUtil
extends Object

Various utility functions for working with DatabaseOp instances.

Author:
Richard Cyganiak (richard@cyganiak.de)

Method Summary
static Expression getDerivedColumnExpression(DatabaseOp op, ColumnName column)
           
static boolean isConstantColumn(DatabaseOp op, ColumnName column)
          Check if the column is known to have the same value in all rows.
static boolean isEmpty(DatabaseOp tabular)
           
static boolean isTrivial(DatabaseOp tabular)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isEmpty

public static boolean isEmpty(DatabaseOp tabular)
Returns:
true if the table is known to have zero rows

isTrivial

public static boolean isTrivial(DatabaseOp tabular)
Returns:
true if the table has one row with no columns

getDerivedColumnExpression

public static Expression getDerivedColumnExpression(DatabaseOp op,
                                                    ColumnName column)

isConstantColumn

public static boolean isConstantColumn(DatabaseOp op,
                                       ColumnName column)
Check if the column is known to have the same value in all rows. This is the case for column X in queries like this: SELECT X FROM T WHERE X=5 AND Y>0 SELECT 5 AS X The implementation walks through the operator tree, assuming by default that columns are not constant, and looking for possible reasons why they might. If such a reason is found, further recursion is stopped.

Parameters:
op -
column -
Returns: