Class GafferPopGraph

  • All Implemented Interfaces:
    AutoCloseable, org.apache.tinkerpop.gremlin.structure.Graph, org.apache.tinkerpop.gremlin.structure.util.Host

    public class GafferPopGraph
    extends Object
    implements org.apache.tinkerpop.gremlin.structure.Graph
    A GafferPopGraph is an implementation of Graph. It wraps a Gaffer Graph and delegates all operations to it. In addition to the tinkerpop methods required there are methods to add edges query for adjacent vertices and to provide a View to filter out results.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  GafferPopGraph.DefaultIdManager
      Types of ID managers available for this graph (mainly used for testing).
      • Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.Graph

        org.apache.tinkerpop.gremlin.structure.Graph.Exceptions, org.apache.tinkerpop.gremlin.structure.Graph.Features, org.apache.tinkerpop.gremlin.structure.Graph.Hidden, org.apache.tinkerpop.gremlin.structure.Graph.OptIn, org.apache.tinkerpop.gremlin.structure.Graph.OptIns, org.apache.tinkerpop.gremlin.structure.Graph.OptOut, org.apache.tinkerpop.gremlin.structure.Graph.OptOuts, org.apache.tinkerpop.gremlin.structure.Graph.Variables
    • Constructor Summary

      Constructors 
      Constructor Description
      GafferPopGraph​(org.apache.commons.configuration2.Configuration configuration)  
      GafferPopGraph​(org.apache.commons.configuration2.Configuration configuration, Graph graph)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addEdge​(GafferPopEdge edge)  
      org.apache.tinkerpop.gremlin.structure.Vertex addVertex​(Object... keyValues)  
      void addVertex​(GafferPopVertex vertex)  
      Iterator<org.apache.tinkerpop.gremlin.structure.Vertex> adjVertices​(Iterable<Object> vertexIds, org.apache.tinkerpop.gremlin.structure.Direction direction, String... labels)
      This performs getAdjacentEntitySeeds then getEntityBySeed operation chain on Gaffer.
      Iterator<org.apache.tinkerpop.gremlin.structure.Vertex> adjVertices​(Object vertexId, org.apache.tinkerpop.gremlin.structure.Direction direction, String... labels)
      This performs getAdjacentEntitySeeds then getEntityBySeed operation chain on Gaffer.
      Iterator<org.apache.tinkerpop.gremlin.structure.Vertex> adjVerticesWithView​(Iterable<Object> vertexIds, org.apache.tinkerpop.gremlin.structure.Direction direction, View view)
      This performs getAdjacentEntitySeeds then getEntityBySeed operation chain on Gaffer.
      Iterator<org.apache.tinkerpop.gremlin.structure.Vertex> adjVerticesWithView​(Object vertexId, org.apache.tinkerpop.gremlin.structure.Direction direction, View view)
      This performs getAdjacentEntitySeeds then getEntityBySeed operation chain on Gaffer.
      void close()  
      org.apache.tinkerpop.gremlin.process.computer.GraphComputer compute()  
      <C extends org.apache.tinkerpop.gremlin.process.computer.GraphComputer>
      C
      compute​(Class<C> graphComputerClass)  
      org.apache.commons.configuration2.Configuration configuration()  
      Iterator<org.apache.tinkerpop.gremlin.structure.Edge> edges​(Iterable<Object> ids, org.apache.tinkerpop.gremlin.structure.Direction direction, String... labels)
      This performs a getRelatedEdges operation on Gaffer.
      Iterator<org.apache.tinkerpop.gremlin.structure.Edge> edges​(Object... elementIds)
      This performs a getEdgesBySeed operation on Gaffer.
      Iterator<org.apache.tinkerpop.gremlin.structure.Edge> edges​(Object id, org.apache.tinkerpop.gremlin.structure.Direction direction, String... labels)
      This performs a getRelatedEdges operation on Gaffer.
      Iterator<org.apache.tinkerpop.gremlin.structure.Edge> edgesWithView​(Iterable<Object> ids, org.apache.tinkerpop.gremlin.structure.Direction direction, View view)
      This performs a getRelatedEdges operation on Gaffer.
      Iterator<org.apache.tinkerpop.gremlin.structure.Edge> edgesWithView​(Object id, org.apache.tinkerpop.gremlin.structure.Direction direction, View view)
      This performs a getRelatedEdges operation on Gaffer.
      <T> T execute​(OperationChain<T> opChain)  
      org.apache.tinkerpop.gremlin.structure.Graph.Features features()  
      org.apache.tinkerpop.gremlin.structure.service.ServiceRegistry getServiceRegistry()  
      static GafferPopGraph open​(String configurationFile)  
      static GafferPopGraph open​(org.apache.commons.configuration2.Configuration configuration)  
      static GafferPopGraph open​(org.apache.commons.configuration2.Configuration configuration, Graph graph)  
      org.apache.tinkerpop.gremlin.structure.Transaction tx()  
      org.apache.tinkerpop.gremlin.structure.Graph.Variables variables()  
      Iterator<GafferPopVertex> vertices​(Iterable<Object> ids, String... labels)
      This performs getRelatedEntities operation on Gaffer.
      Iterator<org.apache.tinkerpop.gremlin.structure.Vertex> vertices​(Object... vertexIds)
      This performs getEntitiesBySeed operation on Gaffer.
      Iterator<GafferPopVertex> verticesWithView​(Iterable<Object> ids, View view)
      This performs getRelatedEntities operation on Gaffer.
      • Methods inherited from interface org.apache.tinkerpop.gremlin.structure.Graph

        addVertex, io, traversal, traversal, tx
    • Field Detail

      • TYPES_SCHEMA

        public static final String TYPES_SCHEMA
        Configuration key for a directory of Gaffer type schemas. Primary use is for when the types and elements schemas are in different directories, if main SCHEMAS key is defined it will be used in preference to this one.
        See Also:
        Constant Field Values
      • ELEMENTS_SCHEMA

        public static final String ELEMENTS_SCHEMA
        Configuration key for a directory of Gaffer element schemas. Primary use is for when the types and elements schemas are in different directories, if main SCHEMAS key is defined it will be used in preference to this one.
        See Also:
        Constant Field Values
      • OP_OPTIONS

        public static final String OP_OPTIONS
        Configuration key for a string array of operation options. Each option should in the form: key:value
        See Also:
        Constant Field Values
      • NOT_READ_ONLY_ELEMENTS

        public static final String NOT_READ_ONLY_ELEMENTS
        Configuration key for stopping the elements added via Gremlin/Tinkerpop from being readonly. If this is set a vertex or edge may have its properties modified via the Tinkerpop interface using the defined ingest aggregation function(s) it has set.
        See Also:
        Constant Field Values
    • Constructor Detail

      • GafferPopGraph

        public GafferPopGraph​(org.apache.commons.configuration2.Configuration configuration)
      • GafferPopGraph

        public GafferPopGraph​(org.apache.commons.configuration2.Configuration configuration,
                              Graph graph)
    • Method Detail

      • open

        public static GafferPopGraph open​(org.apache.commons.configuration2.Configuration configuration)
      • open

        public static GafferPopGraph open​(org.apache.commons.configuration2.Configuration configuration,
                                          Graph graph)
      • addVertex

        public org.apache.tinkerpop.gremlin.structure.Vertex addVertex​(Object... keyValues)
        Specified by:
        addVertex in interface org.apache.tinkerpop.gremlin.structure.Graph
      • vertices

        public Iterator<org.apache.tinkerpop.gremlin.structure.Vertex> vertices​(Object... vertexIds)
        This performs getEntitiesBySeed operation on Gaffer. At least 1 vertexId must be provided. Gaffer does not support unseeded queries. All provided vertexIds will also be returned as GafferPopVertexs with the label 'id', in order to allow Gaffer graphs with no entities to still be traversed.
        Specified by:
        vertices in interface org.apache.tinkerpop.gremlin.structure.Graph
        Parameters:
        vertexIds - vertices ids to query for
        Returns:
        iterator of GafferPopVertexs, each vertex represents an Entity in Gaffer
        See Also:
        Graph.vertices(Object...)
      • vertices

        public Iterator<GafferPopVertex> vertices​(Iterable<Object> ids,
                                                  String... labels)
        This performs getRelatedEntities operation on Gaffer. At least 1 id must be provided. Gaffer does not support unseeded queries. All provided vertex IDs will also be returned as GafferPopVertexs with the label 'id', in order to allow Gaffer graphs with no entities to still be traversed.
        Parameters:
        ids - vertex IDs and edge IDs to be queried for. You can use Vertexs, GafferPopEdges, EdgeId or just vertex ID values
        labels - labels of Entities to filter for.
        Returns:
        iterator of GafferPopVertexs, each vertex represents an Entity in Gaffer
      • verticesWithView

        public Iterator<GafferPopVertex> verticesWithView​(Iterable<Object> ids,
                                                          View view)
        This performs getRelatedEntities operation on Gaffer. At least 1 id must be provided. Gaffer does not support unseeded queries. All provided vertex IDs will also be returned as GafferPopVertexs with the label 'id', in order to allow Gaffer graphs with no entities to still be traversed.
        Parameters:
        ids - vertex IDs and edge IDs to be queried for. You can use Vertexs, GafferPopEdges, EdgeIds or just vertex ID values
        view - a Gaffer View to filter the vertices
        Returns:
        iterator of GafferPopVertexs, each vertex represents an Entity in Gaffer
        See Also:
        vertices(Iterable, String...)
      • adjVertices

        public Iterator<org.apache.tinkerpop.gremlin.structure.Vertex> adjVertices​(Object vertexId,
                                                                                   org.apache.tinkerpop.gremlin.structure.Direction direction,
                                                                                   String... labels)
        This performs getAdjacentEntitySeeds then getEntityBySeed operation chain on Gaffer. Given a vertex id, adjacent vertices will be returned. If you provide any optional labels then you must provide edge labels and the vertex labels - any missing labels will cause the elements to be filtered out. This method will not return 'id' vertices, only vertices that exist as entities in Gaffer.
        Parameters:
        vertexId - the vertex id to start at.
        direction - the direction along edges to travel
        labels - labels of vertices and edges. Alternatively you can supply a Gaffer View serialised into JSON.
        Returns:
        iterator of GafferPopVertex
      • adjVertices

        public Iterator<org.apache.tinkerpop.gremlin.structure.Vertex> adjVertices​(Iterable<Object> vertexIds,
                                                                                   org.apache.tinkerpop.gremlin.structure.Direction direction,
                                                                                   String... labels)
        This performs getAdjacentEntitySeeds then getEntityBySeed operation chain on Gaffer. Given an iterable of vertex ids, adjacent vertices will be returned. If you provide any optional labels then you must provide edge labels and the vertex labels - any missing labels will cause the elements to be filtered out. This method will not return 'id' vertices, only vertices that exist as entities in Gaffer.
        Parameters:
        vertexIds - the iterable of vertex ids to start at.
        direction - the direction along edges to travel
        labels - labels of vertices and edges. Alternatively you can supply a Gaffer View serialised into JSON.
        Returns:
        iterator of GafferPopVertex
      • adjVerticesWithView

        public Iterator<org.apache.tinkerpop.gremlin.structure.Vertex> adjVerticesWithView​(Object vertexId,
                                                                                           org.apache.tinkerpop.gremlin.structure.Direction direction,
                                                                                           View view)
        This performs getAdjacentEntitySeeds then getEntityBySeed operation chain on Gaffer. Given a vertex id, adjacent vertices will be returned. If you provide any optional labels then you must provide edge labels and the vertex labels - any missing labels will cause the elements to be filtered out. This method will not return 'id' vertices, only vertices that exist as entities in Gaffer.
        Parameters:
        vertexId - the vertex id to start at.
        direction - the direction along edges to travel
        view - a Gaffer View containing edge and entity groups.
        Returns:
        iterator of GafferPopVertex
      • adjVerticesWithView

        public Iterator<org.apache.tinkerpop.gremlin.structure.Vertex> adjVerticesWithView​(Iterable<Object> vertexIds,
                                                                                           org.apache.tinkerpop.gremlin.structure.Direction direction,
                                                                                           View view)
        This performs getAdjacentEntitySeeds then getEntityBySeed operation chain on Gaffer. Given an iterable of vertex ids, adjacent vertices will be returned. If you provide any optional labels then you must provide edge labels and the vertex labels - any missing labels will cause the elements to be filtered out. This method will not return 'id' vertices, only vertices that exist as entities in Gaffer.
        Parameters:
        vertexIds - the iterable of vertex ids to start at.
        direction - the direction along edges to travel
        view - a Gaffer View containing edge and entity groups.
        Returns:
        iterator of GafferPopVertex
      • edges

        public Iterator<org.apache.tinkerpop.gremlin.structure.Edge> edges​(Object... elementIds)
        This performs a getEdgesBySeed operation on Gaffer. At least 1 ID must be provided as Gaffer does not support unseeded queries. Supports various forms of IDs to enable passing either edge IDs or Entity/Vertex IDs but will filter to only return edges.
        Specified by:
        edges in interface org.apache.tinkerpop.gremlin.structure.Graph
        Parameters:
        elementIds - EdgeIds, GafferPopEdges or Vertex IDs to query for
        Returns:
        iterator of GafferPopEdges.
        See Also:
        Graph.edges(Object...)
      • edges

        public Iterator<org.apache.tinkerpop.gremlin.structure.Edge> edges​(Object id,
                                                                           org.apache.tinkerpop.gremlin.structure.Direction direction,
                                                                           String... labels)
        This performs a getRelatedEdges operation on Gaffer.
        Parameters:
        id - vertex ID or edge ID to be queried for. You can use Vertex, GafferPopEdge, EdgeId or just a vertex ID value.
        direction - Direction of edges to return.
        labels - labels of edges. Alternatively you can supply a Gaffer View serialised into JSON.
        Returns:
        iterator of GafferPopEdge
      • edges

        public Iterator<org.apache.tinkerpop.gremlin.structure.Edge> edges​(Iterable<Object> ids,
                                                                           org.apache.tinkerpop.gremlin.structure.Direction direction,
                                                                           String... labels)
        This performs a getRelatedEdges operation on Gaffer.
        Parameters:
        ids - vertex IDs and edge IDs to be queried for. You can use Vertexs, GafferPopEdges, EdgeIds or just vertex ID values.
        direction - Direction of edges to return.
        labels - labels of edges. Alternatively you can supply a Gaffer View serialised into JSON.
        Returns:
        iterator of GafferPopEdge
      • edgesWithView

        public Iterator<org.apache.tinkerpop.gremlin.structure.Edge> edgesWithView​(Object id,
                                                                                   org.apache.tinkerpop.gremlin.structure.Direction direction,
                                                                                   View view)
        This performs a getRelatedEdges operation on Gaffer.
        Parameters:
        id - vertex ID or edge ID to be queried for. You can use Vertex, GafferPopEdge, EdgeId or just a vertex ID value.
        direction - Direction of edges to return.
        view - labels of edges. Alternatively you can supply a Gaffer View serialised into JSON.
        Returns:
        iterator of GafferPopEdge
      • edgesWithView

        public Iterator<org.apache.tinkerpop.gremlin.structure.Edge> edgesWithView​(Iterable<Object> ids,
                                                                                   org.apache.tinkerpop.gremlin.structure.Direction direction,
                                                                                   View view)
        This performs a getRelatedEdges operation on Gaffer.
        Parameters:
        ids - vertex IDs and edge IDs to be queried for. You can use Vertexs, GafferPopEdges, EdgeIds or just vertex ID values.
        direction - Direction of edges to return.
        view - a Gaffer View containing edge groups.
        Returns:
        iterator of GafferPopEdge
      • compute

        public <C extends org.apache.tinkerpop.gremlin.process.computer.GraphComputer> C compute​(Class<C> graphComputerClass)
                                                                                          throws IllegalArgumentException
        Specified by:
        compute in interface org.apache.tinkerpop.gremlin.structure.Graph
        Throws:
        IllegalArgumentException
      • tx

        public org.apache.tinkerpop.gremlin.structure.Transaction tx()
        Specified by:
        tx in interface org.apache.tinkerpop.gremlin.structure.Graph
      • variables

        public org.apache.tinkerpop.gremlin.structure.Graph.Variables variables()
        Specified by:
        variables in interface org.apache.tinkerpop.gremlin.structure.Graph
      • configuration

        public org.apache.commons.configuration2.Configuration configuration()
        Specified by:
        configuration in interface org.apache.tinkerpop.gremlin.structure.Graph
      • close

        public void close()
                   throws Exception
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface org.apache.tinkerpop.gremlin.structure.Graph
        Throws:
        Exception
      • getServiceRegistry

        public org.apache.tinkerpop.gremlin.structure.service.ServiceRegistry getServiceRegistry()
        Specified by:
        getServiceRegistry in interface org.apache.tinkerpop.gremlin.structure.Graph
      • features

        public org.apache.tinkerpop.gremlin.structure.Graph.Features features()
        Specified by:
        features in interface org.apache.tinkerpop.gremlin.structure.Graph