proper.database
Class Reader

java.lang.Object
  extended by proper.core.ProperObject
      extended by proper.database.ConnectorObject
          extended by proper.database.ExecutorObject
              extended by proper.database.Reader
All Implemented Interfaces:
ProperInterface

public class Reader
extends ExecutorObject

This class reads all the data from a given SQL table and creates WEKA instances from that.
A verbose level of 2 prints also the SQL statements for retrieving the instances.

Version:
$Revision: 1.3 $
Author:
FracPete

Field Summary
static boolean INCLUDE_DATE
          whether to include date fields
static java.lang.String NOMINAL_DUMMY
          the dummy used in nominal columns that consist of NULL values only
static boolean USE_DUMMY
          whether to include NULL value nominal columns, i.e.
 
Fields inherited from interface proper.core.ProperInterface
VERSION
 
Constructor Summary
Reader(Connector conn)
          initializes the object
Reader(Connector conn, java.lang.String table, java.lang.String field)
          initializes the object
 
Method Summary
 boolean getClassified()
          returns whether classified or unclassified (= NULL) instances are returned
 java.lang.String getField()
          returns the field used as class
 java.lang.String getFieldList()
          returns the list of fields to retrieve (comma separated list)
 weka.core.Instances getInstances()
          returns the previously read instances
 java.lang.String getNominalList()
          returns the list of fields to treat additionally as nominals (comma separated list)
 java.lang.String getNoNullsList()
          returns the list of fields where no NULL values are allowed
 java.lang.String getOrderBy()
          returns the field used for ordering
 double getPercentage()
          returns the currently set percentage to retrieve from the table.
 java.lang.String getRelationName()
          returns the name of the relation
 boolean getSort()
          returns whether the attributes are sorted or not
 java.lang.String getTable()
          returns the name of the table to read from
 void read()
          reads the data from the table and creates the instances from it
 void setClassified(boolean classified)
          sets whether classified or unclassified (= NULL) instances are returned
 void setExcludes(java.lang.String excludes)
          sets the fields (String) to exclude from export
 void setExcludes(java.util.Vector excludes)
          sets the fields (String) to exclude from export
 void setField(java.lang.String field)
          sets the field to use as class
 void setFieldList(java.lang.String fields)
          sets the list (comma separated) of fields to retrieve in this order from the table
 void setNominalList(java.lang.String fields)
          sets the list (comma separated) of fields to treat additionally as nominals the table
 void setNoNullsList(java.lang.String fields)
          sets the list (comma separated) of fields where no NULL values are allowed
 void setOrderBy(java.lang.String orderBy)
          sets the fields to order by (only ASC!)
 void setPercentage(double percentage)
          sets the percentage of instances we want to retrieve from the table.
 void setRelationName(java.lang.String relation)
          sets the name of the relation
 void setSort(boolean sort)
          sets whether to sort the attributes or not
 void setTable(java.lang.String table)
          sets the name of the table to use
 
Methods inherited from class proper.database.ExecutorObject
getExecutor, getLastException, getLastStatement
 
Methods inherited from class proper.database.ConnectorObject
getConnector
 
Methods inherited from class proper.core.ProperObject
addListener, addOutput, classInVerbose, debugprint, debugprint, debugprint, debugprint, debugprintln, debugprintln, debugprintln, debugprintln, debugprintln, getListeners, getRuntime, getVerbose, getVerboseLevel, getVerboseLevelForClass, getVerboseString, getVerboseStringForClass, notifyListener, notifyListeners, print, print, print, print, println, println, println, println, println, printMemory, removeListener, setOutput, setVerbose, setVerboseLevel, setVerboseString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INCLUDE_DATE

public static final boolean INCLUDE_DATE
whether to include date fields

See Also:
Constant Field Values

USE_DUMMY

public static final boolean USE_DUMMY
whether to include NULL value nominal columns, i.e. adding the dummy

See Also:
Constant Field Values

NOMINAL_DUMMY

public static final java.lang.String NOMINAL_DUMMY
the dummy used in nominal columns that consist of NULL values only

See Also:
Constant Field Values
Constructor Detail

Reader

public Reader(Connector conn)
initializes the object

Parameters:
conn - the Connector used for Database-Handling

Reader

public Reader(Connector conn,
              java.lang.String table,
              java.lang.String field)
initializes the object

Parameters:
conn - the Connector used for Database-Handling
table - the table to use for reading
field - the field that contains the class
Method Detail

setRelationName

public void setRelationName(java.lang.String relation)
sets the name of the relation


getRelationName

public java.lang.String getRelationName()
returns the name of the relation


setTable

public void setTable(java.lang.String table)
sets the name of the table to use


getTable

public java.lang.String getTable()
returns the name of the table to read from


setField

public void setField(java.lang.String field)
sets the field to use as class


getField

public java.lang.String getField()
returns the field used as class


setOrderBy

public void setOrderBy(java.lang.String orderBy)
sets the fields to order by (only ASC!)


getOrderBy

public java.lang.String getOrderBy()
returns the field used for ordering


setSort

public void setSort(boolean sort)
sets whether to sort the attributes or not


getSort

public boolean getSort()
returns whether the attributes are sorted or not


setClassified

public void setClassified(boolean classified)
sets whether classified or unclassified (= NULL) instances are returned


getClassified

public boolean getClassified()
returns whether classified or unclassified (= NULL) instances are returned


setFieldList

public void setFieldList(java.lang.String fields)
sets the list (comma separated) of fields to retrieve in this order from the table


getFieldList

public java.lang.String getFieldList()
returns the list of fields to retrieve (comma separated list)


setNominalList

public void setNominalList(java.lang.String fields)
sets the list (comma separated) of fields to treat additionally as nominals the table


getNominalList

public java.lang.String getNominalList()
returns the list of fields to treat additionally as nominals (comma separated list)


setNoNullsList

public void setNoNullsList(java.lang.String fields)
sets the list (comma separated) of fields where no NULL values are allowed


getNoNullsList

public java.lang.String getNoNullsList()
returns the list of fields where no NULL values are allowed


setPercentage

public void setPercentage(double percentage)
sets the percentage of instances we want to retrieve from the table. for each class the same percentage is retrieved (= stratified). 0 or 100 percent means just to retrieve all instances.


getPercentage

public double getPercentage()
returns the currently set percentage to retrieve from the table. 0 or 100 percent means just to retrieve all instances.


getInstances

public weka.core.Instances getInstances()
returns the previously read instances


setExcludes

public void setExcludes(java.util.Vector excludes)
sets the fields (String) to exclude from export


setExcludes

public void setExcludes(java.lang.String excludes)
sets the fields (String) to exclude from export


read

public void read()
reads the data from the table and creates the instances from it