[WHERE}
(default: SELECT * FROM Results0).
-P comma separted list of columns that are a unqiue key
Only needed for incremental loading, if it cannot be detected automatically
-I
Sets incremental loading
WARNING:This class was taken from the weka_src.jar and modified in order to put some logs and to make possible the connection to the DB through SpagoBI
- Version:
- $Revision: 1.3 $
- Author:
- Stefan Mutter (mutter@cs.waikato.ac.nz)
- See Also:
Loader
,
Serialized Form
Field Summary |
static int |
BOOL
|
static int |
BYTE
|
static int |
DATE
|
static int |
DOUBLE
|
static int |
FLOAT
|
static int |
INTEGER
|
static int |
LONG
|
protected weka.core.Instances |
m_structure
The header information that is retrieved in the beginning of incremental loading |
protected static java.util.Properties |
PROPERTIES
Properties associated with the database connection |
protected static java.lang.String |
PROPERTY_FILE
The property file for the database connection |
static int |
SHORT
|
static int |
STRING
|
Fields inherited from class weka.core.converters.AbstractLoader |
BATCH, INCREMENTAL, m_retrieval, NONE |
Method Summary |
void |
connectToDatabase()
Opens a connection to the database. |
weka.core.Instances |
getDataSet()
Return the full data set in batch mode (header and all intances at once). |
java.lang.String |
getKeys()
Gets the key columns' name. |
weka.core.Instance |
getNextInstance(weka.core.Instances structure)
Read the data set incrementally---get the next instance in the data
set or returns null if there are no
more instances to get. |
java.lang.String[] |
getOptions()
Gets the setting. |
java.lang.String |
getPassword()
Returns the database password |
java.lang.String |
getQuery()
Gets the query to execute against the database. |
java.lang.String |
getRevision()
Returns the revision string. |
weka.core.Instances |
getStructure()
Determines and returns (if possible) the structure (internally the
header) of the data set as an empty set of instances. |
java.lang.String |
getUrl()
Gets the URL. |
java.lang.String |
getUser()
Gets the user name. |
java.lang.String |
globalInfo()
Returns a string describing this Loader. |
java.lang.String |
keysTipText()
the tip text for this property. |
java.util.Enumeration |
listOptions()
Lists the available options. |
static void |
main(java.lang.String[] options)
Main method. |
java.lang.String |
passwordTipText()
the tip text for this property. |
java.lang.String |
queryTipText()
the tip text for this property. |
void |
reset()
Resets the Loader ready to read a new data set. |
void |
resetStructure()
Resets the structure of instances. |
void |
setKeys(java.lang.String keys)
Sets the key columns of a database table. |
void |
setOptions(java.lang.String[] options)
Sets the options. |
void |
setPassword(java.lang.String password)
Sets user password for the database. |
void |
setQuery(java.lang.String q)
Sets the query to execute against the database. |
void |
setSource()
Sets the database url using the DatabaseUtils file. |
void |
setSource(java.sql.Connection connection)
Sets the database url using the given connection. |
void |
setSource(java.lang.String url)
Sets the database url. |
void |
setSource(java.lang.String url,
java.lang.String userName,
java.lang.String password)
Sets the database url. |
void |
setUrl(java.lang.String url)
Sets the database URL. |
void |
setUser(java.lang.String user)
Sets the database user. |
java.lang.String |
urlTipText()
the tip text for this property. |
java.lang.String |
userTipText()
the tip text for this property. |
Methods inherited from class weka.core.converters.AbstractLoader |
getRetrieval, setRetrieval, setSource, setSource |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_structure
protected weka.core.Instances m_structure
- The header information that is retrieved in the beginning of incremental loading
STRING
public static final int STRING
- See Also:
- Constant Field Values
BOOL
public static final int BOOL
- See Also:
- Constant Field Values
DOUBLE
public static final int DOUBLE
- See Also:
- Constant Field Values
BYTE
public static final int BYTE
- See Also:
- Constant Field Values
SHORT
public static final int SHORT
- See Also:
- Constant Field Values
INTEGER
public static final int INTEGER
- See Also:
- Constant Field Values
LONG
public static final int LONG
- See Also:
- Constant Field Values
FLOAT
public static final int FLOAT
- See Also:
- Constant Field Values
DATE
public static final int DATE
- See Also:
- Constant Field Values
PROPERTY_FILE
protected static java.lang.String PROPERTY_FILE
- The property file for the database connection
PROPERTIES
protected static java.util.Properties PROPERTIES
- Properties associated with the database connection
DatabaseLoader
public DatabaseLoader()
throws java.lang.Exception
- Constructor.
- Throws:
java.lang.Exception
- the exception
globalInfo
public java.lang.String globalInfo()
- Returns a string describing this Loader.
- Returns:
- a description of the Loader suitable for
displaying in the explorer/experimenter gui
getRevision
public java.lang.String getRevision()
- Returns the revision string.
- Specified by:
getRevision
in interface weka.core.RevisionHandler
- Returns:
- the revision
reset
public void reset()
throws java.lang.Exception
- Resets the Loader ready to read a new data set.
- Specified by:
reset
in interface weka.core.converters.Loader
- Overrides:
reset
in class weka.core.converters.AbstractLoader
- Throws:
java.lang.Exception
- if an error occurs while disconnecting from the database
resetStructure
public void resetStructure()
- Resets the structure of instances.
setQuery
public void setQuery(java.lang.String q)
- Sets the query to execute against the database.
- Parameters:
q
- the query to execute
getQuery
public java.lang.String getQuery()
- Gets the query to execute against the database.
- Returns:
- the query
queryTipText
public java.lang.String queryTipText()
- the tip text for this property.
- Returns:
- the tip text
setKeys
public void setKeys(java.lang.String keys)
- Sets the key columns of a database table.
- Parameters:
keys
- a String containing the key columns in a comma separated list.
getKeys
public java.lang.String getKeys()
- Gets the key columns' name.
- Returns:
- name of the key columns'
keysTipText
public java.lang.String keysTipText()
- the tip text for this property.
- Returns:
- the tip text
setUrl
public void setUrl(java.lang.String url)
- Sets the database URL.
- Specified by:
setUrl
in interface weka.core.converters.DatabaseConverter
- Parameters:
url
- the url
getUrl
public java.lang.String getUrl()
- Gets the URL.
- Specified by:
getUrl
in interface weka.core.converters.DatabaseConverter
- Returns:
- the URL
urlTipText
public java.lang.String urlTipText()
- the tip text for this property.
- Returns:
- the tip text
setUser
public void setUser(java.lang.String user)
- Sets the database user.
- Specified by:
setUser
in interface weka.core.converters.DatabaseConverter
- Parameters:
user
- the user
getUser
public java.lang.String getUser()
- Gets the user name.
- Specified by:
getUser
in interface weka.core.converters.DatabaseConverter
- Returns:
- name of database user
userTipText
public java.lang.String userTipText()
- the tip text for this property.
- Returns:
- the tip text
setPassword
public void setPassword(java.lang.String password)
- Sets user password for the database.
- Specified by:
setPassword
in interface weka.core.converters.DatabaseConverter
- Parameters:
password
- the password
passwordTipText
public java.lang.String passwordTipText()
- the tip text for this property.
- Returns:
- the tip text
setSource
public void setSource(java.lang.String url,
java.lang.String userName,
java.lang.String password)
- Sets the database url.
- Parameters:
url
- the database urluserName
- the user namepassword
- the password
setSource
public void setSource(java.sql.Connection connection)
- Sets the database url using the given connection.
- Parameters:
connection
- the connection
setSource
public void setSource(java.lang.String url)
- Sets the database url.
- Parameters:
url
- the database url
setSource
public void setSource()
throws java.lang.Exception
- Sets the database url using the DatabaseUtils file.
- Throws:
java.lang.Exception
- the exception
connectToDatabase
public void connectToDatabase()
- Opens a connection to the database.
getStructure
public weka.core.Instances getStructure()
throws java.io.IOException
- Determines and returns (if possible) the structure (internally the
header) of the data set as an empty set of instances.
- Specified by:
getStructure
in interface weka.core.converters.Loader
- Specified by:
getStructure
in class weka.core.converters.AbstractLoader
- Returns:
- the structure of the data set as an empty set of Instances
- Throws:
java.io.IOException
- Signals that an I/O exception has occurred.
java.io.IOException
- if an error occurs
getDataSet
public weka.core.Instances getDataSet()
throws java.io.IOException
- Return the full data set in batch mode (header and all intances at once).
- Specified by:
getDataSet
in interface weka.core.converters.Loader
- Specified by:
getDataSet
in class weka.core.converters.AbstractLoader
- Returns:
- the structure of the data set as an empty set of Instances
- Throws:
java.io.IOException
- Signals that an I/O exception has occurred.
java.io.IOException
- if there is no source or parsing fails
getNextInstance
public weka.core.Instance getNextInstance(weka.core.Instances structure)
throws java.io.IOException
- Read the data set incrementally---get the next instance in the data
set or returns null if there are no
more instances to get. If the structure hasn't yet been
determined by a call to getStructure then method does so before
returning the next instance in the data set.
- Specified by:
getNextInstance
in interface weka.core.converters.Loader
- Specified by:
getNextInstance
in class weka.core.converters.AbstractLoader
- Parameters:
structure
- the dataset header information, will get updated in
case of string or relational attributes
- Returns:
- the next instance in the data set as an Instance object or null
if there are no more instances to be read
- Throws:
java.io.IOException
- if there is an error during parsing
getOptions
public java.lang.String[] getOptions()
- Gets the setting.
- Specified by:
getOptions
in interface weka.core.OptionHandler
- Returns:
- the current setting
listOptions
public java.util.Enumeration listOptions()
- Lists the available options.
- Specified by:
listOptions
in interface weka.core.OptionHandler
- Returns:
- an enumeration of the available options
setOptions
public void setOptions(java.lang.String[] options)
throws java.lang.Exception
- Sets the options.
Available options are:
-Q the query to specify which tuples to load
The query must have the form:
SELECT *| FROM [WHERE}
(default: SELECT * FROM Results0).
-P comma separted list of columns that are a unqiue key
Only needed for incremental loading, if it cannot be detected automatically
-I
Sets incremental loading
- Specified by:
setOptions
in interface weka.core.OptionHandler
- Parameters:
options
- the options
- Throws:
java.lang.Exception
- if options cannot be set
getPassword
public java.lang.String getPassword()
- Returns the database password
- Returns:
- the database password
main
public static void main(java.lang.String[] options)
- Main method.
- Parameters:
options
- the options