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.utilities.optionhandling.AbstractParameterizable
          extended by de.lmu.ifi.dbs.elki.database.connection.AbstractDatabaseConnection<O>
All Implemented Interfaces:
DatabaseConnection<O>, Loggable, Parameterizable
Direct Known Subclasses:
InputStreamDatabaseConnection, MultipleFileBasedDatabaseConnection

public abstract class AbstractDatabaseConnection<O extends DatabaseObject>
extends AbstractParameterizable
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 String CLASS_LABEL_CLASS_D
          Description for parameter classLabelClass.
static String CLASS_LABEL_CLASS_P
          Option string for parameter classLabelClass.
static String CLASS_LABEL_INDEX_D
          Description for parameter classLabelIndex.
static String CLASS_LABEL_INDEX_P
          Option string for parameter classLabelIndex.
private  String classLabelClass
          The class name for a class label.
protected  Integer classLabelIndex
          The index of the class label, null if no class label is specified.
(package private)  Database<O> database
          The database.
static OptionID DATABASE_ID
          OptionID for DATABASE_PARAM
private  ClassParameter<Database> DATABASE_PARAM
          Parameter to specify the database to be provided by the parse method.
static String EXTERNAL_ID_INDEX_D
          Description for parameter classLabelIndex.
static String EXTERNAL_ID_INDEX_P
          Option string for parameter externalIDIndex.
private  Integer externalIDIndex
          The index of the external id label, null if no external id label is specified.
(package private)  boolean forceExternalID
          True, if an external label needs to be set.
static String LABEL_CONCATENATION
          A sign to separate components of a label.
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
optionHandler
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug
 
Fields inherited from interface de.lmu.ifi.dbs.elki.database.connection.DatabaseConnection
PROPERTY_DATABASE, PROPERTY_PARSER
 
Constructor Summary
protected AbstractDatabaseConnection()
          AbstractDatabaseConnection already provides the setting of the database according to parameters.
 
Method Summary
 List<AttributeSettings> getAttributeSettings()
          Returns the parameter setting of the attributes.
protected  List<ObjectAndAssociations<O>> normalizeAndTransformLabels(List<ObjectAndLabels<O>> objectAndLabelsList, Normalization<O> normalization)
          Normalizes and transforms the specified list of objects and their labels into a list of objects and their associtaions.
 String[] setParameters(String[] args)
          Sets the attributes of the class accordingly to the given parameters.
private  List<ObjectAndAssociations<O>> transformLabels(List<ObjectAndLabels<O>> objectAndLabelsList)
          Transforms the specified list of objects and their labels into a list of objects and their associtaions.
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
addOption, checkGlobalParameterConstraints, deleteOption, description, description, description, getParameters, getParameterValue, getPossibleOptions, inlineDescription, isSet, setParameters
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, message, progress, progress, progress, verbose, 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
 
Methods inherited from interface de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizable
checkGlobalParameterConstraints, description, getParameters, getPossibleOptions, inlineDescription
 

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 ClassParameter<Database> DATABASE_PARAM
Parameter to specify the database to be provided by the parse method.

Default value: SequentialDatabase

Key: -dbconnection.database


EXTERNAL_ID_INDEX_P

public static final String EXTERNAL_ID_INDEX_P
Option string for parameter externalIDIndex.

See Also:
Constant Field Values

EXTERNAL_ID_INDEX_D

public static final String EXTERNAL_ID_INDEX_D
Description for parameter classLabelIndex.

See Also:
Constant Field Values

CLASS_LABEL_INDEX_P

public static final String CLASS_LABEL_INDEX_P
Option string for parameter classLabelIndex.

See Also:
Constant Field Values

CLASS_LABEL_INDEX_D

public static final String CLASS_LABEL_INDEX_D
Description for parameter classLabelIndex.

See Also:
Constant Field Values

CLASS_LABEL_CLASS_P

public static final String CLASS_LABEL_CLASS_P
Option string for parameter classLabelClass.

See Also:
Constant Field Values

CLASS_LABEL_CLASS_D

public static final String CLASS_LABEL_CLASS_D
Description for parameter classLabelClass.


externalIDIndex

private Integer externalIDIndex
The index of the external id label, null if no external id label is specified.


classLabelIndex

protected Integer classLabelIndex
The index of the class label, null if no class label is specified.


classLabelClass

private String classLabelClass
The class name for a class label.


database

Database<O extends DatabaseObject> database
The database.


forceExternalID

boolean forceExternalID
True, if an external label needs to be set. Default is false.

Constructor Detail

AbstractDatabaseConnection

protected AbstractDatabaseConnection()
AbstractDatabaseConnection already provides the setting of the database according to parameters.

Method Detail

setParameters

public String[] setParameters(String[] args)
                       throws ParameterException
Description copied from interface: Parameterizable
Sets the attributes of the class accordingly to the given parameters. Returns a new String array containing those entries of the given array that are neither expected nor used by this Parameterizable.

Specified by:
setParameters in interface Parameterizable
Overrides:
setParameters in class AbstractParameterizable
Parameters:
args - parameters to set the attributes accordingly to
Returns:
String[] an array containing the unused parameters
Throws:
ParameterException - in case of wrong parameter-setting
See Also:
Parameterizable.setParameters(java.lang.String[])

getAttributeSettings

public List<AttributeSettings> getAttributeSettings()
Returns the parameter setting of the attributes.

Specified by:
getAttributeSettings in interface Parameterizable
Overrides:
getAttributeSettings in class AbstractParameterizable
Returns:
the parameter setting of the attributes
See Also:
Parameterizable.getAttributeSettings()

normalizeAndTransformLabels

protected List<ObjectAndAssociations<O>> normalizeAndTransformLabels(List<ObjectAndLabels<O>> objectAndLabelsList,
                                                                     Normalization<O> normalization)
                                                                                     throws NonNumericFeaturesException
Normalizes and transforms the specified list of objects and their labels into a list of objects and their associtaions.

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<ObjectAndAssociations<O>> transformLabels(List<ObjectAndLabels<O>> objectAndLabelsList)
Transforms the specified list of objects and their labels into a list of objects and their associtaions.

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

Release 0.1 (2008-07-10_1838)