Package uk.gov.gchq.gaffer.tinkerpop
Class GafferPopGraph
- java.lang.Object
-
- uk.gov.gchq.gaffer.tinkerpop.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
-
-
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
-
-
Field Summary
Fields Modifier and Type Field Description static String
DATA_AUTHS
static int
DEFAULT_GET_ELEMENTS_LIMIT
Default value for the max number of elements returned by getElementsstatic GafferPopGraph.HasStepFilterStage
DEFAULT_HAS_STEP_FILTER_STAGE
Default to pre-aggregation filtering for HasStep predicatesstatic String
ELEMENTS_SCHEMA
Configuration key for a directory of Gaffer element schemas.static 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.static String
GET_ELEMENTS_LIMIT
Configuration key for the max number of elements returned by a getElementsstatic String
GRAPH_ID
static String
HAS_STEP_FILTER_STAGE
Configuration key for when to apply HasStep filteringstatic String
ID_LABEL
The vertex label for vertex IDs.static String
ID_MANAGER
The type of vertex id manager to use seeGafferPopGraph.DefaultIdManager
static String
NOT_READ_ONLY_ELEMENTS
Configuration key for stopping the elements added via Gremlin/Tinkerpop from being readonly.static String
OP_OPTIONS
Configuration key for a string array of operation options.static String
SCHEMAS
Configuration key for a string array of path to Gaffer schemas.static String
STORE_PROPERTIES
Configuration key for a path to Gaffer store properties.static String
TYPES_SCHEMA
Configuration key for a directory of Gaffer type schemas.static String
USER_ID
-
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 GetAdjacentIds then GetElements 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 GetAdjacentIds then GetElements 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 GetAdjacentIds then GetElements 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 GetAdjacentIds then GetElements operation chain on Gaffer.void
close()
org.apache.tinkerpop.gremlin.process.computer.GraphComputer
compute()
<C extends org.apache.tinkerpop.gremlin.process.computer.GraphComputer>
Ccompute(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 GetElements operation filtering edges by labels and direction.Iterator<org.apache.tinkerpop.gremlin.structure.Edge>
edges(Object... elementIds)
This performs a GetElements 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 GetElements operation filtering edges by labels and direction.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.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.<T> T
execute(OperationChain<T> opChain)
org.apache.tinkerpop.gremlin.structure.Graph.Features
features()
Graph
getGafferGraph()
Get the underlying Gaffer graph this GafferPop graph is connected to.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)
void
setDefaultVariables(GafferPopGraphVariables variables)
Sets theGafferPopGraphVariables
to default values for this graphorg.apache.tinkerpop.gremlin.structure.Transaction
tx()
org.apache.tinkerpop.gremlin.structure.Graph.Variables
variables()
Iterator<GafferPopVertex>
vertices(Iterable<Object> ids, String... labels)
This performs a GetElements operation on Gaffer filtering vertices by labels.Iterator<org.apache.tinkerpop.gremlin.structure.Vertex>
vertices(Object... vertexIds)
This performs a GetElements operation on Gaffer.Iterator<GafferPopVertex>
verticesWithView(Iterable<Object> ids, View view)
This performs a GetElements operation on Gaffer filtering by aView
.
-
-
-
Field Detail
-
GRAPH_ID
public static final String GRAPH_ID
- See Also:
- Constant Field Values
-
STORE_PROPERTIES
public static final String STORE_PROPERTIES
Configuration key for a path to Gaffer store properties.- See Also:
StoreProperties
, Constant Field Values
-
SCHEMAS
public static final String SCHEMAS
Configuration key for a string array of path to Gaffer schemas.- See Also:
Schema
, Constant Field Values
-
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
-
USER_ID
public static final String USER_ID
- See Also:
- Constant Field Values
-
DATA_AUTHS
public static final String DATA_AUTHS
- 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
-
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
-
ID_LABEL
public static final String ID_LABEL
The vertex label for vertex IDs. These areGafferPopVertex
s that don't have any properties, just an ID value and a label of 'id'.- See Also:
- Constant Field Values
-
ID_MANAGER
public static final String ID_MANAGER
The type of vertex id manager to use seeGafferPopGraph.DefaultIdManager
- 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(String configurationFile)
-
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 interfaceorg.apache.tinkerpop.gremlin.structure.Graph
-
addVertex
public void addVertex(GafferPopVertex vertex)
-
addEdge
public void addEdge(GafferPopEdge edge)
-
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 interfaceorg.apache.tinkerpop.gremlin.structure.Graph
- Parameters:
vertexIds
- vertex ids to query for. Supports input as aVertex
,Edge
, List of Edge IDs or individual Vertex IDs.- Returns:
- iterator of
GafferPopVertex
s, each vertex represents anEntity
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 aVertex
,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
GafferPopVertex
s, each vertex represents anEntity
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 aView
.- Parameters:
ids
- vertex ids to query for. Supports input as aVertex
,Edge
, List of Edge IDs or individual Vertex IDs.view
- a GafferView
to filter vertices by- Returns:
- iterator of
GafferPopVertex
s, each vertex represents anEntity
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 travellabels
- 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 travellabels
- 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 travelview
- a GafferView
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 travelview
- a GafferView
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 interfaceorg.apache.tinkerpop.gremlin.structure.Graph
- Parameters:
elementIds
- element ids to query for. Supports input as aVertex
,Edge
, List of Edge IDs or individual Vertex IDs.- Returns:
- iterator of
GafferPopEdge
s. - 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 aVertex
,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
GafferPopEdge
s. - 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 aVertex
,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
GafferPopEdge
s. - 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 aVertex
,Edge
, List of Edge IDs or individual Vertex IDs.direction
-Direction
of edges to return.view
- GafferView
to filter edges by- Returns:
- iterator of
GafferPopEdge
s. - 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 aVertex
,Edge
, List of Edge IDs or individual Vertex IDs.direction
-Direction
of edges to return.view
- GafferView
to filter edges by- Returns:
- iterator of
GafferPopEdge
s. - 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 interfaceorg.apache.tinkerpop.gremlin.structure.Graph
- Throws:
IllegalArgumentException
-
compute
public org.apache.tinkerpop.gremlin.process.computer.GraphComputer compute() throws IllegalArgumentException
- Specified by:
compute
in interfaceorg.apache.tinkerpop.gremlin.structure.Graph
- Throws:
IllegalArgumentException
-
tx
public org.apache.tinkerpop.gremlin.structure.Transaction tx()
- Specified by:
tx
in interfaceorg.apache.tinkerpop.gremlin.structure.Graph
-
variables
public org.apache.tinkerpop.gremlin.structure.Graph.Variables variables()
- Specified by:
variables
in interfaceorg.apache.tinkerpop.gremlin.structure.Graph
-
configuration
public org.apache.commons.configuration2.Configuration configuration()
- Specified by:
configuration
in interfaceorg.apache.tinkerpop.gremlin.structure.Graph
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceorg.apache.tinkerpop.gremlin.structure.Graph
- Throws:
Exception
-
getServiceRegistry
public org.apache.tinkerpop.gremlin.structure.service.ServiceRegistry getServiceRegistry()
- Specified by:
getServiceRegistry
in interfaceorg.apache.tinkerpop.gremlin.structure.Graph
-
features
public org.apache.tinkerpop.gremlin.structure.Graph.Features features()
- Specified by:
features
in interfaceorg.apache.tinkerpop.gremlin.structure.Graph
-
execute
public <T> T execute(OperationChain<T> opChain)
-
setDefaultVariables
public void setDefaultVariables(GafferPopGraphVariables variables)
Sets theGafferPopGraphVariables
to default values for this graph- Parameters:
variables
- The variables
-
getGafferGraph
public Graph getGafferGraph()
Get the underlying Gaffer graph this GafferPop graph is connected to.- Returns:
- The Gaffer Graph.
-
-