de.fuberlin.wiwiss.d2rq.algebra
Class Attribute

java.lang.Object
  extended by de.fuberlin.wiwiss.d2rq.algebra.Attribute
All Implemented Interfaces:
Comparable

public class Attribute
extends Object
implements Comparable

A database column.

Version:
$Id: Attribute.java,v 1.6 2006/09/15 17:53:37 cyganiak Exp $
Author:
Richard Cyganiak (richard@cyganiak.de)

Constructor Summary
Attribute(RelationName relationName, String attributeName)
           
Attribute(String schemaName, String tableName, String attributeName)
          Constructs a new attribute from a schema name, table name and attribute name.
 
Method Summary
 String attributeName()
          Extracts the database column name from a tablename.columnname combination.
 int compareTo(Object otherObject)
          Compares columns alphanumerically by qualified name, case sensitive.
 boolean equals(Object other)
          Compares this instance to another object.
 int hashCode()
          Returns a hash code for this intance.
 String qualifiedName()
          Returns the column name in Table.Column form
 RelationName relationName()
          Returns the table name, including the schema if the table is in a schema.
 String schemaName()
          Extracts the database schema name from a schema.table.colum combination.
 String tableName()
          Returns the database table name.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attribute

public Attribute(String schemaName,
                 String tableName,
                 String attributeName)
Constructs a new attribute from a schema name, table name and attribute name.

Parameters:
schemaName - The schema name, or null if not in a schema
tableName - The table name
attributeName - The column name

Attribute

public Attribute(RelationName relationName,
                 String attributeName)
Method Detail

qualifiedName

public String qualifiedName()
Returns the column name in Table.Column form

Returns:
the column name

attributeName

public String attributeName()
Extracts the database column name from a tablename.columnname combination.

Returns:
database column name.

tableName

public String tableName()
Returns the database table name.

Returns:
database table name.

relationName

public RelationName relationName()
Returns the table name, including the schema if the table is in a schema.

Returns:
The table name in "table" or "schema.table" notation

schemaName

public String schemaName()
Extracts the database schema name from a schema.table.colum combination.

Returns:
database schema name, or null if no schema is specified.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object other)
Compares this instance to another object. Two Columns are considered equal when they have the same fully qualified name. We need this because we want to use Column instances as map keys. TODO: should not be equal if from different databases

Overrides:
equals in class Object

hashCode

public int hashCode()
Returns a hash code for this intance. We need this because we want to use Column instances as map keys. TODO: should be different for same-name columns from different databases

Overrides:
hashCode in class Object

compareTo

public int compareTo(Object otherObject)
Compares columns alphanumerically by qualified name, case sensitive. Attributes with schema are larger than attributes without schema.

Specified by:
compareTo in interface Comparable