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).
      static class  GafferPopGraph.HasStepFilterStage  
      • 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)  
    • 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
      • GET_ELEMENTS_LIMIT

        public static final String GET_ELEMENTS_LIMIT
        Configuration key for the max number of elements returned by a getElements
        See Also:
        Constant Field Values
      • DEFAULT_GET_ELEMENTS_LIMIT

        public static final int DEFAULT_GET_ELEMENTS_LIMIT
        Default value for the max number of elements returned by getElements
        See Also:
        Constant Field Values
      • HAS_STEP_FILTER_STAGE

        public static final String HAS_STEP_FILTER_STAGE
        Configuration key for when to apply HasStep filtering
        See Also:
        Constant Field Values
      • DEFAULT_HAS_STEP_FILTER_STAGE

        public static final GafferPopGraph.HasStepFilterStage DEFAULT_HAS_STEP_FILTER_STAGE
        Default to pre-aggregation filtering for HasStep predicates
      • 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
      • GAFFERPOP_PROPERTIES

        public static final String GAFFERPOP_PROPERTIES
        Key for use in the store properties to allow setting the file location of the GafferPop properties file from a store properties file.
        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 a GetElements operation on Gaffer. If no vertex ids are provided, it performs a GetAllElements operation instead. The results of GetElements will be truncated to a configured max size.
        Specified by:
        vertices in interface org.apache.tinkerpop.gremlin.structure.Graph
        Parameters:
        vertexIds - vertex ids to query for. Supports input as a Vertex, Edge, List of Edge IDs or individual Vertex IDs.
        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 a GetElements operation on Gaffer filtering vertices by labels. If no vertex ids are provided, it performs a GetAllElements operation instead. The results of GetAllElements will be truncated to a configured max size.
        Parameters:
        ids - vertex ids to query for. Supports input as a Vertex, Edge, List of Edge IDs or individual Vertex IDs.
        labels - labels of Entities to filter for. Alternatively you can supply a Gaffer View serialised into JSON.
        Returns:
        iterator of GafferPopVertexs, each vertex represents an Entity in Gaffer
        See Also:
        vertices(Object...)
      • verticesWithView

        public Iterator<GafferPopVertex> verticesWithView​(Iterable<Object> ids,
                                                          View view)
        This performs a GetElements operation on Gaffer filtering by a View.
        Parameters:
        ids - vertex ids to query for. Supports input as a Vertex, Edge, List of Edge IDs or individual Vertex IDs.
        view - a Gaffer View to filter vertices by
        Returns:
        iterator of GafferPopVertexs, each vertex represents an Entity in Gaffer
        See Also:
        vertices(Object...)
      • adjVertices

        public Iterator<org.apache.tinkerpop.gremlin.structure.Vertex> adjVertices​(Object vertexId,
                                                                                   org.apache.tinkerpop.gremlin.structure.Direction direction,
                                                                                   String... labels)
        This performs GetAdjacentIds then GetElements 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 GetAdjacentIds then GetElements 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 GetAdjacentIds then GetElements 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 GetAdjacentIds then GetElements 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.
        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 GetElements operation on Gaffer. If no element ids are provided, it performs a GetAllElements operation instead. The results of GetAllElements will be truncated to a configured max size.
        Specified by:
        edges in interface org.apache.tinkerpop.gremlin.structure.Graph
        Parameters:
        elementIds - element ids to query for. Supports input as a Vertex, Edge, List of Edge IDs or individual Vertex IDs.
        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 GetElements operation filtering edges by labels and direction.
        Parameters:
        id - vertex ID or edge ID to be queried for. Supports input as a Vertex, Edge, List of Edge IDs or individual Vertex IDs.
        direction - Direction of edges to return.
        labels - labels of edges. Alternatively you can supply a Gaffer View serialised into JSON.
        Returns:
        iterator of GafferPopEdges.
        See Also:
        edges(Object...)
      • 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 GetElements operation filtering edges by labels and direction.
        Parameters:
        ids - vertex IDs or edge IDs to be queried for. Supports input as a Vertex, Edge, List of Edge IDs or individual Vertex IDs.
        direction - Direction of edges to return.
        labels - labels of edges. Alternatively you can supply a Gaffer View serialised into JSON.
        Returns:
        iterator of GafferPopEdges.
        See Also:
        edges(Object...)
      • edgesWithView

        public Iterator<org.apache.tinkerpop.gremlin.structure.Edge> edgesWithView​(Object id,
                                                                                   org.apache.tinkerpop.gremlin.structure.Direction direction,
                                                                                   View view)
        This performs a GetElements operation filtering edges by direction and view.
        Parameters:
        id - vertex ID or edge ID to be queried for. Supports input as a Vertex, Edge, List of Edge IDs or individual Vertex IDs.
        direction - Direction of edges to return.
        view - Gaffer View to filter edges by
        Returns:
        iterator of GafferPopEdges.
        See Also:
        edges(Object...)
      • 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 GetElements operation filtering edges by direction and view.
        Parameters:
        ids - vertex IDs or edge IDs to be queried for. Supports input as a Vertex, Edge, List of Edge IDs or individual Vertex IDs.
        direction - Direction of edges to return.
        view - Gaffer View to filter edges by
        Returns:
        iterator of GafferPopEdges.
        See Also:
        edges(Object...)
      • 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
      • getGafferGraph

        public Graph getGafferGraph()
        Get the underlying Gaffer graph this GafferPop graph is connected to.
        Returns:
        The Gaffer Graph.