|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.ksu.cis.kdd.data.Database
Field Summary | |
static java.lang.String |
ARFF_FORMAT
|
protected java.util.List |
attributes
|
static java.lang.String |
CSF_FORMAT
|
static java.lang.String |
DAT_FORMAT
|
protected java.sql.Connection |
dbConnection
|
static java.lang.String |
LIBB_FORMAT
|
static int |
maxArity
|
static int |
maxSQLStringLength
|
protected java.lang.String |
name
|
protected java.util.List |
relevantAttributes
|
protected java.sql.Statement |
remoteStatement
|
protected java.util.List |
sortedTableListCache
|
protected java.util.Hashtable |
tableCache
|
protected Tally |
tally
|
static java.lang.String |
XML_FORMAT
|
Constructor Summary | |
Database()
|
|
Database(java.sql.Connection c)
|
Method Summary | |
void |
addTable(Table tbl)
Add a table |
protected static void |
assignDefaultType(Attribute attr,
int sqlType)
A utility function to assign an attribute type based on its SQL type |
void |
disconnect()
|
void |
exportToServer(java.sql.Connection conn)
Export the local data into server. |
java.util.List |
getAttributes()
|
java.sql.Connection |
getConnection()
|
java.lang.String |
getName()
Returns the name. |
java.util.List |
getRelevantAttributes()
|
java.sql.Statement |
getRemoteStatement()
|
java.util.List |
getSortedTables()
Get all tables in reverse sorted dependency order. |
Table |
getTable(java.lang.String name)
Get a table based on its name |
java.util.List |
getTableNames()
Get all table names |
java.util.List |
getTables()
Get all tables. |
Tally |
getTallyer()
|
java.util.List |
getTuples()
This is the outer join function |
double[] |
getWeights()
|
void |
importDatabaseToLocal()
|
static Database |
importRemoteSchema(java.sql.Connection conn)
Connect to remote database. |
static Database |
importRemoteSchema(java.sql.Connection conn,
java.util.List tableNames)
Connect to remote database. |
static boolean |
isKnownFormat(java.lang.String formatExt)
|
boolean |
isRemote()
|
protected java.util.List |
join(java.util.List t1,
java.util.List t2)
|
protected java.util.List |
joinAll()
|
static Database |
load(java.lang.String filename)
|
static Database |
load(java.lang.String filename,
java.lang.String format)
|
static void |
main(java.lang.String[] args)
|
Table |
pickOneTable()
Get the first table in the database |
void |
removeTable(java.lang.String name)
Remove a table based on its name |
void |
save(java.io.OutputStream out,
java.lang.String format)
|
void |
save(java.lang.String filename)
|
void |
save(java.lang.String filename,
java.lang.String format)
saves in different format |
void |
setName(java.lang.String name)
Sets the name. |
void |
setWeights(double[] weights)
|
Data |
subsample(int n)
|
Data |
subsample(int n,
long seed)
|
int |
tableCount()
|
protected void |
topologicalSort(java.lang.String curNode,
TableSet table,
java.util.LinkedList sortedList,
java.util.HashSet seenBefore)
Do topological sort on tables. |
protected java.util.List |
topologicalSort(TableSet table,
Table[] tables)
Do topological sort on tables. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.util.Hashtable tableCache
protected java.lang.String name
public static final java.lang.String CSF_FORMAT
public static final java.lang.String ARFF_FORMAT
public static final java.lang.String XML_FORMAT
public static final java.lang.String LIBB_FORMAT
public static final java.lang.String DAT_FORMAT
public static int maxSQLStringLength
public static int maxArity
protected java.sql.Connection dbConnection
protected java.sql.Statement remoteStatement
protected Tally tally
protected java.util.List sortedTableListCache
protected java.util.List attributes
protected java.util.List relevantAttributes
Constructor Detail |
public Database()
public Database(java.sql.Connection c)
Method Detail |
public static boolean isKnownFormat(java.lang.String formatExt)
public Data subsample(int n, long seed)
subsample
in interface Data
Data.subsample(int, long)
public Data subsample(int n)
subsample
in interface Data
Data.subsample(int)
public double[] getWeights()
getWeights
in interface Data
Data.getWeights()
public void setWeights(double[] weights)
setWeights
in interface Data
Data.setWeights(double[])
public int tableCount()
public void addTable(Table tbl)
tbl
- public java.util.List getAttributes()
getAttributes
in interface Data
public java.util.List getRelevantAttributes()
getRelevantAttributes
in interface Data
public java.util.List getTuples()
getTuples
in interface Data
protected java.util.List joinAll()
protected java.util.List join(java.util.List t1, java.util.List t2)
public Tally getTallyer()
getTallyer
in interface Data
public java.util.List getSortedTables()
This big chunk of code is for preprocessing the database. The process is roughly as follows:
Note to self: Do NOT call this method in the constructor as it would slow down the createSubTally.
protected java.util.List topologicalSort(TableSet table, Table[] tables)
protected void topologicalSort(java.lang.String curNode, TableSet table, java.util.LinkedList sortedList, java.util.HashSet seenBefore)
public java.util.List getTables()
public java.util.List getTableNames()
public Table pickOneTable()
public Table getTable(java.lang.String name)
name
-
public void removeTable(java.lang.String name)
name
- public java.lang.String getName()
getName
in interface Data
public void setName(java.lang.String name)
name
- The name to setpublic static Database load(java.lang.String filename, java.lang.String format)
public static Database load(java.lang.String filename)
public static Database importRemoteSchema(java.sql.Connection conn)
protected static void assignDefaultType(Attribute attr, int sqlType)
attr
- public static Database importRemoteSchema(java.sql.Connection conn, java.util.List tableNames)
public void exportToServer(java.sql.Connection conn)
Export the local data into server. The connection conn must be valid AND make sure you closed all created statements on conn because this routine will create one. This is because a lot of JDBC drivers only support ONE statement creation per connection.
conn
- public void importDatabaseToLocal()
public java.sql.Connection getConnection()
public java.sql.Statement getRemoteStatement()
public boolean isRemote()
public void disconnect()
public void save(java.lang.String filename)
public void save(java.lang.String filename, java.lang.String format)
filename
- name of the output filepublic void save(java.io.OutputStream out, java.lang.String format)
public java.lang.String toString()
public static void main(java.lang.String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |