Package com.tietoenator.trip.jxp.graph

# Class TdbGraphSet

java.lang.Object
com.tietoenator.trip.jxp.graph.TdbGraphSet

Direct Known Subclasses:
  `TdbSubGraph`

public abstract class TdbGraphSet extends Object
Represents a graph database, a graph cluster or a subgraph based on a graph query.

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

Since:
  TRIPjxp 3.1

- ## Method Summary

  Modifier and Type
  Method
  Description
  `TdbGraphSet`
  `backtrack(String edge, int sourceSet)`
  Creates a subgraph by following a particular edge type backwards from target vertex in the current graph set to source vertex in the specified source set.
  `TdbGraphPath[]`
  `findPaths(int startSet, String[] edgeNames, int targetSet, int maxDepth, boolean reverse)`
  Locate all paths associated with the current graph set that use vertices in the specified start set as origins.
  `TdbGraphSet`
  `follow(String edge, int targetSet)`
  Creates a subgraph by locating targets for the source vertices in the current graph set such that they are related via a particular edge (a.k.a. relation, link).
  `int`
  `getEdgeCount()`
  Returns the count of edges in this graph set.
  `TdbGraph`
  `getGraph()`
  Returns the TdbGraph instance that this graph set is associated with.
  `TdbGraphRecord`
  `getRecord(int index)`
  Returns a TdbGraphRecord object for a record in the the current graph set.
  `int`
  `getSearchId()`
  Returns the TRIP search set ID for this graph set.
  `TdbGraphSet`
  `merge(TdbGraphSet otherSet)`
  Merge this graph set with another, producing the union of both sets.
  `TdbGraphQueryResult`
  `query(String expression)`
  Execute a query using the TRIP graph query language.
  `TdbSearchSet`
  `resolveSources()`
  Resolve target vertices to a search set of the regular records they represent.
  `TdbSearchSet`
  `resolveTargets()`
  Resolve target vertices to a search set of the regular records they represent.
  `TdbGraphPath`
  `shortestPath(int startSet, String[] edgeNames, int targetSet)`
  Determine the shortest path associated with the current graph set that use vertices in the specified start set as origins.
  `TdbGraphSet`
  `source(int searchSet)`
  Create a subgraph with edges where source vertices can be found in the specified (regular) search set.
  `TdbGraphSet`
  `target(int searchSet)`
  Create a subgraph with edges where target vertices can be found in the specified (regular) search set.
  `TdbGraphSet`
  `transitive(int sourceSet, int targetSet, String[] edgeNames, int maxDepth, boolean reverse, boolean allEdges)`
  Creates a subgraph of the current graph set where the specified source and target records are connected via path.

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

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

- ## Method Details

  - ### getGraph

    public TdbGraph getGraph()
    Returns the TdbGraph instance that this graph set is associated with.

  - ### getSearchId

    public int getSearchId()
    Returns the TRIP search set ID for this graph set.

  - ### getEdgeCount

    public int getEdgeCount()
    Returns the count of edges in this graph set.
    Returns:
      Edge count

  - ### getRecord

    public TdbGraphRecord getRecord(int index) throws TdbException
    Returns a TdbGraphRecord object for a record in the the current graph set.
    Parameters:
      `index` - The zero-based index of the record in the set.
    Returns:
      A TdbGraphRecord instance
    Throws:
      `TdbException`

  - ### source

    public TdbGraphSet source(int searchSet) throws TdbException
    Create a subgraph with edges where source vertices can be found in the specified (regular) search set.
    Parameters:
      `searchSet` - Normal search set to find outgoing edges for.
    Returns:
      A TdbGraphSet instance for the resulting subgraph
    Throws:
      `TdbException`

  - ### target

    public TdbGraphSet target(int searchSet) throws TdbException
    Create a subgraph with edges where target vertices can be found in the specified (regular) search set.
    Parameters:
      `searchSet` - Normal search set to find incoming edges for.
    Returns:
      A TdbGraphSet instance for the resulting subgraph
    Throws:
      `TdbException`

  - ### follow

    public TdbGraphSet follow(String edge, int targetSet) throws TdbException
    Creates a subgraph by locating targets for the source vertices in the current graph set such that they are related via a particular edge (a.k.a. relation, link).
    Parameters:
      `edge` - Name of edge (a.k.a. relation, link) to follow
      `targetSet` - Positive search set number (from regular database)
    Returns:
      A TdbGraphSet instance for the resulting subgraph
    Throws:
      `TdbException`

  - ### backtrack

    public TdbGraphSet backtrack(String edge, int sourceSet) throws TdbException
    Creates a subgraph by following a particular edge type backwards from target vertex in the current graph set to source vertex in the specified source set.
    Parameters:
      `edge` - Name of edge (a.k.a. relation, link) to follow backwards
      `sourceSet` - Positive search set number (from regular database)
    Returns:
      A TdbGraphSet instance for the resulting subgraphs
    Throws:
      `TdbException`

  - ### resolveTargets

    public TdbSearchSet resolveTargets() throws TdbException
    Resolve target vertices to a search set of the regular records they represent.
    Returns:
      A TRIP search set with the records targeted by the edges in the current graph set.
    Throws:
      `TdbException`

  - ### resolveSources

    public TdbSearchSet resolveSources() throws TdbException
    Resolve target vertices to a search set of the regular records they represent.
    Returns:
      A TRIP search set with the records being targets for the edges in the current graph set.
    Throws:
      `TdbException`

  - ### transitive

    public TdbGraphSet transitive(int sourceSet, int targetSet, String[] edgeNames, int maxDepth, boolean reverse, boolean allEdges) throws TdbException
    Creates a subgraph of the current graph set where the specified source and target records are connected via path.
    Parameters:
      `sourceSet` - The positive number for a regular search set that specifies the source vertices (must not be zero).
      `targetSet` - The positive number for a regular search set that specifies the target vertices (or zero to locate all potential targets)
      `edgeNames` - An array of names of the edge types to traverse - pass null or an empty array to traverse all edge types.
      `maxDepth` - The maximum depth to search - pass zero for no depth limit
      `reverse` - Pass true to do transitive search by following edges in reverse direction.
      `allEdges` - Pass true to retrieve all edges explored by the operation, and false to only retrieve the final, outer edges.
    Returns:
      A TdbGraphSet object
    Throws:
      `TdbException`

  - ### query

    public TdbGraphQueryResult query(String expression) throws TdbException
    Execute a query using the TRIP graph query language.
    Parameters:
      `expression` - Query expression in TRIP graph query language syntax.
    Returns:
      An instance of TdbGraphSet if the query results in an edge set, or an instance of TdbSearchSet if the query results in an edge set.
    Throws:
      `TdbException`

  - ### findPaths

    public TdbGraphPath[] findPaths(int startSet, String[] edgeNames, int targetSet, int maxDepth, boolean reverse) throws TdbException
    Locate all paths associated with the current graph set that use vertices in the specified start set as origins. This is a so-called "NP hard" problem, and as such this operation may take a long time to complete for large graphs.
    Parameters:
      `startSet` - Regular search set specifying the vertex record(s) to use as starting point(s) for the paths.
      `edgeNames` - Names of edges to follow or pass null or an empty array to follow all edges.
      `targetSet` - Regular search set specifying the vertex record(s) to use as end point(s) for the paths.
      `maxDepth` - The maximum traversal depth or pass zero for no limit.
      `reverse` - Pass true to explore paths in reverse direction.
    Returns:
      An array of graph paths
    Throws:
      `TdbException`

  - ### shortestPath

    public TdbGraphPath shortestPath(int startSet, String[] edgeNames, int targetSet) throws TdbException
    Determine the shortest path associated with the current graph set that use vertices in the specified start set as origins. This is a so-called "NP hard" problem, and as such this operation may take a long time to complete for large graphs.
    Parameters:
      `startSet` - Regular search set specifying the vertex record(s) to use as starting point for the paths.
      `edgeNames` - Names of edges to follow or pass null or an empty array to follow all edges.
      `targetSet` - Regular search set specifying the vertex record(s) to use as end points for the paths.
    Returns:
      The shortest path found in the graph between the target and the source, or null if no path was found.
    Throws:
      `TdbException`

  - ### merge

    public TdbGraphSet merge(TdbGraphSet otherSet) throws TdbException
    Merge this graph set with another, producing the union of both sets.
    Parameters:
      `otherSet` - Other graph set to merge with.
    Returns:
      Merged graph set
    Throws:
      `TdbException`