Class GraphHelper
- java.lang.Object
-
- org.odpi.openmetadata.openconnectors.governancedaemonconnectors.openlineageconnectors.janusconnector.graph.GraphHelper
-
public class GraphHelper extends Object
-
-
Constructor Summary
Constructors Constructor Description GraphHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseGraph()Close the connection to the graph<U> voidcommit(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>
voidcommit(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 graphorg.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSourcegetGraphTraversalSource()Returns a traversal that is used to query the graph<U,V>
UgetResult(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> UgetResult(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>
UgetResult(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 graphbooleanisSupportingTransactions()return whether the graph is supporting transactionsvoidopenGraph(String providerClass, Map<String,Object> configurationProperties, AuditLog auditLog)Open the graph with the provided configuration
-
-
-
Method Detail
-
openGraph
public void openGraph(String providerClass, Map<String,Object> configurationProperties, AuditLog auditLog) throws JanusConnectorException, OpenLineageException
Open the graph with the provided configuration- Parameters:
providerClass- - Provider Class name to be usedconfigurationProperties- - The configuration properties for janusGraphauditLog- - Used for logging errors- Throws:
JanusConnectorException- if init failsOpenLineageException- 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 parameterargument- the second argument of the consumererrorHandler- 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 consumerV- type of the third parameter of the consumer- Parameters:
consumer- must accept a GraphTraversalSource as the first parameter and has two more parameterargument1- the second argument of the consumerargument2- the third argument of the consumererrorHandler- 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 parametererrorHandler- 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 functionU- type of the returned result- Parameters:
function- must accept a GraphTraversalSource as the first parameter and has a second parameterargument- the argument of the functionerrorHandler- 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 functionT- the type of the third parameter of the functionU- type of the returned result- Parameters:
function- must accept a GraphTraversalSource as the first parameter and has two more parametersargument1- the first argument of the functionargument2- the second argument of the functionerrorHandler- consumer that is called when an error occurs while executing the function- Returns:
- the result of the function
-
-