uk.ac.bbk.dcs.automed.hdmstore
Class HdmStore

java.lang.Object
  extended by uk.ac.bbk.dcs.automed.hdmstore.HdmStore

public class HdmStore
extends java.lang.Object

A HdmStore allows data to be stored and queried in an HDM repository which is implemented in a Postgres databas).

Author:
Dean Williams (dean@dcs.bbk.ac.uk)

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 <> include an edge name (which may be '_' for blank).
 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

BOOLEAN

private static final java.lang.String BOOLEAN
See Also:
Constant Field Values

checkEdgeExistsSQL1

private static final java.lang.String checkEdgeExistsSQL1
See Also:
Constant Field Values

checkEdgeExistsSQL2

private static final java.lang.String checkEdgeExistsSQL2
See Also:
Constant Field Values

checkEdgeExistsSQL3

private static final java.lang.String checkEdgeExistsSQL3
See Also:
Constant Field Values

checkIfExistsAsASpanSQL1

private static final java.lang.String checkIfExistsAsASpanSQL1
See Also:
Constant Field Values

checkIfExistsAsASpanSQL2

private static final java.lang.String checkIfExistsAsASpanSQL2
See Also:
Constant Field Values

checkIfExistsAsASpanSQL3

private static final java.lang.String checkIfExistsAsASpanSQL3
See Also:
Constant Field Values

checkExistsSQL1

private static final java.lang.String checkExistsSQL1
See Also:
Constant Field Values

checkExistsSQL2

private static final java.lang.String checkExistsSQL2
See Also:
Constant Field Values

checkExistsSQL3

private static final java.lang.String checkExistsSQL3
See Also:
Constant Field Values

checkHdmExistsSQL1

private static final java.lang.String checkHdmExistsSQL1
See Also:
Constant Field Values

checkHdmExistsSQL2

private static final java.lang.String checkHdmExistsSQL2
See Also:
Constant Field Values

createTableSQL

private static final java.lang.String[] createTableSQL

defaultSchema

private static final java.lang.String defaultSchema
See Also:
Constant Field Values

deleteNodeSQL1

private static final java.lang.String deleteNodeSQL1
See Also:
Constant Field Values

deleteNodeSQL2

private static final java.lang.String deleteNodeSQL2
See Also:
Constant Field Values

deleteNodeSQL3

private static final java.lang.String deleteNodeSQL3
See Also:
Constant Field Values

deleteEdgeSQL1

private static final java.lang.String deleteEdgeSQL1
See Also:
Constant Field Values

deleteEdgeSQL2

private static final java.lang.String deleteEdgeSQL2
See Also:
Constant Field Values

deleteEdgeSpanSQL1

private static final java.lang.String deleteEdgeSpanSQL1
See Also:
Constant Field Values

deleteEdgeSpanSQL2

private static final java.lang.String deleteEdgeSpanSQL2
See Also:
Constant Field Values

dropSequenceSQL

private static final java.lang.String[] dropSequenceSQL

dropTableSQL

private static final java.lang.String dropTableSQL
See Also:
Constant Field Values

getAccessMethodSQL1

private static final java.lang.String getAccessMethodSQL1
See Also:
Constant Field Values

getAccessMethodSQL2

private static final java.lang.String getAccessMethodSQL2
See Also:
Constant Field Values

getEdgeSpanSQL1

private static final java.lang.String getEdgeSpanSQL1
See Also:
Constant Field Values

getEdgeSpanSQL2

private static final java.lang.String getEdgeSpanSQL2
See Also:
Constant Field Values

getEdgesSQL1

private static final java.lang.String getEdgesSQL1
See Also:
Constant Field Values

getEdgesSQL2

private static final java.lang.String getEdgesSQL2
See Also:
Constant Field Values

getHdmForSchemaSQL1

private static final java.lang.String getHdmForSchemaSQL1
See Also:
Constant Field Values

getMaxNumberSQL1

private static final java.lang.String getMaxNumberSQL1
See Also:
Constant Field Values

getMaxNumberSQL2

private static final java.lang.String getMaxNumberSQL2
See Also:
Constant Field Values

getMaxNumberSQL3

private static final java.lang.String getMaxNumberSQL3
See Also:
Constant Field Values

getNodeByIdSQL1

private static final java.lang.String getNodeByIdSQL1
See Also:
Constant Field Values

getNodeByIdSQL2

private static final java.lang.String getNodeByIdSQL2
See Also:
Constant Field Values

getNodeSpanSQL1

private static final java.lang.String getNodeSpanSQL1
See Also:
Constant Field Values

getNodeSpanSQL2

private static final java.lang.String getNodeSpanSQL2
See Also:
Constant Field Values

getSpansSQL1

private static final java.lang.String getSpansSQL1
See Also:
Constant Field Values

getSpansSQL2

private static final java.lang.String getSpansSQL2
See Also:
Constant Field Values

getSpansSQL3

private static final java.lang.String getSpansSQL3
See Also:
Constant Field Values

hdmStoreTables

private static final java.lang.String[] hdmStoreTables

insertDatatypeSQL1

private static final java.lang.String insertDatatypeSQL1
See Also:
Constant Field Values

insertDatatypeSQL2

private static final java.lang.String insertDatatypeSQL2
See Also:
Constant Field Values

insertDatatypeSQL3

private static final java.lang.String insertDatatypeSQL3
See Also:
Constant Field Values

insertDatatypeSQL4

private static final java.lang.String insertDatatypeSQL4
See Also:
Constant Field Values

insertEdgeSQL1

private static final java.lang.String insertEdgeSQL1
See Also:
Constant Field Values

insertEdgeSQL2

private static final java.lang.String insertEdgeSQL2
See Also:
Constant Field Values

insertEdgeSQL3

private static final java.lang.String insertEdgeSQL3
See Also:
Constant Field Values

insertEdgeSQL4

private static final java.lang.String insertEdgeSQL4
See Also:
Constant Field Values

insertEdgeSQL5

private static final java.lang.String insertEdgeSQL5
See Also:
Constant Field Values

insertEdgeSQL6

private static final java.lang.String insertEdgeSQL6
See Also:
Constant Field Values

insertNodeSQL1

private static final java.lang.String insertNodeSQL1
See Also:
Constant Field Values

insertNodeSQL2

private static final java.lang.String insertNodeSQL2
See Also:
Constant Field Values

insertNodeSQL3

private static final java.lang.String insertNodeSQL3
See Also:
Constant Field Values

insertNodeSQL4

private static final java.lang.String insertNodeSQL4
See Also:
Constant Field Values

insertSpanSQL1

private static final java.lang.String insertSpanSQL1
See Also:
Constant Field Values

insertSpanSQL2

private static final java.lang.String insertSpanSQL2
See Also:
Constant Field Values

insertSpanSQL3

private static final java.lang.String insertSpanSQL3
See Also:
Constant Field Values

insertSpanSQL4

private static final java.lang.String insertSpanSQL4
See Also:
Constant Field Values

insertSpanSQL5

private static final java.lang.String insertSpanSQL5
See Also:
Constant Field Values

insertSpanSQL6

private static final java.lang.String insertSpanSQL6
See Also:
Constant Field Values

insertStoreSQL1

private static final java.lang.String insertStoreSQL1
See Also:
Constant Field Values

insertStoreSQL2

private static final java.lang.String insertStoreSQL2
See Also:
Constant Field Values

insertStoreSQL3

private static final java.lang.String insertStoreSQL3
See Also:
Constant Field Values

insertStoreSQL4

private static final java.lang.String insertStoreSQL4
See Also:
Constant Field Values

INTEGER

private static final java.lang.String INTEGER
See Also:
Constant Field Values

isNameUniqueSQL1

private static final java.lang.String isNameUniqueSQL1
See Also:
Constant Field Values

isNameUniqueSQL2

private static final java.lang.String isNameUniqueSQL2
See Also:
Constant Field Values

queryNodesSQL1

private static final java.lang.String queryNodesSQL1
See Also:
Constant Field Values

queryNodesSQL2

private static final java.lang.String queryNodesSQL2
See Also:
Constant Field Values

STRING

private static final java.lang.String STRING
See Also:
Constant Field Values

updateDatatypeSQL1

private static final java.lang.String updateDatatypeSQL1
See Also:
Constant Field Values

updateDatatypeSQL2

private static final java.lang.String updateDatatypeSQL2
See Also:
Constant Field Values

updateDatatypeSQL3

private static final java.lang.String updateDatatypeSQL3
See Also:
Constant Field Values

updateDatatypeSQL4

private static final java.lang.String updateDatatypeSQL4
See Also:
Constant Field Values

addMissingNodes

private boolean addMissingNodes

nodeSpan

public static final char nodeSpan
See Also:
Constant Field Values

edgeSpan

public static final char edgeSpan
See Also:
Constant Field Values

noSeq

private static final java.lang.String noSeq
See Also:
Constant Field Values

conn

private java.sql.Connection conn

connected

private boolean connected

debug

public Debug debug

edgeNames

private java.util.ArrayList edgeNames

edgeTypes

private java.util.ArrayList edgeTypes

nodeTypes

private java.util.ArrayList nodeTypes

hid

private int hid

schemaName

private java.lang.String schemaName
Constructor Detail

HdmStore

public HdmStore()
Default constructor assumes only error messages should be displayed (not debugs)


HdmStore

public HdmStore(Debug pDebug)
Constructor is passed debug class to send debug & error messages to

Method Detail

addEdge

public boolean addEdge(Edge edge)
Takes an Edge struture and stores this in the database. Returned boolean indicates if successful.


addNode

public boolean addNode(java.lang.String nodeType,
                       java.lang.String nodeValue)
Takes a node type and a value and adds to the database


checkIfExistsAsASpan

private boolean checkIfExistsAsASpan(int id,
                                     char edgeOrNode)
Does the specified edge appear as a span in another edge?


checkTablesAreSetUp

private boolean checkTablesAreSetUp(java.util.ArrayList tablesInDB)
Checks that the tables listed in the ArrayList passed exist in the Postgres database


connect

public boolean connect()
If connecting to the HDM store without a schema being passed assume same data source as for the MDR


connect

public boolean connect(java.lang.String schemaName)
Connect to the database using the access method for the named schema. As no password has been supplied assume its null.


connect

public 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.


createDBtables

public boolean createDBtables()

createDBtables

public boolean createDBtables(java.lang.String schemaName)
Check to see if the repository tables are in place on the HDM store data source. If not, create them.


createHdmStore

public boolean createHdmStore(java.lang.String schemaName,
                              java.lang.String hdmStoreName)
Create a logical HDM store for the given schema. Check schema exists and add default node type of String for all the nodes in the schema.


deleteEdge

public 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. If it does - delete it.


deleteNode

public 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. If it does - delete it.


dropSequence

public 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.


dropTables

private void dropTables(java.util.ArrayList tablesInDB)
Drop all the tables named in the ArrayList passed


edgeExists

public 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.


edgeExists

public boolean edgeExists(java.lang.String edgeType,
                          java.lang.String edgeValues)
Does and edge with this type and value exist in the HDM store?


edgeInstanceExists

public boolean edgeInstanceExists(java.lang.String type,
                                  java.lang.String values)
Check to see if an instance of this edge exists in the HDM store


edgeInstanceId

private int edgeInstanceId(java.lang.String type,
                           java.lang.String values)
Given an edge type (e.g. <> ) and an instance (e.g. [worksIn,Dean,NG26]) return the edge ID that identifies the edge in the HDM store.


edgeName

private java.lang.String edgeName(java.lang.String type)
Edge types such as <> include an edge name (which may be '_' for blank). Given an edge type, return the edge name.


edgeNameIsUnique

public boolean edgeNameIsUnique(java.lang.String edgeName)
Edge names dont have to be unique - the combination of edge name and types is unique i.e. you could have both edges <> and <> (though its probably a bad idea if you have) Given an edge name e.g. 'worksIn' return a boolean to indicate if its unique


edgeTypeExists

public boolean edgeTypeExists(java.lang.String edgeType)
Given an edge type e.g. <> does that edge exist in the schema?


edgeTypeForName

public 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. passed livesAt return <>


getEdgeInstances

public 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.


getNodeInstances

public 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


getSpans

public 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.


hdmStoreExists

public boolean hdmStoreExists(java.lang.String hdmStoreName)
Is there an HDM store with the passed name in the repository?


hid

public int hid(java.lang.String hdmStoreName)
Given an HDM store name return its row id number (or -1 if it does not exist)


listNodes

public void listNodes()
Want to display all the nodes so pass just a wildcard as a the pattern


listNodes

public void listNodes(java.lang.String nodeType)
List the instance nodes of the passed nodeType (or wildcard)


maxIdNumber

private int maxIdNumber(java.lang.String columnName,
                        java.lang.String tableName)
For the specified table / column, what is the maximum id number?


nodeExists

public boolean nodeExists(Span span)
For the node instance specifed in the Span data structure check if it exists in the HDM store


nodeExists

public 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


nodeInstancesExist

private boolean nodeInstancesExist(java.lang.String nodeType)
Check whether any instances of this node type are currently stored in the HDM store


nodeTypeExists

public boolean nodeTypeExists(java.lang.String nodeType)
Check whether any instances of this node type are currently stored in the HDM store


numberOfRowsInResultSet

public int numberOfRowsInResultSet(java.sql.ResultSet rset)
Given a result set - how many rows are in it?


okToAddEdge

public boolean okToAddEdge(Edge edge)
Given an Edge is it OK to add the edge e.g. are all the spans valid type & do the instances exist?


populateDatabaseId

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.


populateEdgeValue

private Span populateEdgeValue(Span span)
This Span represents an edge - get the edge details from the database and update the span.


populateNodeValue

private Span populateNodeValue(Span span)
This Span represents a node - get the node details from the database and update the span.


retrieveNodes

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. If print is true then output the results as they are found.


schemaName

public java.lang.String schemaName(java.lang.String hdmStoreName)
Given an HDM store name return the name of the schema it stores data for


setAddMissingNodes

public 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. Setting add missing nodes will insert any missing nodes that would otherwise cause an add edge to fail.


setDatatype

public 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)


setupStoreTables

private void setupStoreTables(java.util.ArrayList tablesInDB)
Passed a set of tables that exist in the database create any missing ones


tablesInDB

private java.util.ArrayList tablesInDB()
Get a list of tables that exist in the database


use

public boolean use(java.lang.String hdmStoreName)
Use the named HDM store - subsequent calls to this HdmStore will use this store as default