Class 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
      void closeGraph()
      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 getGraphTraversalSource()
      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 isSupportingTransactions()
      return whether the graph is supporting transactions
      void openGraph​(String providerClass, Map<String,​Object> configurationProperties, AuditLog auditLog)
      Open the graph with the provided configuration
    • Constructor Detail

      • GraphHelper

        public GraphHelper()
    • Method Detail

      • 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