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.PgxGraphbuild()Blocking version ofGraphBuilder.buildAsync().PgxGraphbuild(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.ObjectgetConfigParameter(GraphBuilderConfig.Field parameter)Retrieve the value for the given config parameterPgxSessiongetSession()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.voidsetConfigParameter(GraphBuilderConfig.Field parameter, java.lang.Object value)Set the given configuration parameter to the given valuevoidsetDataSourceVersion(java.lang.String version)Sets the version information for the built graph or snapshotjava.lang.StringtoString()-
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:GraphBuilderSets the version information for the built graph or snapshot- Specified by:
setDataSourceVersionin interfaceGraphBuilder<VID>- Parameters:
version- the version information
-
addVertex
public VertexBuilder<VID> addVertex(VID vertexId)
Description copied from interface:GraphBuilderAdds 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 anUnsupportedOperationExceptionif vertex Id generation strategy is set toIdGenerationStrategy.AUTO_GENERATED- Specified by:
addVertexin interfaceGraphBuilder<VID>- Parameters:
vertexId- the ID of the new vertex- Returns:
- a vertex builder instance
-
addVertex
public VertexBuilder<VID> addVertex()
Description copied from interface:GraphBuilderAdds a vertex with an implicit id to the graph builder. A builder for that vertex is returned Throws anUnsupportedOperationExceptionif vertex Id generation strategy is set toIdGenerationStrategy.USER_IDS- Specified by:
addVertexin interfaceGraphBuilder<VID>- Returns:
- a vertex builder instance
-
resetVertex
public GraphBuilder<VID> resetVertex(VID vertexId)
Description copied from interface:GraphBuilderResets any change for the vertex with the given ID. Does nothing if no change for the given vertex ID exists.- Specified by:
resetVertexin 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:GraphBuilderResets any change for the given vertex.- Specified by:
resetVertexin interfaceGraphBuilder<VID>- Parameters:
vertex- aVertexBuilder- Returns:
- this graph builder
-
resetEdge
public GraphBuilder<VID> resetEdge(long edgeId)
Description copied from interface:GraphBuilderResets any change for the edge with the given ID. Does nothing if no change for the given edge ID exists.- Specified by:
resetEdgein 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:GraphBuilderResets any change for the edge with the given ID. Does nothing if no change for the given edge ID exists.- Specified by:
resetEdgein 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:GraphBuilderAdds 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 anUnsupportedOperationExceptionif edge Id generation strategy is set toIdGenerationStrategy.AUTO_GENERATED- Specified by:
addEdgein 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:GraphBuilderAdds 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 anUnsupportedOperationExceptionif edge Id generation strategy is set toIdGenerationStrategy.AUTO_GENERATED- Specified by:
addEdgein 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:GraphBuilderAdds 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 anUnsupportedOperationExceptionif edge Id generation strategy is set toIdGenerationStrategy.USER_IDS- Specified by:
addEdgein 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:GraphBuilderAdds 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 anUnsupportedOperationExceptionif edge Id generation strategy is set toIdGenerationStrategy.AUTO_GENERATED- Specified by:
addEdgein interfaceGraphBuilder<VID>- Parameters:
edgeId- the ID of the new edgesrcVertex- aVertexBuilderImplinstance representing the source vertexdstVertex- aVertexBuilderImplinstance 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:GraphBuilderAdds 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 anUnsupportedOperationExceptionif edge Id generation strategy is set toIdGenerationStrategy.AUTO_GENERATED- Specified by:
addEdgein interfaceGraphBuilder<VID>- Parameters:
edgeId- the ID of the new edgesrcVertex- aVertexBuilderImplinstance representing the source vertexdstVertex- aVertexBuilderImplinstance 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:GraphBuilderAdds an edge with an implicit ID and the given source and destination vertices. Throws anUnsupportedOperationExceptionif edge Id generation strategy is set toIdGenerationStrategy.USER_IDS- Specified by:
addEdgein interfaceGraphBuilder<VID>- Parameters:
srcVertex- aVertexBuilderImplinstance representing the source vertexdstVertex- aVertexBuilderImplinstance 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:GraphBuilderBuilds a new graph out of the changes in this graph builder- Specified by:
buildAsyncin interfaceGraphBuilder<VID>- Parameters:
newGraphName- the new name of the graph. Ifnulla name is generated- Returns:
- a new graph
-
buildAsync
public final PgxFuture<PgxGraph> buildAsync()
Description copied from interface:GraphBuilderShortcut forGraphBuilder.buildAsync(String)without a name- Specified by:
buildAsyncin interfaceGraphBuilder<VID>- Returns:
- a new graph
-
setConfigParameter
public void setConfigParameter(GraphBuilderConfig.Field parameter, java.lang.Object value)
Description copied from interface:GraphBuilderSet the given configuration parameter to the given value- Specified by:
setConfigParameterin 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:GraphBuilderRetrieve the value for the given config parameter- Specified by:
getConfigParameterin 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:GraphBuilderBlocking version ofGraphBuilder.buildAsync(String). CallsGraphBuilder.buildAsync(String)and waits for the returnedPgxFutureto complete.- Specified by:
buildin 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:GraphBuilderBlocking version ofGraphBuilder.buildAsync(). CallsGraphBuilder.buildAsync()and waits for the returnedPgxFutureto complete.- Specified by:
buildin 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:
toStringin classjava.lang.Object
-
-