Class StarGraph
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.structure.util.star.StarGraph
-
- All Implemented Interfaces:
Serializable
,AutoCloseable
,Graph
,Host
public final class StarGraph extends Object implements Graph, Serializable
AStarGraph
is a form ofAttachable
(though theGraph
implementation does not implement that interface itself). It is a very limitedGraph
implementation that holds a singleVertex
and its related properties and edges (and their properties). It is designed to be an efficient memory representation of this data structure, thus making it good for network and disk-based serialization.- Author:
- Marko A. Rodriguez (http://markorodriguez.com)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StarGraph.Builder
StarGraph builder with options to customize its internalsclass
StarGraph.StarAdjacentVertex
class
StarGraph.StarEdge
class
StarGraph.StarElement<E extends Element>
static class
StarGraph.StarGraphFeatures
class
StarGraph.StarInEdge
class
StarGraph.StarOutEdge
class
StarGraph.StarProperty<V>
class
StarGraph.StarVertex
class
StarGraph.StarVertexProperty<V>
-
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.Graph
Graph.Exceptions, Graph.Features, Graph.Hidden, Graph.OptIn, Graph.OptIns, Graph.OptOut, Graph.OptOuts, Graph.Variables
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
compareIdsUsingStrings
protected Map<Object,Map<String,Object>>
edgeProperties
protected boolean
internStrings
protected Map<Object,Map<String,Object>>
metaProperties
protected Long
nextId
protected StarGraph.StarVertex
starVertex
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Vertex
addVertex(Object... keyValues)
Add aVertex
to the graph given an optional series of key/value pairs.Optional<StarGraph>
applyGraphFilter(GraphFilter graphFilter)
static StarGraph.Builder
build()
void
close()
Closing aGraph
is equivalent to "shutdown" and implies that no further operations can be executed on the instance.GraphComputer
compute()
Generate aGraphComputer
using the default engine of the underlying graph system.<C extends GraphComputer>
Ccompute(Class<C> graphComputerClass)
Declare theGraphComputer
to use for OLAP operations on the graph.org.apache.commons.configuration2.Configuration
configuration()
Get theConfiguration
associated with the construction of this graph.Iterator<Edge>
edges(Object... edgeIds)
Graph.Features
features()
Gets theGraph.Features
exposed by the underlyingGraph
implementation.StarGraph.StarVertex
getStarVertex()
static StarGraph
of(Vertex vertex)
static StarGraph
open()
Creates an emptyStarGraph
.String
toString()
Transaction
tx()
Configure and control the transactions for those graphs that support this feature.Graph.Variables
variables()
A collection of globalGraph.Variables
associated with the graph.Iterator<Vertex>
vertices(Object... vertexIds)
-
-
-
Field Detail
-
nextId
protected Long nextId
-
starVertex
protected StarGraph.StarVertex starVertex
-
internStrings
protected final boolean internStrings
-
compareIdsUsingStrings
protected final boolean compareIdsUsingStrings
-
-
Method Detail
-
getStarVertex
public StarGraph.StarVertex getStarVertex()
-
compute
public <C extends GraphComputer> C compute(Class<C> graphComputerClass) throws IllegalArgumentException
Description copied from interface:Graph
Declare theGraphComputer
to use for OLAP operations on the graph. If the graph does not support graph computer then anUnsupportedOperationException
is thrown.- Specified by:
compute
in interfaceGraph
- Parameters:
graphComputerClass
- The graph computer class to use.- Returns:
- A graph computer for processing this graph
- Throws:
IllegalArgumentException
- if the providedGraphComputer
class is not supported.
-
compute
public GraphComputer compute() throws IllegalArgumentException
Description copied from interface:Graph
Generate aGraphComputer
using the default engine of the underlying graph system. This is a shorthand method for the more involved method that usesGraph.compute(Class)
.- Specified by:
compute
in interfaceGraph
- Returns:
- A default graph computer
- Throws:
IllegalArgumentException
- if there is no default graph computer
-
vertices
public Iterator<Vertex> vertices(Object... vertexIds)
Description copied from interface:Graph
Get theVertex
objects in this graph with the provided vertex ids orVertex
objects themselves. If no ids are provided, get all vertices. Note that a vertex identifier does not need to correspond to the actual id used in the graph. It needs to be a bit more flexible than that in that given theGraph.Features
around id support, multiple arguments might be applicable here. If the graph returntrue
forGraph.Features.ElementFeatures.supportsNumericIds()
then it should support filters as with:- g.vertices(v)
- g.vertices(v.id())
- g.vertices(1)
- g.vertices(1L)
- g.vertices(1.0d)
- g.vertices(1.0f)
- g.vertices("1")
true
forGraph.Features.ElementFeatures.supportsCustomIds()
()} then it should support filters as with:- g.vertices(v)
- g.vertices(v.id())
- g.vertices(v.id().toString())
true
forGraph.Features.ElementFeatures.supportsAnyIds()
()} then it should support filters as with:- g.vertices(v)
- g.vertices(v.id())
true
forGraph.Features.ElementFeatures.supportsStringIds()
()} then it should support filters as with:- g.vertices(v)
- g.vertices(v.id().toString())
- g.vertices("id")
true
forGraph.Features.ElementFeatures.supportsStringIds()
()} then it should support filters as with:- g.vertices(v)
- g.vertices(v.id().toString())
- g.vertices("id")
-
edges
public Iterator<Edge> edges(Object... edgeIds)
Description copied from interface:Graph
Get theEdge
objects in this graph with the provided edge ids orEdge
objects. If no ids are provided, get all edges. Note that an edge identifier does not need to correspond to the actual id used in the graph. It needs to be a bit more flexible than that in that given theGraph.Features
around id support, multiple arguments might be applicable here. If the graph returntrue
forGraph.Features.ElementFeatures.supportsNumericIds()
then it should support filters as with:- g.edges(e)
- g.edges(e.id())
- g.edges(1)
- g.edges(1L)
- g.edges(1.0d)
- g.edges(1.0f)
- g.edges("1")
true
forGraph.Features.ElementFeatures.supportsCustomIds()
()} then it should support filters as with:- g.edges(e)
- g.edges(e.id())
- g.edges(e.id().toString())
true
forGraph.Features.ElementFeatures.supportsAnyIds()
()} then it should support filters as with:- g.edges(e)
- g.edges(e.id())
true
forGraph.Features.ElementFeatures.supportsStringIds()
()} then it should support filters as with:- g.edges(e)
- g.edges(e.id().toString())
- g.edges("id")
-
tx
public Transaction tx()
Description copied from interface:Graph
Configure and control the transactions for those graphs that support this feature.
-
variables
public Graph.Variables variables()
Description copied from interface:Graph
A collection of globalGraph.Variables
associated with the graph. Variables are used for storing metadata about the graph.
-
configuration
public org.apache.commons.configuration2.Configuration configuration()
Description copied from interface:Graph
Get theConfiguration
associated with the construction of this graph. Whatever configuration was passed toGraphFactory.open(Configuration)
is what should be returned by this method.- Specified by:
configuration
in interfaceGraph
- Returns:
- the configuration used during graph construction.
-
features
public Graph.Features features()
Description copied from interface:Graph
Gets theGraph.Features
exposed by the underlyingGraph
implementation.
-
close
public void close() throws Exception
Description copied from interface:Graph
Closing aGraph
is equivalent to "shutdown" and implies that no further operations can be executed on the instance. Users should consult the documentation of the underlying graph database implementation for what this "shutdown" will mean in general and, if supported, how open transactions are handled. It will typically be the end user's responsibility to synchronize the thread that callsclose()
with other threads that are accessing open transactions. In other words, be sure that all work performed on theGraph
instance is complete prior to calling this method. TinkerPop does not enforce any particular semantics with respect to "shutdown". It is up to the graph provider to decide what this method will do.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceGraph
- Throws:
Exception
-
build
public static StarGraph.Builder build()
-
applyGraphFilter
public Optional<StarGraph> applyGraphFilter(GraphFilter graphFilter)
-
-