java.lang.Object
org.odpi.openmetadata.openconnectors.governancedaemonconnectors.lineagewarehouseconnectors.janusconnector.graph.GraphHelper

public class GraphHelper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Close the connection to the graph
    <U> void
    commit(BiConsumer<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource,U> consumer, U argument, Consumer<Exception> errorHandler)
    Helper method that gets a traversal and executes the code that queries the graph
    <V, U> void
    commit(org.apache.tinkerpop.gremlin.util.function.TriConsumer<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource,V,U> consumer, V argument1, U argument2, Consumer<Exception> errorHandler)
    Helper method that gets a traversal and executes the code that queries the graph
    org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource
    Returns a traversal that is used to query the graph
    <U, V> U
    getResult(BiFunction<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource,V,U> function, V argument, BiConsumer<Exception,V> errorHandler)
    Helper method that gets a traversal and executes the code that queries the graph
    <U> U
    getResult(Function<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource,U> function, Consumer<Exception> errorHandler)
    Helper method that gets a traversal and executes the code that queries the graph
    <U, V, T> U
    getResult(org.apache.tinkerpop.gremlin.util.function.TriFunction<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource,V,T,U> function, V argument1, T argument2, org.apache.tinkerpop.gremlin.util.function.TriConsumer<Exception,V,T> errorHandler)
    Helper method that gets a traversal and executes the code that queries the graph
    boolean
    return whether the graph is supporting transactions
    void
    openGraph(String providerClass, Map<String,Object> configurationProperties, AuditLog auditLog)
    Open the graph with the provided configuration

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GraphHelper

      public GraphHelper()
  • Method Details

    • openGraph

      public void openGraph(String providerClass, Map<String,Object> configurationProperties, AuditLog auditLog) throws JanusConnectorException, LineageWarehouseException
      Open the graph with the provided configuration
      Parameters:
      providerClass - - Provider Class name to be used
      configurationProperties - - The configuration properties for janusGraph
      auditLog - - Used for logging errors
      Throws:
      JanusConnectorException - if init fails
      LineageWarehouseException - if init fails
    • getGraphTraversalSource

      public org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource getGraphTraversalSource()
      Returns a traversal that is used to query the graph
      Returns:
      traversal for the janusgraph
    • isSupportingTransactions

      public boolean isSupportingTransactions()
      return whether the graph is supporting transactions
    • closeGraph

      public void closeGraph()
      Close the connection to the graph
    • commit

      public <U> void commit(BiConsumer<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource,U> consumer, U argument, Consumer<Exception> errorHandler)
      Helper method that gets a traversal and executes the code that queries the graph
      Type Parameters:
      U - type of the second parameter of the consumer
      Parameters:
      consumer - must accept a GraphTraversalSource as the first parameter and has a second parameter
      argument - the second argument of the consumer
      errorHandler - function that is called when an error occurs while executing the consumer
    • commit

      public <V, U> void commit(org.apache.tinkerpop.gremlin.util.function.TriConsumer<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource,V,U> consumer, V argument1, U argument2, Consumer<Exception> errorHandler)
      Helper method that gets a traversal and executes the code that queries the graph
      Type Parameters:
      U - type of the second parameter of the consumer
      V - type of the third parameter of the consumer
      Parameters:
      consumer - must accept a GraphTraversalSource as the first parameter and has two more parameter
      argument1 - the second argument of the consumer
      argument2 - the third argument of the consumer
      errorHandler - function that is called when an error occurs while executing the consumer
    • getResult

      public <U> U getResult(Function<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource,U> function, Consumer<Exception> errorHandler)
      Helper method that gets a traversal and executes the code that queries the graph
      Type Parameters:
      U - type of the returned result
      Parameters:
      function - must accept a GraphTraversalSource as the parameter
      errorHandler - consumer that is called when an error occurs while executing the function
      Returns:
      the result of the function
    • getResult

      public <U, V> U getResult(BiFunction<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource,V,U> function, V argument, BiConsumer<Exception,V> errorHandler)
      Helper method that gets a traversal and executes the code that queries the graph
      Type Parameters:
      V - the type of the parameter of the function
      U - type of the returned result
      Parameters:
      function - must accept a GraphTraversalSource as the first parameter and has a second parameter
      argument - the argument of the function
      errorHandler - consumer that is called when an error occurs while executing the function
      Returns:
      the result of the function
    • getResult

      public <U, V, T> U getResult(org.apache.tinkerpop.gremlin.util.function.TriFunction<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource,V,T,U> function, V argument1, T argument2, org.apache.tinkerpop.gremlin.util.function.TriConsumer<Exception,V,T> errorHandler)
      Helper method that gets a traversal and executes the code that queries the graph
      Type Parameters:
      V - the type of the second parameter of the function
      T - the type of the third parameter of the function
      U - type of the returned result
      Parameters:
      function - must accept a GraphTraversalSource as the first parameter and has two more parameters
      argument1 - the first argument of the function
      argument2 - the second argument of the function
      errorHandler - consumer that is called when an error occurs while executing the function
      Returns:
      the result of the function