|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.experiment.DatabaseUtils
weka.experiment.InstanceQuery
public class InstanceQuery
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 DatabaseUtils.props in user.home or the current directory. eg:
jdbcDriver=jdbc.idbDriver
jdbcURL=jdbc:idb=experiments.prp
Command line use just outputs the instances to System.out.
Valid options are:-Q <query> SQL query to execute.
-S Return sparse rather than normal instances.
-U <username> The username to use for connecting.
-P <password> The password to use for connecting.
-D Enables debug output.
| Field Summary |
|---|
| Fields inherited from class weka.experiment.DatabaseUtils |
|---|
BOOL, BYTE, DATE, DOUBLE, EXP_INDEX_TABLE, EXP_RESULT_COL, EXP_RESULT_PREFIX, EXP_SETUP_COL, EXP_TYPE_COL, FLOAT, INTEGER, LONG, PROPERTY_FILE, SHORT, STRING, TEXT, TIME |
| Constructor Summary | |
|---|---|
InstanceQuery()
Sets up the database drivers |
|
| Method Summary | |
|---|---|
String |
customPropsFileTipText()
The tip text for this property. |
File |
getCustomPropsFile()
Returns the custom properties file in use, if any. |
String[] |
getOptions()
Gets the current settings of InstanceQuery |
String |
getQuery()
Get the query to execute against the database |
String |
getRevision()
Returns the revision string. |
boolean |
getSparseData()
Gets whether data is to be returned as a set of sparse instances |
Enumeration |
listOptions()
Returns an enumeration describing the available options |
static void |
main(String[] args)
Test the class from the command line. |
String |
queryTipText()
Returns the tip text for this property |
Instances |
retrieveInstances()
Makes a database query using the query set through the -Q option to convert a table into a set of instances |
static Instances |
retrieveInstances(InstanceQueryAdapter adapter,
ResultSet rs)
|
Instances |
retrieveInstances(String query)
Makes a database query to convert a table into a set of instances |
void |
setCustomPropsFile(File value)
Sets the custom properties file to use. |
void |
setOptions(String[] options)
Parses a given list of options. |
void |
setQuery(String q)
Set the query to execute against the database |
void |
setSparseData(boolean s)
Sets whether data should be encoded as sparse instances |
String |
sparseDataTipText()
Returns the tip text for this property |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface weka.experiment.InstanceQueryAdapter |
|---|
attributeCaseFix, getDebug, translateDBColumnType |
| Constructor Detail |
|---|
public InstanceQuery()
throws Exception
Exception - if an error occurs| Method Detail |
|---|
public Enumeration listOptions()
listOptions in interface OptionHandler
public void setOptions(String[] options)
throws Exception
-Q <query> SQL query to execute.
-S Return sparse rather than normal instances.
-U <username> The username to use for connecting.
-P <password> The password to use for connecting.
-D Enables debug output.
setOptions in interface OptionHandleroptions - the list of options as an array of strings
Exception - if an option is not supportedpublic String queryTipText()
public void setQuery(String q)
q - the query to executepublic String getQuery()
public String sparseDataTipText()
public void setSparseData(boolean s)
s - true if data should be encoded as a set of sparse instancespublic boolean getSparseData()
getSparseData in interface InstanceQueryAdapterpublic void setCustomPropsFile(File value)
value - the custom props file to load database parameters from,
use null or directory to disable custom properties.DatabaseUtils.initialize(File)public File getCustomPropsFile()
public String customPropsFileTipText()
public String[] getOptions()
getOptions in interface OptionHandler
public Instances retrieveInstances()
throws Exception
Exception - if an error occurs
public static Instances retrieveInstances(InstanceQueryAdapter adapter,
ResultSet rs)
throws Exception
Exception
public Instances retrieveInstances(String query)
throws Exception
query - the query to convert to instances
Exception - if an error occurspublic static void main(String[] args)
args - contains options for the instance querypublic String getRevision()
getRevision in interface RevisionHandlergetRevision in class DatabaseUtils
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||