de.fuberlin.wiwiss.d2rq.algebra
Class Relation

java.lang.Object
  extended by de.fuberlin.wiwiss.d2rq.algebra.Relation
All Implemented Interfaces:
RelationalOperators
Direct Known Subclasses:
RelationImpl

public abstract class Relation
extends Object
implements RelationalOperators

TODO Describe this type TODO Add uniqueConstraints() TODO Explicitly list tables!!!

Author:
Richard Cyganiak (richard@cyganiak.de)

Field Summary
static Relation EMPTY
           
static int NO_LIMIT
           
static Relation TRUE
           
 
Fields inherited from interface de.fuberlin.wiwiss.d2rq.algebra.RelationalOperators
DUMMY
 
Constructor Summary
Relation()
           
 
Method Summary
abstract  AliasMap aliases()
          The tables that are used to set up this relation, both in their aliased form, and with their original physical names.
 Set<Attribute> allKnownAttributes()
           
static int combineLimits(int limit1, int limit2)
           
abstract  Expression condition()
          An expression that must be satisfied for all tuples in the relation.
static Relation createSimpleRelation(ConnectedDB database, Attribute[] attributes)
           
abstract  ConnectedDB database()
           
 boolean isTrivial()
           
abstract  boolean isUnique()
           
abstract  Set<Join> joinConditions()
          Returns the join conditions that must hold between the tables in the relation.
abstract  int limit()
          The limit clause for the SQL result set
abstract  int limitInverse()
          The limit clause for the SQL result set describing the inverse relation
abstract  List<OrderSpec> orderSpecs()
          The expressions (and ascending/descending flag) used for ordering the relation.
abstract  Set<ProjectionSpec> projections()
          The attributes or expressions that the relation is projected to.
abstract  Expression softCondition()
          An expression satisfied by all tuples in the relation.
 Set<RelationName> tables()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.fuberlin.wiwiss.d2rq.algebra.RelationalOperators
project, renameColumns, select
 

Field Detail

NO_LIMIT

public static final int NO_LIMIT
See Also:
Constant Field Values

EMPTY

public static Relation EMPTY

TRUE

public static Relation TRUE
Constructor Detail

Relation

public Relation()
Method Detail

createSimpleRelation

public static Relation createSimpleRelation(ConnectedDB database,
                                            Attribute[] attributes)

database

public abstract ConnectedDB database()

aliases

public abstract AliasMap aliases()
The tables that are used to set up this relation, both in their aliased form, and with their original physical names.

Returns:
All table aliases required by this relation

joinConditions

public abstract Set<Join> joinConditions()
Returns the join conditions that must hold between the tables in the relation.

Returns:
A set of Joins

condition

public abstract Expression condition()
An expression that must be satisfied for all tuples in the relation.

Returns:
An expression; Expression.TRUE indicates no condition

softCondition

public abstract Expression softCondition()
An expression satisfied by all tuples in the relation. This is a necessary but not sufficient condition; it is descriptive and not prescriptive. Replacing the condition with Expression.TRUE does not change the contents of the relation. It is thus just an optional condition that can be used for optimization, but can be dropped or ignored if convenient. Typically, there is other Java code that ensures the condition regardless of whether it is present here or not. We use this in particular for adding IS NOT NULL constraints on all nullable columns that need to have a non-NULL value to form a triple or binding.

Returns:
An expression; Expression.TRUE indicates no soft condition

projections

public abstract Set<ProjectionSpec> projections()
The attributes or expressions that the relation is projected to.

Returns:
A set of ProjectionSpecs

isUnique

public abstract boolean isUnique()

orderSpecs

public abstract List<OrderSpec> orderSpecs()
The expressions (and ascending/descending flag) used for ordering the relation.


limit

public abstract int limit()
The limit clause for the SQL result set

Returns:
number of records to return

limitInverse

public abstract int limitInverse()
The limit clause for the SQL result set describing the inverse relation

Returns:
number of records to return

allKnownAttributes

public Set<Attribute> allKnownAttributes()

tables

public Set<RelationName> tables()

isTrivial

public boolean isTrivial()
Returns:
true if this is the trivial table (one row, no columns)

combineLimits

public static int combineLimits(int limit1,
                                int limit2)