Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.database.connection
Class AbstractDatabaseConnection<O extends DatabaseObject>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.database.connection.AbstractDatabaseConnection<O>
Type Parameters:
O - the type of DatabaseObject to be provided by the implementing class as element of the supplied database
All Implemented Interfaces:
DatabaseConnection<O>, Parameterizable
Direct Known Subclasses:
EmptyDatabaseConnection, InputStreamDatabaseConnection, MultipleFileBasedDatabaseConnection

public abstract class AbstractDatabaseConnection<O extends DatabaseObject>
extends AbstractLoggable
implements DatabaseConnection<O>

Abstract super class for all database connections. AbstractDatabaseConnection already provides the setting of the database according to parameters.

Author:
Elke Achtert

Field Summary
static OptionID CLASS_LABEL_CLASS_ID
          OptionID for CLASS_LABEL_CLASS_PARAM
private  ObjectParameter<ClassLabel> CLASS_LABEL_CLASS_PARAM
          Parameter to specify the association of occurring class labels, must extend ClassLabel.
static OptionID CLASS_LABEL_INDEX_ID
          OptionID for CLASS_LABEL_INDEX_PARAM
private  IntParameter CLASS_LABEL_INDEX_PARAM
          Optional parameter that specifies the index of the label to be used as class label, must be an integer equal to or greater than 0.
private  Class<? extends ClassLabel> classLabelClass
          Holds the value of CLASS_LABEL_CLASS_PARAM.
protected  Integer classLabelIndex
          Holds the value of CLASS_LABEL_INDEX_PARAM, null if no class label is specified.
(package private)  Database<O> database
          Holds the instance of the database specified by DATABASE_PARAM.
static OptionID DATABASE_ID
          OptionID for DATABASE_PARAM
private  ObjectParameter<Database<O>> DATABASE_PARAM
          Parameter to specify the database to be provided by the parse method, must extend Database.
static OptionID EXTERNAL_ID_INDEX_ID
          OptionID for EXTERNAL_ID_INDEX_PARAM
private  IntParameter EXTERNAL_ID_INDEX_PARAM
          Optional parameter that specifies the index of the label to be used as an external id, must be an integer equal to or greater than 0.
private  Integer externalIDIndex
          Holds the value of EXTERNAL_ID_INDEX_PARAM.
static String LABEL_CONCATENATION
          A sign to separate components of a label.
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug, logger
 
Constructor Summary
protected AbstractDatabaseConnection(Parameterization config, boolean forceExternalID)
          Adds parameters DATABASE_PARAM, CLASS_LABEL_INDEX_PARAM, CLASS_LABEL_CLASS_PARAM, and EXTERNAL_ID_INDEX_PARAM, to the option handler additionally to parameters of super class.
 
Method Summary
protected  List<Pair<O,Associations>> normalizeAndTransformLabels(List<Pair<O,List<String>>> objectAndLabelsList, Normalization<O> normalization)
          Normalizes and transforms the specified list of objects and their labels into a list of objects and their associations.
private  List<Pair<O,Associations>> transformLabels(List<Pair<O,List<String>>> objectAndLabelsList)
          Transforms the specified list of objects and their labels into a list of objects and their associations.
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, progress, verbose, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.database.connection.DatabaseConnection
getDatabase
 

Field Detail

LABEL_CONCATENATION

public static final String LABEL_CONCATENATION
A sign to separate components of a label.

See Also:
Constant Field Values

DATABASE_ID

public static final OptionID DATABASE_ID
OptionID for DATABASE_PARAM


DATABASE_PARAM

private final ObjectParameter<Database<O extends DatabaseObject>> DATABASE_PARAM
Parameter to specify the database to be provided by the parse method, must extend Database.

Default value: SequentialDatabase

Key: -dbc.database


database

Database<O extends DatabaseObject> database
Holds the instance of the database specified by DATABASE_PARAM.


CLASS_LABEL_INDEX_ID

public static final OptionID CLASS_LABEL_INDEX_ID
OptionID for CLASS_LABEL_INDEX_PARAM


CLASS_LABEL_INDEX_PARAM

private final IntParameter CLASS_LABEL_INDEX_PARAM
Optional parameter that specifies the index of the label to be used as class label, must be an integer equal to or greater than 0.

Key: -dbc.classLabelIndex


classLabelIndex

protected Integer classLabelIndex
Holds the value of CLASS_LABEL_INDEX_PARAM, null if no class label is specified.


CLASS_LABEL_CLASS_ID

public static final OptionID CLASS_LABEL_CLASS_ID
OptionID for CLASS_LABEL_CLASS_PARAM


CLASS_LABEL_CLASS_PARAM

private final ObjectParameter<ClassLabel> CLASS_LABEL_CLASS_PARAM
Parameter to specify the association of occurring class labels, must extend ClassLabel.

Default value: SimpleClassLabel

Key: -dbc.classLabelClass


classLabelClass

private Class<? extends ClassLabel> classLabelClass
Holds the value of CLASS_LABEL_CLASS_PARAM.


EXTERNAL_ID_INDEX_ID

public static final OptionID EXTERNAL_ID_INDEX_ID
OptionID for EXTERNAL_ID_INDEX_PARAM


EXTERNAL_ID_INDEX_PARAM

private final IntParameter EXTERNAL_ID_INDEX_PARAM
Optional parameter that specifies the index of the label to be used as an external id, must be an integer equal to or greater than 0. If the external id is an integer value the external id is also used as internal id, otherwise an association with AssociationID.EXTERNAL_ID is set.

Key: -dbc.externalIDIndex


externalIDIndex

private Integer externalIDIndex
Holds the value of EXTERNAL_ID_INDEX_PARAM.

Constructor Detail

AbstractDatabaseConnection

protected AbstractDatabaseConnection(Parameterization config,
                                     boolean forceExternalID)
Adds parameters DATABASE_PARAM, CLASS_LABEL_INDEX_PARAM, CLASS_LABEL_CLASS_PARAM, and EXTERNAL_ID_INDEX_PARAM, to the option handler additionally to parameters of super class.

Method Detail

normalizeAndTransformLabels

protected List<Pair<O,Associations>> normalizeAndTransformLabels(List<Pair<O,List<String>>> objectAndLabelsList,
                                                                 Normalization<O> normalization)
                                                                                 throws NonNumericFeaturesException
Normalizes and transforms the specified list of objects and their labels into a list of objects and their associations.

Parameters:
objectAndLabelsList - the list of object and their labels to be transformed
normalization - the normalization to be applied
Returns:
a list of normalized objects and their associations
Throws:
NonNumericFeaturesException - if any exception occurs during normalization

transformLabels

private List<Pair<O,Associations>> transformLabels(List<Pair<O,List<String>>> objectAndLabelsList)
Transforms the specified list of objects and their labels into a list of objects and their associations.

Parameters:
objectAndLabelsList - the list of object and their labels to be transformed
Returns:
a list of objects and their associations

Release 0.3 (2010-03-31_1612)