de.fuberlin.wiwiss.d2rq.algebra
Class RelationImpl

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

public class RelationImpl
extends Object
implements Relation


Field Summary
 
Fields inherited from interface de.fuberlin.wiwiss.d2rq.algebra.Relation
EMPTY, TRUE
 
Constructor Summary
RelationImpl(ConnectedDB database, AliasMap aliases, Map attributeConditions, Expression condition, Set joinConditions)
           
 
Method Summary
 AliasMap aliases()
          The tables that are used to set up this relation, both in their aliased form, and with their original physical names.
 Map attributeConditions()
          All tuples in the relation must have a certain value for an attribute if present in this map.
 Expression condition()
          An expression that must be satisfied for all tuples in the relation.
 ConnectedDB database()
           
 Set joinConditions()
          Returns the join conditions that must hold between the tables in the relation.
 Relation renameColumns(ColumnRenamer renames)
          Applies the rename operator to this relation.
 Relation select(Map newConditions)
          Applies the selection operator to this relation, using equality conditions on a number of attributes as the selection expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelationImpl

public RelationImpl(ConnectedDB database,
                    AliasMap aliases,
                    Map attributeConditions,
                    Expression condition,
                    Set joinConditions)
Method Detail

database

public ConnectedDB database()
Specified by:
database in interface Relation

aliases

public AliasMap aliases()
Description copied from interface: Relation
The tables that are used to set up this relation, both in their aliased form, and with their original physical names.

Specified by:
aliases in interface Relation
Returns:
All table aliases required by this relation

attributeConditions

public Map attributeConditions()
Description copied from interface: Relation
All tuples in the relation must have a certain value for an attribute if present in this map.

Specified by:
attributeConditions in interface Relation
Returns:
A map from Attributen to strings

condition

public Expression condition()
Description copied from interface: Relation
An expression that must be satisfied for all tuples in the relation.

Specified by:
condition in interface Relation
Returns:
An expression; Expression.TRUE indicates no condition

joinConditions

public Set joinConditions()
Description copied from interface: Relation
Returns the join conditions that must hold between the tables in the relation.

Specified by:
joinConditions in interface Relation
Returns:
A set of Joins

select

public Relation select(Map newConditions)
Description copied from interface: RelationalOperators

Applies the selection operator to this relation, using equality conditions on a number of attributes as the selection expression. The new relation will contain only tuples whose attribute values are equal to the string values in the argument map.

Selection on attributes that don't exist in the relation are considered to be always false and will cause an empty relation.

Specified by:
select in interface RelationalOperators
Parameters:
newConditions - A map from Attributes to Strings
Returns:
A relation whose tuples satisfy the conditions

renameColumns

public Relation renameColumns(ColumnRenamer renames)
Description copied from interface: RelationalOperators

Applies the rename operator to this relation.

Renames of attributes that don't exist in the relation are ignored.

Specified by:
renameColumns in interface RelationalOperators
Parameters:
renames - A map from original to replacement names
Returns:
A relation in which all occurrences of the old names have been replaced with the new ones