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).-
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 String
ELEMENTS_SCHEMA
Configuration key for a directory of Gaffer element schemas.static String
GRAPH_ID
static 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 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>
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 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.
-
-
-
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
-
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
-
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 getEntitiesBySeed operation on Gaffer. At least 1 vertexId must be provided. Gaffer does not support unseeded queries. All provided vertexIds will also be returned asGafferPopVertex
s with the label 'id', in order to allow Gaffer graphs with no entities to still be traversed.- Specified by:
vertices
in interfaceorg.apache.tinkerpop.gremlin.structure.Graph
- Parameters:
vertexIds
- vertices ids to query for- 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 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 asGafferPopVertex
s 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 useVertex
s,GafferPopEdge
s, EdgeId or just vertex ID valueslabels
- labels of Entities to filter for.- Returns:
- iterator of
GafferPopVertex
s, each vertex represents anEntity
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 asGafferPopVertex
s 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 useVertex
s,GafferPopEdge
s, EdgeIds or just vertex ID valuesview
- a GafferView
to filter the vertices- Returns:
- iterator of
GafferPopVertex
s, each vertex represents anEntity
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 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 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 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 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 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 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 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 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 interfaceorg.apache.tinkerpop.gremlin.structure.Graph
- Parameters:
elementIds
- EdgeIds,GafferPopEdge
s or Vertex IDs to query for- 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 getRelatedEdges operation on Gaffer.- Parameters:
id
- vertex ID or edge ID to be queried for. You can useVertex
,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 useVertex
s,GafferPopEdge
s, 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 useVertex
,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 useVertex
s,GafferPopEdge
s, EdgeIds or just vertex ID values.direction
-Direction
of edges to return.view
- a GafferView
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 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)
-
-