public abstract class SQLStatements extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SQLStatements.SID
Enum that contains IDS for all possible statements (statement
identifiers, SID)
|
Constructor and Description |
---|
SQLStatements(Connection connection)
Initializes the JDBCSQLStatments class.
|
Modifier and Type | Method and Description |
---|---|
void |
finalizeStatements()
Closes the created prepared statements.
|
abstract String[] |
getSchemaSQLForTable(String table)
Returns a number of SQL statments that create the schema for the given
table.
|
abstract String |
getSQLDropTableIfExists(String table)
Returns the an SQL string that can be used to drop a table with the given
name.
|
PreparedStatement |
getStatement(SQLStatements.SID statementID)
Returns a prepared statement for the given SID.
|
PreparedStatement |
getStatementDeleteAssociation(int oid,
int src,
int tar)
Returns the statement "deleteAssociation".
|
PreparedStatement |
getStatementDeleteAssociationsForOntology(int oid)
Returns the statement "deleteAssociationsForOntology".
|
PreparedStatement |
getStatementDeleteDictionaryEntriesForOntology(int oid)
Returns the statement "deleteDictionaryEntriesForOntology".
|
PreparedStatement |
getStatementDeleteDictionaryEntry(int oid,
int id)
Returns the statement "deleteDictionaryEntry".
|
PreparedStatement |
getStatementDeleteNodeAssociations(int oid,
int id)
Returns the statement "deleteNodeAssociations".
|
PreparedStatement |
getStatementDeleteNodeID(int oid,
int id)
Returns the statement "deleteNodeID".
|
PreparedStatement |
getStatementDeleteNodeNames(int oid,
int id)
Returns the statement "deleteNodeNames".
|
PreparedStatement |
getStatementDeleteNodeNamesForOntology(int oid)
Returns the statement "deleteNodeNamesForOntology".
|
PreparedStatement |
getStatementDeleteNodesForOntology(int oid)
Returns the statement "deleteNodesForOntology".
|
PreparedStatement |
getStatementDeleteOntology(int oid)
Returns the statement "deleteNodesForOntology".
|
PreparedStatement |
getStatementDeleteTableIfExists(String table)
Returns the statement "deleteTableIfExists".
|
PreparedStatement |
getStatementGetInboundAssociations(int oid,
int tar,
int type)
Returns the statement "getInboundAssociations".
|
PreparedStatement |
getStatementGetIsRootNode(int oid,
int id)
Returns the statement "getIsRootNode".
|
PreparedStatement |
getStatementGetNodeExists(int oid,
int id)
Returns the statement "getNodeExists".
|
PreparedStatement |
getStatementGetNodeNames(int oid,
int id)
Returns the statement "getNodeNames".
|
PreparedStatement |
getStatementGetOntologies()
Returns the statement "getOntologies".
|
PreparedStatement |
getStatementGetOntologyByID(int oid)
Returns the statement "getOntologyByID".
|
PreparedStatement |
getStatementGetOntologyByName(String name)
Returns the statment "getOntologyByName".
|
PreparedStatement |
getStatementGetOntologyDate(int oid)
Returns the statement "getOntologyDate".
|
PreparedStatement |
getStatementGetOutboundAssociations(int oid,
int src,
int type)
Returns the statement "getOutboundAssociations".
|
PreparedStatement |
getStatementGetRootNodes(int oid)
Returns the statement "getRootNodes".
|
PreparedStatement |
getStatementGetUndirectedAssociations(int oid,
int id,
int type)
Returns the statement "getUndirectedAssociations".
|
PreparedStatement |
getStatementInsertAssociation(int oid,
int src,
int tar,
int type)
Returns the statement "insertAssociation".
|
PreparedStatement |
getStatementInsertDictionaryEntry(int oid,
int id,
String entry)
Returns the statement "insertDictionaryEntry".
|
PreparedStatement |
getStatementInsertNodeID(int oid,
int id,
boolean root)
Returns the statement "insertNodeID".
|
PreparedStatement |
getStatementInsertNodeName(int oid,
int id,
String name,
String type,
int mode,
boolean primary)
Returns the statement "insertNodeName".
|
PreparedStatement |
getStatementInsertOntology(String name)
Returns the statement "insertOntology".
|
PreparedStatement |
getStatementQueryDictionary(String entry)
Returns the statement "queryDictionary".
|
PreparedStatement |
getStatementSetOntologyDate(int oid,
Timestamp date)
Returns the statement "getOntologyDate".
|
abstract String |
getStatementSQL(SQLStatements.SID statementID)
Returns the SQL for the corresponding statement id.
|
abstract String[] |
getTables()
Returns an array containg the names of each table entry.
|
public SQLStatements(Connection connection)
connection
- is the database connection for which the statments
should be generated.public abstract String[] getTables()
public abstract String getSQLDropTableIfExists(String table)
table
- is the table that should be droped.public abstract String[] getSchemaSQLForTable(String table)
table
- is the name of the table for which the schema SQL should be
returned.public abstract String getStatementSQL(SQLStatements.SID statementID)
statementID
- is the statement identifier.public PreparedStatement getStatement(SQLStatements.SID statementID)
statementID
- is the statement identifier.public void finalizeStatements()
public PreparedStatement getStatementGetOntologies() throws SQLException
SQLException
public PreparedStatement getStatementGetOntologyByName(String name) throws SQLException
name
- is the name that is queried for.SQLException
public PreparedStatement getStatementGetOntologyByID(int oid) throws SQLException
oid
- is the ontology id.SQLException
public PreparedStatement getStatementInsertOntology(String name) throws SQLException
name
- is the name of the new ontology.SQLException
public PreparedStatement getStatementGetOntologyDate(int oid) throws SQLException
oid
- is the id of the ontology.SQLException
public PreparedStatement getStatementSetOntologyDate(int oid, Timestamp date) throws SQLException
oid
- is the id of the ontology.date
- is the date the ontology date should be set to.SQLException
public PreparedStatement getStatementDeleteOntology(int oid) throws SQLException
oid
- is the id of the ontology.SQLException
public PreparedStatement getStatementDeleteNodesForOntology(int oid) throws SQLException
oid
- is the id of the ontology.SQLException
public PreparedStatement getStatementDeleteNodeNamesForOntology(int oid) throws SQLException
oid
- is the id of the ontology.SQLException
public PreparedStatement getStatementDeleteAssociationsForOntology(int oid) throws SQLException
oid
- is the id of the ontology.SQLException
public PreparedStatement getStatementDeleteDictionaryEntriesForOntology(int oid) throws SQLException
oid
- is the id of the ontology.SQLException
public PreparedStatement getStatementGetRootNodes(int oid) throws SQLException
oid
- is the id of the ontology.SQLException
public PreparedStatement getStatementGetIsRootNode(int oid, int id) throws SQLException
oid
- is the id of the ontology.id
- is the id of the node.SQLException
public PreparedStatement getStatementGetNodeNames(int oid, int id) throws SQLException
oid
- is the id of the ontology.id
- is the id of the node.SQLException
public PreparedStatement getStatementGetNodeExists(int oid, int id) throws SQLException
oid
- is the id of the ontology.id
- is the id of the node.SQLException
public PreparedStatement getStatementInsertNodeID(int oid, int id, boolean root) throws SQLException
oid
- is the id of the ontology.id
- is the id of the node.root
- specifies whether the node is a root node or not.SQLException
public PreparedStatement getStatementDeleteNodeID(int oid, int id) throws SQLException
oid
- is the id of the ontology.id
- is the id of the node.SQLException
public PreparedStatement getStatementInsertNodeName(int oid, int id, String name, String type, int mode, boolean primary) throws SQLException
oid
- is the id of the ontology.id
- is the id of the node.name
- is the name of the node.type
- is the type of the node.mode
- is the comparison mode.SQLException
public PreparedStatement getStatementDeleteNodeNames(int oid, int id) throws SQLException
oid
- is the id of the ontology.id
- is the id of the node.SQLException
public PreparedStatement getStatementGetInboundAssociations(int oid, int tar, int type) throws SQLException
oid
- is the id of the ontology.tar
- is the id of the target node.type
- is the association type.SQLException
public PreparedStatement getStatementGetOutboundAssociations(int oid, int src, int type) throws SQLException
oid
- is the id of the ontology.src
- is the id of the source node.type
- is the association type.SQLException
public PreparedStatement getStatementGetUndirectedAssociations(int oid, int id, int type) throws SQLException
oid
- is the id of the ontology.id
- is the id of the node.type
- is the association type.SQLException
public PreparedStatement getStatementInsertAssociation(int oid, int src, int tar, int type) throws SQLException
oid
- is the id of the ontology.src
- is the id of the source node.tar
- is the id of the target node.type
- is the association type.SQLException
public PreparedStatement getStatementDeleteAssociation(int oid, int src, int tar) throws SQLException
oid
- is the id of the ontology.src
- is the id of the source node.tar
- is the id of the target node.SQLException
public PreparedStatement getStatementDeleteNodeAssociations(int oid, int id) throws SQLException
oid
- is the id of the ontology.id
- is the id of the node.SQLException
public PreparedStatement getStatementQueryDictionary(String entry) throws SQLException
entry
- is the dictionary entry that is queried.SQLException
public PreparedStatement getStatementInsertDictionaryEntry(int oid, int id, String entry) throws SQLException
oid
- is the id of the ontology.id
- is the id of the node.entry
- is the dictionary entry that should be inserted.SQLException
public PreparedStatement getStatementDeleteDictionaryEntry(int oid, int id) throws SQLException
oid
- is the id of the ontology.id
- is the id of the node.SQLException
public PreparedStatement getStatementDeleteTableIfExists(String table) throws SQLException
table
- is the name of the table that should be deleted.SQLException
Copyright (C) 2013, 2014 Raphael Dickfelder, Jan Göpfert, Benjamin Paassen, Andreas Stöckel, licensed under the AGPL v. 3: http://openresearch.cit-ec.de/projects/scie