de.fuberlin.wiwiss.d2rq.algebra
Class AliasMap
java.lang.Object
de.fuberlin.wiwiss.d2rq.algebra.ColumnRenamer
de.fuberlin.wiwiss.d2rq.algebra.AliasMap
public class AliasMap
- extends ColumnRenamer
A map from table names to aliases. Can be applied to various objects and will
replace all mentions of a table with its alias. For some kinds of objects,
the inverse operation is available as well.
TODO: There is an assumption that one original table has at most one alias.
Otherwise, the applyTo() operations are indeterministic. This is troublesome.
All uses of this class that need applyTo() should probably be redesigned
to use something else than a "real" AliasMap.
TODO: AliasMap and ColumnRenamer are different concepts.
An AliasMap is a bunch of "table AS alias" delcarations. A column renamer is
something that can be applied to a column name to yield a new one. It should
be possible to obtain a ColumnRenamer from a declared AliasMap, but they should
be separate classes. AliasMap might also be better called Aliases or AliasSet.
- Version:
- $Id: AliasMap.java,v 1.8 2007/10/22 10:21:16 cyganiak Exp $
- Author:
- Richard Cyganiak (richard@cyganiak.de)
NO_ALIASES
public static final AliasMap NO_ALIASES
AliasMap
public AliasMap(Collection aliases)
create1
public static AliasMap create1(RelationName original,
RelationName alias)
isAlias
public boolean isAlias(RelationName name)
hasAlias
public boolean hasAlias(RelationName original)
applyTo
public RelationName applyTo(RelationName original)
originalOf
public RelationName originalOf(RelationName name)
applyTo
public Attribute applyTo(Attribute attribute)
- Specified by:
applyTo
in class ColumnRenamer
- Parameters:
attribute
- A column
- Returns:
- The renamed version of that column, or the same column if the renamer
does not apply to this argument
originalOf
public Attribute originalOf(Attribute attribute)
applyTo
public AliasMap.Alias applyTo(AliasMap.Alias alias)
originalOf
public AliasMap.Alias originalOf(AliasMap.Alias alias)
applyTo
public Join applyTo(Join join)
- Overrides:
applyTo
in class ColumnRenamer
- Parameters:
join
- A join
- Returns:
- A join with all columns renamed according to this Renamer
applyTo
public AliasMap applyTo(AliasMap other)
- Specified by:
applyTo
in class ColumnRenamer
equals
public boolean equals(Object other)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
toString
public String toString()
- Overrides:
toString
in class Object