de.fuberlin.wiwiss.d2rq.algebra
Class MutableRelation

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

public class MutableRelation
extends Object
implements RelationalOperators

Wraps a relation and allows it to be modified by relational operators. Normally, applying an operator to a relation results in a new object. This is impractical in some places. The MutableRelation solves this problem.

Version:
$Id: MutableRelation.java,v 1.2 2006/09/11 23:22:24 cyganiak Exp $
Author:
Richard Cyganiak (richard@cyganiak.de)

Field Summary
static MutableRelation DUMMY
           
 
Constructor Summary
MutableRelation(Relation initialState)
           
 
Method Summary
 Relation immutableSnapshot()
           
 Relation renameColumns(ColumnRenamer renamer)
          Applies the rename operator to this relation.
 Relation select(Map attributeConditions)
          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
 

Field Detail

DUMMY

public static final MutableRelation DUMMY
Constructor Detail

MutableRelation

public MutableRelation(Relation initialState)
Method Detail

immutableSnapshot

public Relation immutableSnapshot()

renameColumns

public Relation renameColumns(ColumnRenamer renamer)
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:
renamer - 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

select

public Relation select(Map attributeConditions)
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:
attributeConditions - A map from Attributes to Strings
Returns:
A relation whose tuples satisfy the conditions