Class TdbGraph


public final class TdbGraph extends TdbMessageProvider
The main interface to TRIP graph search and navigation features.

THIS CLASS IS EXPERIMENTAL. USE WITH CAUTION! ITS INTERFACE MAY CHANGE IN FUTURE RELEASES.

Since:
TRIPjxp 3.1
  • Constructor Details

    • TdbGraph

      public TdbGraph(TdbSession session, String databaseOrCluster) throws TdbException
      Opens a graph database or cluster of graph databases.
      Parameters:
      session - Active session object
      databaseOrCluster - Name of graph database or cluster
      Throws:
      TdbException
    • TdbGraph

      public TdbGraph(TdbSession session, TdbDatabaseDesign graphdb) throws TdbException
      Opens a graph database.
      Parameters:
      session - Active session object
      graphdb - Database design object representing a graph database
      Throws:
      TdbException
  • Method Details

    • close

      public void close() throws TdbException
      Close this TdbGraph object and release all resources associated with it, including search sets generated through its use.
      Throws:
      TdbException
    • getGraphSet

      public TdbGraphSet getGraphSet()
      Returns the graph set associated with the entire graph database or cluster associated with this TdbGraph instance.
    • getGraphDatabaseName

      public String getGraphDatabaseName()
      Returns the name of the graph database or cluster associated with this TdbGraph instance.
      Returns:
      Name of graph database or cluster.
    • setNotificationType

      public void setNotificationType(TdbGraphNotificationType type, boolean enable)
      Enable or disable graph analysis notification detail type. Graph analysis notifications are enabled via the TdbSession methods TdbSession.enableNotification and TdbSession.setNotificationSink. In order to receive more than a brief summary when graph analysis notifications are enabled, set the desired notification type to true using this method.
      Parameters:
      type - Notification detail type to enable or disable
      enable - True to enable and false to disable
    • getNotificationType

      public boolean getNotificationType(TdbGraphNotificationType type)
      Returns true if the notification detail type is enabled and false if it is disabled.
      Parameters:
      type - Notification type to check
      Returns:
      True if enabled and false if disabled
    • createEdge

      public TdbGraphRecord createEdge(String name, TdbRecord source, TdbRecord target, boolean commit) throws TdbException
      Create an edge in the graph database currently associated with this TdbGraph instance.

      If a weight and/or other properties are required data for the edge, the 'commit' parameter should be set to false. The record object is then not yet committed. Assign the required data to this object and call commit() for the application code in a normal fashion.

      Parameters:
      name - Name of edge
      source - Source record for this edge
      target - Target record for this edge
      commit - Pass true to commit record and false to return it uncommitted.
      Returns:
      TdbGraphRecord object representing the graph record
      Throws:
      TdbException
    • createEdge

      public TdbGraphRecord createEdge(String name, String sourceDatabase, int sourceRecordId, String targetDatabase, int targetRecordId, boolean commit) throws TdbException
      Create an edge in the graph database currently associated with this TdbGraph instance.

      This method is used to create edges where the vertex records are located in regular, non-graph databases.

      If a weight and/or other properties are required data for the edge, the 'commit' parameter should be set to false. The record object is then not yet committed. Assign the required data to this object and call commit() for the application code in a normal fashion.

      Parameters:
      name - Name of edge
      sourceDatabase - Source record's database name
      sourceRecordId - Source record ID
      targetDatabase - Target record's database name
      targetRecordId - Target record ID
      commit - Pass true to commit record and false to return it uncommitted.
      Returns:
      TdbGraphRecord object representing the graph record
      Throws:
      TdbException
    • createEdge

      public TdbGraphRecord createEdge(String name, int sourceRecordId, int targetRecordId, boolean commit) throws TdbException
      Create an edge in the graph database currently associated with this TdbGraph instance.

      This method is used to create edges where the vertex records are located within the graph database associated with this object.

      If a weight and/or other properties are required data for the edge, the 'commit' parameter should be set to false. The record object is then not yet committed. Assign the required data to this object and call commit() for the application code in a normal fashion.

      Parameters:
      name - Name of edge
      sourceRecordId - Record ID of graph vertex record in this database
      targetRecordId - Record ID of graph vertex record in this database
      commit - Pass true to commit record and false to return it uncommitted.
      Returns:
      TdbGraphRecord object representing the graph record
      Throws:
      TdbException
    • createVertex

      public TdbGraphRecord createVertex(String label, TdbRecord reference, boolean commit) throws TdbException
      Create a vertex record in the graph database currently associated with this TdbGraph instance.

      If other properties are required data for the vertex, the 'commit' parameter should be set to false. The record object is then not yet committed. Assign the required data to this object and call commit() for the application code in a normal fashion.

      Parameters:
      label - Label for the vertex in this graph
      reference - Optional reference to record with additional data for this vertex (pass null if not relevant).
      commit - Pass true to commit record and false to return it uncommitted.
      Returns:
      TdbGraphRecord object representing the graph record
      Throws:
      TdbException
    • createVertex

      public TdbGraphRecord createVertex(String label, String databaseName, int recordId, String recordName, boolean commit) throws TdbException
      Create a vertex record in the graph database currently associated with this TdbGraph instance.

      If other properties are required data for the vertex, the 'commit' parameter should be set to false. The record object is then not yet committed. Assign the required data to this object and call commit() for the application code in a normal fashion.

      If a the vertex is to refer to a record in another database that has additional information on this vertex, all the parameters databaseName, recordId and recordName must be specified. If the database lacks record names, pass null for recordName.

      Parameters:
      label - Label for the vertex in this graph
      databaseName - Name of database in which a record with additional data for this vertex is located (pass null if not relevant)
      recordId - ID of record with additional data for this vertex is located (pass zero if not relevant)
      recordName - Name of record with additional data for this vertex is located (pass null if not relevant)
      commit - Pass true to commit record and false to return it uncommitted.
      Returns:
      TdbGraphRecord object representing the graph record
      Throws:
      TdbException