|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.bbk.dcs.automed.hdmstore.HdmStore
public class HdmStore
A HdmStore allows data to be stored and queried in an HDM repository which is implemented in a Postgres databas).
Field Summary | |
---|---|
private boolean |
addMissingNodes
|
private static java.lang.String |
BOOLEAN
|
private static java.lang.String |
checkEdgeExistsSQL1
|
private static java.lang.String |
checkEdgeExistsSQL2
|
private static java.lang.String |
checkEdgeExistsSQL3
|
private static java.lang.String |
checkExistsSQL1
|
private static java.lang.String |
checkExistsSQL2
|
private static java.lang.String |
checkExistsSQL3
|
private static java.lang.String |
checkHdmExistsSQL1
|
private static java.lang.String |
checkHdmExistsSQL2
|
private static java.lang.String |
checkIfExistsAsASpanSQL1
|
private static java.lang.String |
checkIfExistsAsASpanSQL2
|
private static java.lang.String |
checkIfExistsAsASpanSQL3
|
private java.sql.Connection |
conn
|
private boolean |
connected
|
private static java.lang.String[] |
createTableSQL
|
Debug |
debug
|
private static java.lang.String |
defaultSchema
|
private static java.lang.String |
deleteEdgeSpanSQL1
|
private static java.lang.String |
deleteEdgeSpanSQL2
|
private static java.lang.String |
deleteEdgeSQL1
|
private static java.lang.String |
deleteEdgeSQL2
|
private static java.lang.String |
deleteNodeSQL1
|
private static java.lang.String |
deleteNodeSQL2
|
private static java.lang.String |
deleteNodeSQL3
|
private static java.lang.String[] |
dropSequenceSQL
|
private static java.lang.String |
dropTableSQL
|
private java.util.ArrayList |
edgeNames
|
static char |
edgeSpan
|
private java.util.ArrayList |
edgeTypes
|
private static java.lang.String |
getAccessMethodSQL1
|
private static java.lang.String |
getAccessMethodSQL2
|
private static java.lang.String |
getEdgeSpanSQL1
|
private static java.lang.String |
getEdgeSpanSQL2
|
private static java.lang.String |
getEdgesSQL1
|
private static java.lang.String |
getEdgesSQL2
|
private static java.lang.String |
getHdmForSchemaSQL1
|
private static java.lang.String |
getMaxNumberSQL1
|
private static java.lang.String |
getMaxNumberSQL2
|
private static java.lang.String |
getMaxNumberSQL3
|
private static java.lang.String |
getNodeByIdSQL1
|
private static java.lang.String |
getNodeByIdSQL2
|
private static java.lang.String |
getNodeSpanSQL1
|
private static java.lang.String |
getNodeSpanSQL2
|
private static java.lang.String |
getSpansSQL1
|
private static java.lang.String |
getSpansSQL2
|
private static java.lang.String |
getSpansSQL3
|
private static java.lang.String[] |
hdmStoreTables
|
private int |
hid
|
private static java.lang.String |
insertDatatypeSQL1
|
private static java.lang.String |
insertDatatypeSQL2
|
private static java.lang.String |
insertDatatypeSQL3
|
private static java.lang.String |
insertDatatypeSQL4
|
private static java.lang.String |
insertEdgeSQL1
|
private static java.lang.String |
insertEdgeSQL2
|
private static java.lang.String |
insertEdgeSQL3
|
private static java.lang.String |
insertEdgeSQL4
|
private static java.lang.String |
insertEdgeSQL5
|
private static java.lang.String |
insertEdgeSQL6
|
private static java.lang.String |
insertNodeSQL1
|
private static java.lang.String |
insertNodeSQL2
|
private static java.lang.String |
insertNodeSQL3
|
private static java.lang.String |
insertNodeSQL4
|
private static java.lang.String |
insertSpanSQL1
|
private static java.lang.String |
insertSpanSQL2
|
private static java.lang.String |
insertSpanSQL3
|
private static java.lang.String |
insertSpanSQL4
|
private static java.lang.String |
insertSpanSQL5
|
private static java.lang.String |
insertSpanSQL6
|
private static java.lang.String |
insertStoreSQL1
|
private static java.lang.String |
insertStoreSQL2
|
private static java.lang.String |
insertStoreSQL3
|
private static java.lang.String |
insertStoreSQL4
|
private static java.lang.String |
INTEGER
|
private static java.lang.String |
isNameUniqueSQL1
|
private static java.lang.String |
isNameUniqueSQL2
|
static char |
nodeSpan
|
private java.util.ArrayList |
nodeTypes
|
private static java.lang.String |
noSeq
|
private static java.lang.String |
queryNodesSQL1
|
private static java.lang.String |
queryNodesSQL2
|
private java.lang.String |
schemaName
|
private static java.lang.String |
STRING
|
private static java.lang.String |
updateDatatypeSQL1
|
private static java.lang.String |
updateDatatypeSQL2
|
private static java.lang.String |
updateDatatypeSQL3
|
private static java.lang.String |
updateDatatypeSQL4
|
Constructor Summary | |
---|---|
HdmStore()
Default constructor assumes only error messages should be displayed (not debugs) |
|
HdmStore(Debug pDebug)
Constructor is passed debug class to send debug & error messages to |
Method Summary | |
---|---|
boolean |
addEdge(Edge edge)
Takes an Edge struture and stores this in the database. |
boolean |
addNode(java.lang.String nodeType,
java.lang.String nodeValue)
Takes a node type and a value and adds to the database |
private boolean |
checkIfExistsAsASpan(int id,
char edgeOrNode)
Does the specified edge appear as a span in another edge? |
private boolean |
checkTablesAreSetUp(java.util.ArrayList tablesInDB)
Checks that the tables listed in the ArrayList passed exist in the Postgres database |
boolean |
connect()
If connecting to the HDM store without a schema being passed assume same data source as for the MDR |
boolean |
connect(java.lang.String schemaName)
Connect to the database using the access method for the named schema. |
boolean |
connect(java.lang.String schemaName,
java.lang.String passWord)
Connect to the database using the access method for the named schema using the access method in the repository for the schema and the password supplied. |
boolean |
createDBtables()
|
boolean |
createDBtables(java.lang.String schemaName)
Check to see if the repository tables are in place on the HDM store data source. |
boolean |
createHdmStore(java.lang.String schemaName,
java.lang.String hdmStoreName)
Create a logical HDM store for the given schema. |
boolean |
deleteEdge(java.lang.String edgeType,
java.lang.String edgeValue)
Check the node type is valid & and instance of the node with this value exists. |
boolean |
deleteNode(java.lang.String nodeType,
java.lang.String nodeValue)
Check the node type is valid & and instance of the node with this value exists. |
void |
dropSequence()
Older versions of Postgres do not automatically drop sequences created for primary keys etc when the table is dropped - this loops through dropping the sequences explicitly. |
private void |
dropTables(java.util.ArrayList tablesInDB)
Drop all the tables named in the ArrayList passed |
boolean |
edgeExists(Span span)
Test to see if an edge exists has been passed a Span structure - split this
out into type and and value and return the result. |
boolean |
edgeExists(java.lang.String edgeType,
java.lang.String edgeValues)
Does and edge with this type and value exist in the HDM store? |
boolean |
edgeInstanceExists(java.lang.String type,
java.lang.String values)
Check to see if an instance of this edge exists in the HDM store |
private int |
edgeInstanceId(java.lang.String type,
java.lang.String values)
Given an edge type (e.g. |
private java.lang.String |
edgeName(java.lang.String type)
Edge types such as < |
boolean |
edgeNameIsUnique(java.lang.String edgeName)
Edge names dont have to be unique - the combination of edge name and types is unique i.e. |
boolean |
edgeTypeExists(java.lang.String edgeType)
Given an edge type e.g. |
java.lang.String |
edgeTypeForName(java.lang.String edgeName)
Assuming edge name is unique (which need to be checked before calling) return its edge type e.g. |
java.util.LinkedList |
getEdgeInstances(java.lang.String edgeType)
Return all the instances of the passed edge type as a LinkedList of Span
elements, each Span representing an instance of an edge. |
java.util.LinkedList |
getNodeInstances(java.lang.String nodeType)
Given a node type return all the instances in the HDM store as a LinkedList
with elements of type Span , each element representing an instance |
java.util.LinkedList |
getSpans(int hid,
int eid)
For the edge specified return a LinkedList with each element of type
Span representing a span in that edge. |
boolean |
hdmStoreExists(java.lang.String hdmStoreName)
Is there an HDM store with the passed name in the repository? |
int |
hid(java.lang.String hdmStoreName)
Given an HDM store name return its row id number (or -1 if it does not exist) |
void |
listNodes()
Want to display all the nodes so pass just a wildcard as a the pattern |
void |
listNodes(java.lang.String nodeType)
List the instance nodes of the passed nodeType (or wildcard) |
private int |
maxIdNumber(java.lang.String columnName,
java.lang.String tableName)
For the specified table / column, what is the maximum id number? |
boolean |
nodeExists(Span span)
For the node instance specifed in the Span data structure check if it exists in the
HDM store |
boolean |
nodeExists(java.lang.String nodeType,
java.lang.String nodeValue)
For the node instance specifed by node type & value, check if it exists in the HDM store |
private boolean |
nodeInstancesExist(java.lang.String nodeType)
Check whether any instances of this node type are currently stored in the HDM store |
boolean |
nodeTypeExists(java.lang.String nodeType)
Check whether any instances of this node type are currently stored in the HDM store |
int |
numberOfRowsInResultSet(java.sql.ResultSet rset)
Given a result set - how many rows are in it? |
boolean |
okToAddEdge(Edge edge)
Given an Edge is it OK to add the edge e.g. |
private Span |
populateDatabaseId(Span span)
Given a Span which represents either a node or an edge, in terms of its type & value
populate the fields in the span structure that identify the rows in the database used to
store this span. |
private Span |
populateEdgeValue(Span span)
This Span represents an edge - get the edge details from the database and
update the span. |
private Span |
populateNodeValue(Span span)
This Span represents a node - get the node details from the database and
update the span. |
private java.util.LinkedList |
retrieveNodes(java.lang.String nodeType,
boolean print)
For the passed node type (may be a wildcard) get the node instances and return them as a LinkedList of EdgeElement . |
java.lang.String |
schemaName(java.lang.String hdmStoreName)
Given an HDM store name return the name of the schema it stores data for |
void |
setAddMissingNodes(boolean pAddMissingNodes)
If you try to add an instance of an edge then all the nodes and edges that are spans of the new edge must already exist in the database. |
boolean |
setDatatype(java.lang.String nodeType,
java.lang.String datatype)
The meta data for an HDM store is contained in the associated AutoMed schema except for the data type of the nodes in the schema which are set with this method (initially they default to String) |
private void |
setupStoreTables(java.util.ArrayList tablesInDB)
Passed a set of tables that exist in the database create any missing ones |
private java.util.ArrayList |
tablesInDB()
Get a list of tables that exist in the database |
boolean |
use(java.lang.String hdmStoreName)
Use the named HDM store - subsequent calls to this HdmStore will use this store as default |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String BOOLEAN
private static final java.lang.String checkEdgeExistsSQL1
private static final java.lang.String checkEdgeExistsSQL2
private static final java.lang.String checkEdgeExistsSQL3
private static final java.lang.String checkIfExistsAsASpanSQL1
private static final java.lang.String checkIfExistsAsASpanSQL2
private static final java.lang.String checkIfExistsAsASpanSQL3
private static final java.lang.String checkExistsSQL1
private static final java.lang.String checkExistsSQL2
private static final java.lang.String checkExistsSQL3
private static final java.lang.String checkHdmExistsSQL1
private static final java.lang.String checkHdmExistsSQL2
private static final java.lang.String[] createTableSQL
private static final java.lang.String defaultSchema
private static final java.lang.String deleteNodeSQL1
private static final java.lang.String deleteNodeSQL2
private static final java.lang.String deleteNodeSQL3
private static final java.lang.String deleteEdgeSQL1
private static final java.lang.String deleteEdgeSQL2
private static final java.lang.String deleteEdgeSpanSQL1
private static final java.lang.String deleteEdgeSpanSQL2
private static final java.lang.String[] dropSequenceSQL
private static final java.lang.String dropTableSQL
private static final java.lang.String getAccessMethodSQL1
private static final java.lang.String getAccessMethodSQL2
private static final java.lang.String getEdgeSpanSQL1
private static final java.lang.String getEdgeSpanSQL2
private static final java.lang.String getEdgesSQL1
private static final java.lang.String getEdgesSQL2
private static final java.lang.String getHdmForSchemaSQL1
private static final java.lang.String getMaxNumberSQL1
private static final java.lang.String getMaxNumberSQL2
private static final java.lang.String getMaxNumberSQL3
private static final java.lang.String getNodeByIdSQL1
private static final java.lang.String getNodeByIdSQL2
private static final java.lang.String getNodeSpanSQL1
private static final java.lang.String getNodeSpanSQL2
private static final java.lang.String getSpansSQL1
private static final java.lang.String getSpansSQL2
private static final java.lang.String getSpansSQL3
private static final java.lang.String[] hdmStoreTables
private static final java.lang.String insertDatatypeSQL1
private static final java.lang.String insertDatatypeSQL2
private static final java.lang.String insertDatatypeSQL3
private static final java.lang.String insertDatatypeSQL4
private static final java.lang.String insertEdgeSQL1
private static final java.lang.String insertEdgeSQL2
private static final java.lang.String insertEdgeSQL3
private static final java.lang.String insertEdgeSQL4
private static final java.lang.String insertEdgeSQL5
private static final java.lang.String insertEdgeSQL6
private static final java.lang.String insertNodeSQL1
private static final java.lang.String insertNodeSQL2
private static final java.lang.String insertNodeSQL3
private static final java.lang.String insertNodeSQL4
private static final java.lang.String insertSpanSQL1
private static final java.lang.String insertSpanSQL2
private static final java.lang.String insertSpanSQL3
private static final java.lang.String insertSpanSQL4
private static final java.lang.String insertSpanSQL5
private static final java.lang.String insertSpanSQL6
private static final java.lang.String insertStoreSQL1
private static final java.lang.String insertStoreSQL2
private static final java.lang.String insertStoreSQL3
private static final java.lang.String insertStoreSQL4
private static final java.lang.String INTEGER
private static final java.lang.String isNameUniqueSQL1
private static final java.lang.String isNameUniqueSQL2
private static final java.lang.String queryNodesSQL1
private static final java.lang.String queryNodesSQL2
private static final java.lang.String STRING
private static final java.lang.String updateDatatypeSQL1
private static final java.lang.String updateDatatypeSQL2
private static final java.lang.String updateDatatypeSQL3
private static final java.lang.String updateDatatypeSQL4
private boolean addMissingNodes
public static final char nodeSpan
public static final char edgeSpan
private static final java.lang.String noSeq
private java.sql.Connection conn
private boolean connected
public Debug debug
private java.util.ArrayList edgeNames
private java.util.ArrayList edgeTypes
private java.util.ArrayList nodeTypes
private int hid
private java.lang.String schemaName
Constructor Detail |
---|
public HdmStore()
public HdmStore(Debug pDebug)
Method Detail |
---|
public boolean addEdge(Edge edge)
Edge
struture and stores this in the database. Returned boolean
indicates if successful.
public boolean addNode(java.lang.String nodeType, java.lang.String nodeValue)
private boolean checkIfExistsAsASpan(int id, char edgeOrNode)
private boolean checkTablesAreSetUp(java.util.ArrayList tablesInDB)
ArrayList
passed exist in the Postgres database
public boolean connect()
public boolean connect(java.lang.String schemaName)
public boolean connect(java.lang.String schemaName, java.lang.String passWord)
public boolean createDBtables()
public boolean createDBtables(java.lang.String schemaName)
public boolean createHdmStore(java.lang.String schemaName, java.lang.String hdmStoreName)
public boolean deleteEdge(java.lang.String edgeType, java.lang.String edgeValue)
public boolean deleteNode(java.lang.String nodeType, java.lang.String nodeValue)
public void dropSequence()
private void dropTables(java.util.ArrayList tablesInDB)
public boolean edgeExists(Span span)
Span
structure - split this
out into type and and value and return the result.
public boolean edgeExists(java.lang.String edgeType, java.lang.String edgeValues)
public boolean edgeInstanceExists(java.lang.String type, java.lang.String values)
private int edgeInstanceId(java.lang.String type, java.lang.String values)
private java.lang.String edgeName(java.lang.String type)
public boolean edgeNameIsUnique(java.lang.String edgeName)
public boolean edgeTypeExists(java.lang.String edgeType)
public java.lang.String edgeTypeForName(java.lang.String edgeName)
public java.util.LinkedList getEdgeInstances(java.lang.String edgeType)
LinkedList
of Span
elements, each Span
representing an instance of an edge.
public java.util.LinkedList getNodeInstances(java.lang.String nodeType)
LinkedList
with elements of type Span
, each element representing an instance
public java.util.LinkedList getSpans(int hid, int eid)
LinkedList
with each element of type
Span
representing a span in that edge.
public boolean hdmStoreExists(java.lang.String hdmStoreName)
public int hid(java.lang.String hdmStoreName)
public void listNodes()
public void listNodes(java.lang.String nodeType)
private int maxIdNumber(java.lang.String columnName, java.lang.String tableName)
public boolean nodeExists(Span span)
Span
data structure check if it exists in the
HDM store
public boolean nodeExists(java.lang.String nodeType, java.lang.String nodeValue)
private boolean nodeInstancesExist(java.lang.String nodeType)
public boolean nodeTypeExists(java.lang.String nodeType)
public int numberOfRowsInResultSet(java.sql.ResultSet rset)
public boolean okToAddEdge(Edge edge)
Edge
is it OK to add the edge e.g. are all the spans valid type & do the
instances exist?
private Span populateDatabaseId(Span span)
Span
which represents either a node or an edge, in terms of its type & value
populate the fields in the span structure that identify the rows in the database used to
store this span.
private Span populateEdgeValue(Span span)
Span
represents an edge - get the edge details from the database and
update the span.
private Span populateNodeValue(Span span)
Span
represents a node - get the node details from the database and
update the span.
private java.util.LinkedList retrieveNodes(java.lang.String nodeType, boolean print)
LinkedList
of EdgeElement
. If print is true then output the results
as they are found.
public java.lang.String schemaName(java.lang.String hdmStoreName)
public void setAddMissingNodes(boolean pAddMissingNodes)
public boolean setDatatype(java.lang.String nodeType, java.lang.String datatype)
private void setupStoreTables(java.util.ArrayList tablesInDB)
private java.util.ArrayList tablesInDB()
public boolean use(java.lang.String hdmStoreName)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |