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.booleanisGraphBuilderConfigFinalized()GraphBuilder<VID>partitionedEdgeIds(boolean partitionedIds)Specifies if the final graph should useIdStrategy.PARTITIONED_IDSfor edges.GraphBuilder<VID>partitionedVertexIds(boolean partitionedIds)Specifies if the final graph should useIdStrategy.PARTITIONED_IDSfor vertices.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 snapshotGraphBuilder<VID>setEdgeIdGenerationStrategy(IdGenerationStrategy edgeIdGenerationStrategy)Defines the ID generation strategy the GraphBuilder should use for edges.GraphBuilder<VID>setRetainEdgeIds(boolean retainEdgeIds)Controls whether the edge ids provided in this graph builder are to be retained in the final graph.GraphBuilder<VID>setRetainVertexIds(boolean retainVertexIds)Controls whether to retain the vertex ids provided in this graph builder are to be retained in the final graph.GraphBuilder<VID>setVertexIdGenerationStrategy(IdGenerationStrategy vertexIdGenerationStrategy)Defines the ID generation strategy the GraphBuilder should use for vertices.java.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
setRetainIds
-
-
-
-
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
-
setRetainEdgeIds
public GraphBuilder<VID> setRetainEdgeIds(boolean retainEdgeIds)
Description copied from interface:GraphBuilderControls whether the edge ids provided in this graph builder are to be retained in the final graph. Iftrueretain the edge ids, iffalseuse internally generated edge ids.- Specified by:
setRetainEdgeIdsin interfaceGraphBuilder<VID>- Parameters:
retainEdgeIds- whether or not to retain edge ids- Returns:
- this graph builder
-
setRetainVertexIds
public GraphBuilder<VID> setRetainVertexIds(boolean retainVertexIds)
Description copied from interface:GraphBuilderControls whether to retain the vertex ids provided in this graph builder are to be retained in the final graph. Iftrueretain the vertex ids, iffalseuse internally generated vertex ids of typeInteger- Specified by:
setRetainVertexIdsin interfaceGraphBuilder<VID>- Parameters:
retainVertexIds- whether or not to retain vertex ids- Returns:
- this graph builder
-
setVertexIdGenerationStrategy
public GraphBuilder<VID> setVertexIdGenerationStrategy(IdGenerationStrategy vertexIdGenerationStrategy)
Description copied from interface:GraphBuilderDefines the ID generation strategy the GraphBuilder should use for vertices. IfIdGenerationStrategy.AUTO_GENERATEDvertices IDs are internally generated, ifIdGenerationStrategy.USER_IDSvertices IDs are explicitly defined by the user- Specified by:
setVertexIdGenerationStrategyin interfaceGraphBuilder<VID>- Parameters:
vertexIdGenerationStrategy- Id generation strategy- Returns:
- this graph builder
-
setEdgeIdGenerationStrategy
public GraphBuilder<VID> setEdgeIdGenerationStrategy(IdGenerationStrategy edgeIdGenerationStrategy)
Description copied from interface:GraphBuilderDefines the ID generation strategy the GraphBuilder should use for edges. IfIdGenerationStrategy.AUTO_GENERATEDedges IDs are internally generated, ifIdGenerationStrategy.USER_IDSedges IDs are explicitly defined by the user- Specified by:
setEdgeIdGenerationStrategyin interfaceGraphBuilder<VID>- Parameters:
edgeIdGenerationStrategy- Id generation strategy- Returns:
- this graph builder
-
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.
-
partitionedVertexIds
public GraphBuilder<VID> partitionedVertexIds(boolean partitionedIds)
Description copied from interface:GraphBuilderSpecifies if the final graph should useIdStrategy.PARTITIONED_IDSfor vertices. Partitioned Ids can be used only in the context of building a partitioned graph, and only if the original Ids are retained, that is, only if the client is configured to build partitioned graphs andGraphBuilder.setRetainVertexIds(boolean)both are set to true- Specified by:
partitionedVertexIdsin interfaceGraphBuilder<VID>- Parameters:
partitionedIds- whether or not to useIdStrategy.PARTITIONED_IDSfor vertices in the final graph- Returns:
- this graph builder
-
partitionedEdgeIds
public GraphBuilder<VID> partitionedEdgeIds(boolean partitionedIds)
Description copied from interface:GraphBuilderSpecifies if the final graph should useIdStrategy.PARTITIONED_IDSfor edges. Partitioned Ids can be used only in the context of building a partitioned graph, and only if the original Ids are retained, that is, only if the client is configured to build partitioned graphs andGraphBuilder.setRetainEdgeIds(boolean)both are set to true- Specified by:
partitionedEdgeIdsin interfaceGraphBuilder<VID>- Parameters:
partitionedIds- whether or not to useIdStrategy.PARTITIONED_IDSfor edges in the final graph- Returns:
- this graph builder
-
isGraphBuilderConfigFinalized
public boolean isGraphBuilderConfigFinalized()
-
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
-
-