All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.experiment.InstanceQuery

java.lang.Object
   |
   +----weka.experiment.DatabaseUtils
           |
           +----weka.experiment.InstanceQuery

public class InstanceQuery
extends DatabaseUtils
implements OptionHandler
Convert the results of a database query into instances. The jdbc driver and database to be used default to "jdbc.idbDriver" and "jdbc:idb=experiments.prp". These may be changed by creating a java properties file called .weka.experimentrc in user.home. eg:

 jdbcDriver=jdbc.idbDriver
 jdbcURL=jdbc:idb=experiments.prp
 

Command line use just outputs the instances to System.out.

Author:
Len Trigg (trigg@cs.waikato.ac.nz)

Constructor Index

 o InstanceQuery()
Sets up the database drivers

Method Index

 o getOptions()
Gets the current settings of InstanceQuery
 o getQuery()
Get the query to execute against the database
 o getSparseData()
Gets whether data is to be returned as a set of sparse instances
 o listOptions()
Returns an enumeration describing the available options

 o main(String[])
Test the class from the command line.
 o queryTipText()
Returns the tip text for this property
 o retrieveInstances()
Makes a database query using the query set through the -Q option to convert a table into a set of instances
 o retrieveInstances(String)
Makes a database query to convert a table into a set of instances
 o setOptions(String[])
Parses a given list of options.
 o setQuery(String)
Set the query to execute against the database
 o setSparseData(boolean)
Sets whether data should be encoded as sparse instances
 o sparseDataTipText()
Returns the tip text for this property

Constructors

 o InstanceQuery
 public InstanceQuery() throws Exception
Sets up the database drivers

Throws: Exception
if an error occurs

Methods

 o listOptions
 public Enumeration listOptions()
Returns an enumeration describing the available options

 o setOptions
 public void setOptions(String options[]) throws Exception
Parses a given list of options. Valid options are:

-S
Return a set of sparse instances rather than normal instances.

Parameters:
options - the list of options as an array of strings
Throws: Exception
if an option is not supported
 o queryTipText
 public String queryTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui
 o setQuery
 public void setQuery(String q)
Set the query to execute against the database

Parameters:
q - the query to execute
 o getQuery
 public String getQuery()
Get the query to execute against the database

Returns:
the query
 o sparseDataTipText
 public String sparseDataTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui
 o setSparseData
 public void setSparseData(boolean s)
Sets whether data should be encoded as sparse instances

Parameters:
s - true if data should be encoded as a set of sparse instances
 o getSparseData
 public boolean getSparseData()
Gets whether data is to be returned as a set of sparse instances

Returns:
true if data is to be encoded as sparse instances
 o getOptions
 public String[] getOptions()
Gets the current settings of InstanceQuery

Returns:
an array of strings suitable for passing to setOptions()
 o retrieveInstances
 public Instances retrieveInstances() throws Exception
Makes a database query using the query set through the -Q option to convert a table into a set of instances

Returns:
the instances contained in the result of the query
Throws: Exception
if an error occurs
 o retrieveInstances
 public Instances retrieveInstances(String query) throws Exception
Makes a database query to convert a table into a set of instances

Parameters:
query - the query to convert to instances
Returns:
the instances contained in the result of the query
Throws: Exception
if an error occurs
 o main
 public static void main(String args[])
Test the class from the command line. The instance query should be specified with -Q sql_query

Parameters:
args - contains options for the instance query

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home