com.tietoenator.trip.jxp.graph

## Class TdbGraph

- java.lang.Object
- - com.tietoenator.trip.jxp.session.TdbSessionObject
  - - com.tietoenator.trip.jxp.TdbMessageProvider
    - - com.tietoenator.trip.jxp.graph.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 Summary

    Constructors
    Constructor and Description
    `TdbGraph(TdbSession session, java.lang.String databaseOrCluster)` Opens a graph database or cluster of graph databases.
    `TdbGraph(TdbSession session, TdbDatabaseDesign graphdb)` Opens a graph database.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close this TdbGraph object and release all resources associated with it, including search sets generated through its use.
    `TdbGraphRecord` | `createEdge(java.lang.String name, int sourceRecordId, int targetRecordId, boolean commit)` Create an edge in the graph database currently associated with this TdbGraph instance.
    `TdbGraphRecord` | `createEdge(java.lang.String name, java.lang.String sourceDatabase, int sourceRecordId, java.lang.String targetDatabase, int targetRecordId, boolean commit)` Create an edge in the graph database currently associated with this TdbGraph instance.
    `TdbGraphRecord` | `createEdge(java.lang.String name, TdbRecord source, TdbRecord target, boolean commit)` Create an edge in the graph database currently associated with this TdbGraph instance.
    `TdbGraphRecord` | `createVertex(java.lang.String label, java.lang.String databaseName, int recordId, java.lang.String recordName, boolean commit)` Create a vertex record in the graph database currently associated with this TdbGraph instance.
    `TdbGraphRecord` | `createVertex(java.lang.String label, TdbRecord reference, boolean commit)` Create a vertex record in the graph database currently associated with this TdbGraph instance.
    `java.lang.String` | `getGraphDatabaseName()` Returns the name of the graph database or cluster associated with this TdbGraph instance.
    `TdbGraphSet` | `getGraphSet()` Returns the graph set associated with the entire graph database or cluster associated with this TdbGraph instance.
    `boolean` | `getNotificationType(TdbGraphNotificationType type)` Returns true if the notification detail type is enabled and false if it is disabled.
    `void` | `setNotificationType(TdbGraphNotificationType type, boolean enable)` Enable or disable graph analysis notification detail type.

    - ### Methods inherited from class com.tietoenator.trip.jxp.TdbMessageProvider

      `codeList, getLastCode, getLastMessage, hasMessages, messageList, resetMessages`

    - ### Methods inherited from class com.tietoenator.trip.jxp.session.TdbSessionObject

      `cancel, getSession, isCancelable, setCancelable`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TdbGraph

          public TdbGraph(TdbSession session,
                          java.lang.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 Detail

    - #### 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 java.lang.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(java.lang.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(java.lang.String name,
                                           java.lang.String sourceDatabase,
                                           int sourceRecordId,
                                           java.lang.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(java.lang.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(java.lang.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(java.lang.String label,
                                             java.lang.String databaseName,
                                             int recordId,
                                             java.lang.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`