Package oracle.pgx.api
Class GraphBuilderImpl<VID>
- java.lang.Object
-
- oracle.pgx.api.internal.ApiObject
-
- oracle.pgx.api.GraphBuilderImpl<VID>
-
- Type Parameters:
VID
- the vertex ID type
- All Implemented Interfaces:
GraphBuilder<VID>
- Direct Known Subclasses:
EdgeBuilderImpl
,GraphChangeSetImpl
,VertexBuilderImpl
public class GraphBuilderImpl<VID> extends oracle.pgx.api.internal.ApiObject implements GraphBuilder<VID>
A graph builder for constructing aPgxGraph
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EdgeBuilder<VID>
addEdge(long edgeId, VertexBuilder<VID> srcVertex, VertexBuilder<VID> dstVertex)
Adds an edge with the given edge ID and the given source and destination vertices.EdgeBuilder<VID>
addEdge(long edgeId, VID srcVertex, VID dstVertex)
Adds an edge with the given edge ID and the given source and destination vertices.EdgeBuilder<VID>
addEdge(java.lang.String edgeId, VertexBuilder<VID> srcVertex, VertexBuilder<VID> dstVertex)
Adds an edge with the given edge ID and the given source and destination vertices.EdgeBuilder<VID>
addEdge(java.lang.String edgeId, VID srcVertex, VID dstVertex)
Adds an edge with the given edge ID and the given source and destination vertices.EdgeBuilder<VID>
addEdge(VertexBuilder<VID> srcVertex, VertexBuilder<VID> dstVertex)
Adds an edge with an implicit ID and the given source and destination vertices.EdgeBuilder<VID>
addEdge(VID srcVertex, VID dstVertex)
Adds an edge with an implicit ID and the given source and destination vertices.VertexBuilder<VID>
addVertex()
Adds a vertex with an implicit id to the graph builder.VertexBuilder<VID>
addVertex(VID vertexId)
Adds the vertex with the given id to the graph builder.PgxGraph
build()
Blocking version ofGraphBuilder.buildAsync()
.PgxGraph
build(java.lang.String newGraphName)
Blocking version ofGraphBuilder.buildAsync(String)
.PgxFuture<PgxGraph>
buildAsync()
Shortcut forGraphBuilder.buildAsync(String)
without a namePgxFuture<PgxGraph>
buildAsync(java.lang.String newGraphName)
Builds a new graph out of the changes in this graph builderjava.lang.Object
getConfigParameter(GraphBuilderConfig.Field parameter)
Retrieve the value for the given config parameterPgxSession
getSession()
Gets the session.GraphBuilder<VID>
resetEdge(long edgeId)
Resets any change for the edge with the given ID.GraphBuilder<VID>
resetEdge(java.lang.String edgeId)
Resets any change for the edge with the given ID.GraphBuilder<VID>
resetVertex(VertexBuilder<VID> vertex)
Resets any change for the given vertex.GraphBuilder<VID>
resetVertex(VID vertexId)
Resets any change for the vertex with the given ID.void
setConfigParameter(GraphBuilderConfig.Field parameter, java.lang.Object value)
Set the given configuration parameter to the given valuevoid
setDataSourceVersion(java.lang.String version)
Sets the version information for the built graph or snapshotjava.lang.String
toString()
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface oracle.pgx.api.GraphBuilder
setRetainEdgeIds, setRetainIds, setRetainVertexIds
-
-
-
-
Method Detail
-
setDataSourceVersion
public void setDataSourceVersion(java.lang.String version)
Description copied from interface:GraphBuilder
Sets the version information for the built graph or snapshot- Specified by:
setDataSourceVersion
in interfaceGraphBuilder<VID>
- Parameters:
version
- the version information
-
addVertex
public VertexBuilder<VID> addVertex(VID vertexId)
Description copied from interface:GraphBuilder
Adds the vertex with the given id to the graph builder. If the vertex doesn't exist it is added, if it exists a builder for that vertex is returned Throws anUnsupportedOperationException
if vertex Id generation strategy is set toIdGenerationStrategy.AUTO_GENERATED
- Specified by:
addVertex
in interfaceGraphBuilder<VID>
- Parameters:
vertexId
- the ID of the new vertex- Returns:
- a vertex builder instance
-
addVertex
public VertexBuilder<VID> addVertex()
Description copied from interface:GraphBuilder
Adds a vertex with an implicit id to the graph builder. A builder for that vertex is returned Throws anUnsupportedOperationException
if vertex Id generation strategy is set toIdGenerationStrategy.USER_IDS
- Specified by:
addVertex
in interfaceGraphBuilder<VID>
- Returns:
- a vertex builder instance
-
resetVertex
public GraphBuilder<VID> resetVertex(VID vertexId)
Description copied from interface:GraphBuilder
Resets any change for the vertex with the given ID. Does nothing if no change for the given vertex ID exists.- Specified by:
resetVertex
in interfaceGraphBuilder<VID>
- Parameters:
vertexId
- the ID of the vertex which should be reset- Returns:
- this graph builder
-
resetVertex
public GraphBuilder<VID> resetVertex(VertexBuilder<VID> vertex)
Description copied from interface:GraphBuilder
Resets any change for the given vertex.- Specified by:
resetVertex
in interfaceGraphBuilder<VID>
- Parameters:
vertex
- aVertexBuilder
- Returns:
- this graph builder
-
resetEdge
public GraphBuilder<VID> resetEdge(long edgeId)
Description copied from interface:GraphBuilder
Resets any change for the edge with the given ID. Does nothing if no change for the given edge ID exists.- Specified by:
resetEdge
in interfaceGraphBuilder<VID>
- Parameters:
edgeId
- the ID of the edge which should be reset- Returns:
- this graph builder
-
resetEdge
public GraphBuilder<VID> resetEdge(java.lang.String edgeId)
Description copied from interface:GraphBuilder
Resets any change for the edge with the given ID. Does nothing if no change for the given edge ID exists.- Specified by:
resetEdge
in interfaceGraphBuilder<VID>
- Parameters:
edgeId
- the ID of the edge which should be reset- Returns:
- this graph builder
-
addEdge
public EdgeBuilder<VID> addEdge(long edgeId, VID srcVertex, VID dstVertex)
Description copied from interface:GraphBuilder
Adds an edge with the given edge ID and the given source and destination vertices. If the edge doesn't exist it is added, if it exists a builder for that edge is returned Vertices that don't yet exist in the graph are added on the fly. Throws anUnsupportedOperationException
if edge Id generation strategy is set toIdGenerationStrategy.AUTO_GENERATED
- Specified by:
addEdge
in interfaceGraphBuilder<VID>
- Parameters:
edgeId
- the ID of the new edgesrcVertex
- the source ID of the new edgedstVertex
- the destination ID of the new edge- Returns:
- an edge builder instance
-
addEdge
public EdgeBuilder<VID> addEdge(java.lang.String edgeId, VID srcVertex, VID dstVertex)
Description copied from interface:GraphBuilder
Adds an edge with the given edge ID and the given source and destination vertices. If the edge doesn't exist it is added, if it exists a builder for that edge is returned Vertices that don't yet exist in the graph are added on the fly. Throws anUnsupportedOperationException
if edge Id generation strategy is set toIdGenerationStrategy.AUTO_GENERATED
- Specified by:
addEdge
in interfaceGraphBuilder<VID>
- Parameters:
edgeId
- the ID of the new edgesrcVertex
- the source ID of the new edgedstVertex
- the destination ID of the new edge- Returns:
- an edge builder instance
-
addEdge
public EdgeBuilder<VID> addEdge(VID srcVertex, VID dstVertex)
Description copied from interface:GraphBuilder
Adds an edge with an implicit ID and the given source and destination vertices. Vertices that don't yet exist in the graph are added on the fly. Throws anUnsupportedOperationException
if edge Id generation strategy is set toIdGenerationStrategy.USER_IDS
- Specified by:
addEdge
in interfaceGraphBuilder<VID>
- Parameters:
srcVertex
- the source ID of the new edgedstVertex
- the destination ID of the new edge- Returns:
- an edge builder instance
-
addEdge
public EdgeBuilder<VID> addEdge(long edgeId, VertexBuilder<VID> srcVertex, VertexBuilder<VID> dstVertex)
Description copied from interface:GraphBuilder
Adds an edge with the given edge ID and the given source and destination vertices. If the edge doesn't exist it is added, if it exists a builder for that edge is returned Throws anUnsupportedOperationException
if edge Id generation strategy is set toIdGenerationStrategy.AUTO_GENERATED
- Specified by:
addEdge
in interfaceGraphBuilder<VID>
- Parameters:
edgeId
- the ID of the new edgesrcVertex
- aVertexBuilderImpl
instance representing the source vertexdstVertex
- aVertexBuilderImpl
instance representing the destination vertex- Returns:
- an edge builder instance
- See Also:
VertexBuilderImpl
-
addEdge
public EdgeBuilder<VID> addEdge(java.lang.String edgeId, VertexBuilder<VID> srcVertex, VertexBuilder<VID> dstVertex)
Description copied from interface:GraphBuilder
Adds an edge with the given edge ID and the given source and destination vertices. If the edge doesn't exist it is added, if it exists a builder for that edge is returned Throws anUnsupportedOperationException
if edge Id generation strategy is set toIdGenerationStrategy.AUTO_GENERATED
- Specified by:
addEdge
in interfaceGraphBuilder<VID>
- Parameters:
edgeId
- the ID of the new edgesrcVertex
- aVertexBuilderImpl
instance representing the source vertexdstVertex
- aVertexBuilderImpl
instance representing the destination vertex- Returns:
- an edge builder instance
- See Also:
VertexBuilderImpl
-
addEdge
public EdgeBuilder<VID> addEdge(VertexBuilder<VID> srcVertex, VertexBuilder<VID> dstVertex)
Description copied from interface:GraphBuilder
Adds an edge with an implicit ID and the given source and destination vertices. Throws anUnsupportedOperationException
if edge Id generation strategy is set toIdGenerationStrategy.USER_IDS
- Specified by:
addEdge
in interfaceGraphBuilder<VID>
- Parameters:
srcVertex
- aVertexBuilderImpl
instance representing the source vertexdstVertex
- aVertexBuilderImpl
instance representing the destination vertex- Returns:
- an edge builder instance
- See Also:
VertexBuilderImpl
-
buildAsync
public final PgxFuture<PgxGraph> buildAsync(java.lang.String newGraphName)
Description copied from interface:GraphBuilder
Builds a new graph out of the changes in this graph builder- Specified by:
buildAsync
in interfaceGraphBuilder<VID>
- Parameters:
newGraphName
- the new name of the graph. Ifnull
a name is generated- Returns:
- a new graph
-
buildAsync
public final PgxFuture<PgxGraph> buildAsync()
Description copied from interface:GraphBuilder
Shortcut forGraphBuilder.buildAsync(String)
without a name- Specified by:
buildAsync
in interfaceGraphBuilder<VID>
- Returns:
- a new graph
-
setConfigParameter
public void setConfigParameter(GraphBuilderConfig.Field parameter, java.lang.Object value)
Description copied from interface:GraphBuilder
Set the given configuration parameter to the given value- Specified by:
setConfigParameter
in interfaceGraphBuilder<VID>
- Parameters:
parameter
- the config parameter to setvalue
- the new value for the config parameter
-
getConfigParameter
public java.lang.Object getConfigParameter(GraphBuilderConfig.Field parameter)
Description copied from interface:GraphBuilder
Retrieve the value for the given config parameter- Specified by:
getConfigParameter
in interfaceGraphBuilder<VID>
- Parameters:
parameter
- the config parameter to get the value for- Returns:
- the value for the given config parameter
-
build
public final PgxGraph build(java.lang.String newGraphName) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Description copied from interface:GraphBuilder
Blocking version ofGraphBuilder.buildAsync(String)
. CallsGraphBuilder.buildAsync(String)
and waits for the returnedPgxFuture
to complete.- Specified by:
build
in interfaceGraphBuilder<VID>
- Throws:
java.util.concurrent.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.java.lang.InterruptedException
- if the caller thread gets interrupted while waiting for completion.
-
build
public final PgxGraph build() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Description copied from interface:GraphBuilder
Blocking version ofGraphBuilder.buildAsync()
. CallsGraphBuilder.buildAsync()
and waits for the returnedPgxFuture
to complete.- Specified by:
build
in interfaceGraphBuilder<VID>
- Throws:
java.util.concurrent.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.java.lang.InterruptedException
- if the caller thread gets interrupted while waiting for completion.
-
getSession
public final PgxSession getSession()
Gets the session.- Returns:
- the session this graph builder belongs to
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-