Interface TinkerpopTemplate

All Superinterfaces:
org.eclipse.jnosql.mapping.graph.GraphTemplate, org.eclipse.jnosql.mapping.semistructured.SemiStructuredTemplate, jakarta.nosql.Template

public interface TinkerpopTemplate extends org.eclipse.jnosql.mapping.graph.GraphTemplate
GraphTemplate is a helper class that increases productivity when performing common Graph operations. Includes integrated object mapping between documents and POJOs Vertex and Edge. It represents the common operation between an entity and Graph
See Also:
  • Graph
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> void
    delete(T id)
    Deletes a Vertex
    <T> void
    Deletes Edge instances
    <T> void
    deleteEdge(T id)
    Deletes a Edge
    edge(E edgeId)
    Finds an EdgeEntity from the Edge Id
    <O, I> EdgeEntity
    edge(O outgoing, String label, I incoming)
    Either find or create an Edge between this two entities.
    default <O, I> EdgeEntity
    edge(O outgoing, Supplier<String> label, I incoming)
    Either find or create an Edge between this two entities.
    edges(T entity, org.apache.tinkerpop.gremlin.structure.Direction direction)
    returns the edges of from an entity
    edges(T entity, org.apache.tinkerpop.gremlin.structure.Direction direction, String... labels)
    returns the edges of from an entity
    edges(T entity, org.apache.tinkerpop.gremlin.structure.Direction direction, Supplier<String>... labels)
    returns the edges of from an entity
    edgesById(K id, org.apache.tinkerpop.gremlin.structure.Direction direction)
    returns the edges of from a vertex id
    edgesById(K id, org.apache.tinkerpop.gremlin.structure.Direction direction, String... labels)
    returns the edges of from a vertex id
    edgesById(K id, org.apache.tinkerpop.gremlin.structure.Direction direction, Supplier<String>... labels)
    returns the edges of from a vertex id
    <T, K> Optional<T>
    find(K id)
    Find an entity given T.label and T.id
    <T> Stream<T>
    gremlin(String gremlin)
    Executes a Gremlin then bring the result as a Stream
    <T> Stream<T>
    gremlin(String gremlin, Map<String,Object> parameters)
    Executes a Gremlin then bring the result as a Stream with parameter
    org.eclipse.jnosql.mapping.PreparedStatement
    Creates a PreparedStatement from the query
    <T> Optional<T>
    Executes a Gremlin query then bring the result as a unique result
    org.apache.tinkerpop.gremlin.structure.Transaction
    Gets the current transaction
    traversalEdge(Object... edgeIds)
    Gets a EdgeTraversal to run a query in the graph
    traversalVertex(Object... vertexIds)
    Gets a VertexTraversal to run a query in the graph

    Methods inherited from interface org.eclipse.jnosql.mapping.graph.GraphTemplate

    delete, edge, edge, edge, findEdgeById

    Methods inherited from interface org.eclipse.jnosql.mapping.semistructured.SemiStructuredTemplate

    count, count, count, delete, deleteAll, exists, findAll, prepare, prepare, query, query, select, selectCursor, selectOffSet, singleResult, singleResult, singleResult

    Methods inherited from interface jakarta.nosql.Template

    delete, delete, find, insert, insert, insert, insert, select, update, update
  • Method Details

    • delete

      <T> void delete(T id)
      Deletes a Vertex
      Type Parameters:
      T - the id type
      Parameters:
      id - the id to be used in the query T.id
      Throws:
      NullPointerException - when id is null
    • deleteEdge

      <T> void deleteEdge(T id)
      Deletes a Edge
      Specified by:
      deleteEdge in interface org.eclipse.jnosql.mapping.graph.GraphTemplate
      Type Parameters:
      T - the id type
      Parameters:
      id - the id to be used in the query T.id
      Throws:
      NullPointerException - when either label and id are null
    • deleteEdge

      <T> void deleteEdge(Iterable<T> ids)
      Deletes Edge instances
      Type Parameters:
      T - the id type
      Parameters:
      ids - the ids to be used in the query T.id
      Throws:
      NullPointerException - when either label and id are null
    • edge

      <O, I> EdgeEntity edge(O outgoing, String label, I incoming)
      Either find or create an Edge between this two entities. Edge
      entityOUT ---label---> entityIN.
      Type Parameters:
      I - the incoming type
      O - the outgoing type
      Parameters:
      incoming - the incoming entity
      label - the Edge label
      outgoing - the outgoing entity
      Returns:
      the EdgeEntity of these two entities
      Throws:
      NullPointerException - Either when any elements are null or the entity is null
    • edge

      default <O, I> EdgeEntity edge(O outgoing, Supplier<String> label, I incoming)
      Either find or create an Edge between this two entities. Edge
      entityOUT ---label---> entityIN.
      Type Parameters:
      I - the incoming type
      O - the outgoing type
      Parameters:
      incoming - the incoming entity
      label - the Edge label
      outgoing - the outgoing entity
      Returns:
      the EdgeEntity of these two entities
      Throws:
      NullPointerException - Either when any elements are null or the entity is null
    • find

      <T, K> Optional<T> find(K id)
      Find an entity given T.label and T.id
      Type Parameters:
      T - the entity type
      K - the id type
      Parameters:
      id - the id to be used in the query T.id
      Returns:
      the entity found otherwise Optional.empty()
      Throws:
      NullPointerException - when id is null
    • edgesById

      <K> Collection<EdgeEntity> edgesById(K id, org.apache.tinkerpop.gremlin.structure.Direction direction, String... labels)
      returns the edges of from a vertex id
      Type Parameters:
      K - the K type
      Parameters:
      id - the id
      direction - the direction
      labels - the edge labels
      Returns:
      the Edges
      Throws:
      NullPointerException - where there is any parameter null
    • edgesById

      <K> Collection<EdgeEntity> edgesById(K id, org.apache.tinkerpop.gremlin.structure.Direction direction, Supplier<String>... labels)
      returns the edges of from a vertex id
      Type Parameters:
      K - the K type
      Parameters:
      id - the id
      direction - the direction
      labels - the edge labels
      Returns:
      the Edges
      Throws:
      NullPointerException - where there is any parameter null
    • edgesById

      <K> Collection<EdgeEntity> edgesById(K id, org.apache.tinkerpop.gremlin.structure.Direction direction)
      returns the edges of from a vertex id
      Type Parameters:
      K - the K type
      Parameters:
      id - the id
      direction - the direction
      Returns:
      the Edges
      Throws:
      NullPointerException - where there is any parameter null
    • edges

      <T> Collection<EdgeEntity> edges(T entity, org.apache.tinkerpop.gremlin.structure.Direction direction, String... labels)
      returns the edges of from an entity
      Type Parameters:
      T - the entity type
      Parameters:
      entity - the entity
      direction - the direction
      labels - the edge labels
      Returns:
      the Edges
      Throws:
      NullPointerException - where there is any parameter null
    • edges

      <T> Collection<EdgeEntity> edges(T entity, org.apache.tinkerpop.gremlin.structure.Direction direction, Supplier<String>... labels)
      returns the edges of from an entity
      Type Parameters:
      T - the entity type
      Parameters:
      entity - the entity
      direction - the direction
      labels - the edge labels
      Returns:
      the Edges
      Throws:
      NullPointerException - where there is any parameter null
    • edges

      <T> Collection<EdgeEntity> edges(T entity, org.apache.tinkerpop.gremlin.structure.Direction direction)
      returns the edges of from an entity
      Type Parameters:
      T - the entity type
      Parameters:
      entity - the entity
      direction - the direction
      Returns:
      the Edges
      Throws:
      NullPointerException - where there is any parameter null
    • edge

      <E> Optional<EdgeEntity> edge(E edgeId)
      Finds an EdgeEntity from the Edge Id
      Type Parameters:
      E - the edge id type
      Parameters:
      edgeId - the edge id
      Returns:
      the EdgeEntity otherwise Optional.empty()
      Throws:
      IllegalStateException - when edgeId is null
    • traversalVertex

      VertexTraversal traversalVertex(Object... vertexIds)
      Gets a VertexTraversal to run a query in the graph
      Parameters:
      vertexIds - get ids
      Returns:
      a VertexTraversal instance
      Throws:
      IllegalStateException - if any id element is null
    • traversalEdge

      EdgeTraversal traversalEdge(Object... edgeIds)
      Gets a EdgeTraversal to run a query in the graph
      Parameters:
      edgeIds - get ids
      Returns:
      a VertexTraversal instance
      Throws:
      IllegalStateException - if any id element is null
    • transaction

      org.apache.tinkerpop.gremlin.structure.Transaction transaction()
      Gets the current transaction
      Returns:
      the current Transaction
    • gremlin

      <T> Stream<T> gremlin(String gremlin)
      Executes a Gremlin then bring the result as a Stream
      Type Parameters:
      T - the entity type
      Parameters:
      gremlin - the query gremlin
      Returns:
      the result as Stream
      Throws:
      NullPointerException - when the gremlin is null
    • gremlin

      <T> Stream<T> gremlin(String gremlin, Map<String,Object> parameters)
      Executes a Gremlin then bring the result as a Stream with parameter
      Type Parameters:
      T - the entity type
      Parameters:
      gremlin - the query gremlin
      parameters - the parameters to be used in the query
      Returns:
      the result as Stream
    • gremlinSingleResult

      <T> Optional<T> gremlinSingleResult(String gremlin)
      Executes a Gremlin query then bring the result as a unique result
      Type Parameters:
      T - the entity type
      Parameters:
      gremlin - the gremlin query
      Returns:
      the result as List
      Throws:
      NullPointerException - when the query is null
    • gremlinPrepare

      org.eclipse.jnosql.mapping.PreparedStatement gremlinPrepare(String gremlin)
      Creates a PreparedStatement from the query
      Parameters:
      gremlin - the gremlin query
      Returns:
      a PreparedStatement instance
      Throws:
      NullPointerException - when the query is null