Package oracle.pgx.api
Class GraphChangeSetImpl<VID>
- java.lang.Object
-
- oracle.pgx.api.internal.ApiObject
-
- oracle.pgx.api.GraphBuilderImpl<VID>
-
- oracle.pgx.api.GraphChangeSetImpl<VID>
-
- All Implemented Interfaces:
GraphBuilder<VID>
,GraphChangeSet<VID>
- Direct Known Subclasses:
EdgeModifierImpl
,VertexModifierImpl
public class GraphChangeSetImpl<VID> extends GraphBuilderImpl<VID> implements GraphChangeSet<VID>
-
-
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(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(VertexBuilder<VID> srcVertex, VertexBuilder<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.PgxFuture<PgxGraph>
buildNewSnapshotAsync()
Builds a new snapshot of the graph out ofthis
GraphChangeSet
: the resultingPgxGraph
is a new snapshot of thePgxGraph
objectthis
was created from.ChangeType
getEdgeChangeType(java.lang.Object id)
Returns theChangeType
of the update for the edge with the given IDChangeType
getVertexChangeType(VID id)
Returns theChangeType
of the update for the vertex with the given IDGraphBuilder<VID>
partitionedEdgeIds(boolean partitionedIds)
Specifies if the final graph should useIdStrategy.PARTITIONED_IDS
for edges.GraphBuilder<VID>
partitionedVertexIds(boolean partitionedIds)
Specifies if the final graph should useIdStrategy.PARTITIONED_IDS
for vertices.GraphChangeSet<VID>
removeEdge(long edgeId)
Removes an edge from the graph.GraphChangeSet<VID>
removeEdge(java.lang.String edgeId)
Removes an edge from the graph.GraphChangeSet<VID>
removeVertex(VID vertexId)
Removes a vertex from the graph.GraphChangeSet<VID>
resetEdge(long edgeId)
Resets any change for the edge with the given ID.GraphChangeSet<VID>
resetEdge(java.lang.String edgeId)
Resets any change for the edge with the given ID.GraphChangeSet<VID>
resetVertex(VertexBuilder<VID> vertex)
Resets any change for the given vertex.GraphChangeSet<VID>
resetVertex(VID vertexId)
Resets any change for the vertex with the given ID.GraphChangeSet<VID>
setAddExistingEdgePolicy(OnAddExistingElement addExistingEdgePolicy)
Sets the policy on what to do when an edge is added that already existsGraphChangeSet<VID>
setAddExistingVertexPolicy(OnAddExistingElement addExistingVertexPolicy)
Sets the policy on what to do when a vertex is added that already existsGraphChangeSet<VID>
setInvalidChangePolicy(OnInvalidChange invalidChangePolicy)
Sets the policy on what to do when an invalid action is addedGraphChangeSet<VID>
setRequiredConversionPolicy(OnRequiredConversion requiredConversionPolicy)
Sets the policy on what to do when an invalid type is encounteredjava.lang.String
toString()
EdgeModifier<VID>
updateEdge(long edgeId)
Returns aEdgeModifier
with which you can update edge properties and the edge label.EdgeModifier<VID>
updateEdge(java.lang.String edgeId)
Returns aEdgeModifier
with which you can update edge properties and the edge label.VertexModifier<VID>
updateVertex(VID vertexId)
Returns aVertexModifier
with which you can update vertex properties.-
Methods inherited from class oracle.pgx.api.GraphBuilderImpl
addEdge, addEdge, addEdge, addVertex, build, build, buildAsync, buildAsync, getConfigParameter, getSession, isGraphBuilderConfigFinalized, setConfigParameter, setDataSourceVersion, setEdgeIdGenerationStrategy, setRetainEdgeIds, setRetainVertexIds, setVertexIdGenerationStrategy
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface oracle.pgx.api.GraphBuilder
addEdge, build, build, buildAsync, buildAsync, getConfigParameter, setDataSourceVersion, setEdgeIdGenerationStrategy, setRetainEdgeIds, setRetainVertexIds, setVertexIdGenerationStrategy
-
Methods inherited from interface oracle.pgx.api.GraphChangeSet
addEdge, addEdge, addVertex, buildNewSnapshot, setRetainIds
-
-
-
-
Method Detail
-
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>
- Specified by:
addVertex
in interfaceGraphChangeSet<VID>
- Overrides:
addVertex
in classGraphBuilderImpl<VID>
- Returns:
- a vertex 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>
- Specified by:
addEdge
in interfaceGraphChangeSet<VID>
- Overrides:
addEdge
in classGraphBuilderImpl<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>
- Specified by:
addEdge
in interfaceGraphChangeSet<VID>
- Overrides:
addEdge
in classGraphBuilderImpl<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>
- Overrides:
addEdge
in classGraphBuilderImpl<VID>
- Parameters:
srcVertex
- aVertexBuilderImpl
instance representing the source vertexdstVertex
- aVertexBuilderImpl
instance representing the destination vertex- Returns:
- an edge builder instance
- See Also:
VertexBuilderImpl
-
removeVertex
public GraphChangeSet<VID> removeVertex(VID vertexId)
Description copied from interface:GraphChangeSet
Removes a vertex from the graph. If the graph doesn't have a vertex with the given ID, an exception will be thrown once the graph is built.- Specified by:
removeVertex
in interfaceGraphChangeSet<VID>
- Parameters:
vertexId
- the ID of the vertex to be removed- Returns:
- this graph change set
-
removeEdge
public GraphChangeSet<VID> removeEdge(long edgeId)
Description copied from interface:GraphChangeSet
Removes an edge from the graph. If the graph doesn't have an edge with the given ID, an exception will be thrown once the graph is built.- Specified by:
removeEdge
in interfaceGraphChangeSet<VID>
- Parameters:
edgeId
- the ID of the edge to be removed- Returns:
- this graph change set
-
removeEdge
public GraphChangeSet<VID> removeEdge(java.lang.String edgeId)
Description copied from interface:GraphChangeSet
Removes an edge from the graph. If the graph doesn't have an edge with the given ID, an exception will be thrown once the graph is built.- Specified by:
removeEdge
in interfaceGraphChangeSet<VID>
- Parameters:
edgeId
- the ID of the edge to be removed- Returns:
- this graph change set
-
updateVertex
public VertexModifier<VID> updateVertex(VID vertexId)
Description copied from interface:GraphChangeSet
Returns aVertexModifier
with which you can update vertex properties. Throws an exception if the vertex has been removed with this graph change set before.- Specified by:
updateVertex
in interfaceGraphChangeSet<VID>
- Parameters:
vertexId
- the ID of the vertex that should be updated- Returns:
- a
VertexModifier
instance
-
updateEdge
public EdgeModifier<VID> updateEdge(long edgeId)
Description copied from interface:GraphChangeSet
Returns aEdgeModifier
with which you can update edge properties and the edge label.- Specified by:
updateEdge
in interfaceGraphChangeSet<VID>
- Parameters:
edgeId
- the ID of the edge that should be updated- Returns:
- an
VertexModifier
instance
-
updateEdge
public EdgeModifier<VID> updateEdge(java.lang.String edgeId)
Description copied from interface:GraphChangeSet
Returns aEdgeModifier
with which you can update edge properties and the edge label.- Specified by:
updateEdge
in interfaceGraphChangeSet<VID>
- Parameters:
edgeId
- the ID of the edge that should be updated- Returns:
- an
VertexModifier
instance
-
resetEdge
public GraphChangeSet<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>
- Specified by:
resetEdge
in interfaceGraphChangeSet<VID>
- Overrides:
resetEdge
in classGraphBuilderImpl<VID>
- Parameters:
edgeId
- the ID of the edge which should be reset- Returns:
- this graph builder
-
resetEdge
public GraphChangeSet<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>
- Specified by:
resetEdge
in interfaceGraphChangeSet<VID>
- Overrides:
resetEdge
in classGraphBuilderImpl<VID>
- Parameters:
edgeId
- the ID of the edge which should be reset- Returns:
- this graph builder
-
resetVertex
public GraphChangeSet<VID> resetVertex(VertexBuilder<VID> vertex)
Description copied from interface:GraphBuilder
Resets any change for the given vertex.- Specified by:
resetVertex
in interfaceGraphBuilder<VID>
- Specified by:
resetVertex
in interfaceGraphChangeSet<VID>
- Overrides:
resetVertex
in classGraphBuilderImpl<VID>
- Parameters:
vertex
- aVertexBuilder
- Returns:
- this graph builder
-
resetVertex
public GraphChangeSet<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>
- Specified by:
resetVertex
in interfaceGraphChangeSet<VID>
- Overrides:
resetVertex
in classGraphBuilderImpl<VID>
- Parameters:
vertexId
- the ID of the vertex which should be reset- Returns:
- this graph builder
-
setAddExistingEdgePolicy
public GraphChangeSet<VID> setAddExistingEdgePolicy(OnAddExistingElement addExistingEdgePolicy)
Description copied from interface:GraphChangeSet
Sets the policy on what to do when an edge is added that already exists- Specified by:
setAddExistingEdgePolicy
in interfaceGraphChangeSet<VID>
- Parameters:
addExistingEdgePolicy
- the new policy- Returns:
- this graph builder
-
setAddExistingVertexPolicy
public GraphChangeSet<VID> setAddExistingVertexPolicy(OnAddExistingElement addExistingVertexPolicy)
Description copied from interface:GraphChangeSet
Sets the policy on what to do when a vertex is added that already exists- Specified by:
setAddExistingVertexPolicy
in interfaceGraphChangeSet<VID>
- Parameters:
addExistingVertexPolicy
- the new policy- Returns:
- this graph builder
-
setInvalidChangePolicy
public GraphChangeSet<VID> setInvalidChangePolicy(OnInvalidChange invalidChangePolicy)
Description copied from interface:GraphChangeSet
Sets the policy on what to do when an invalid action is added- Specified by:
setInvalidChangePolicy
in interfaceGraphChangeSet<VID>
- Returns:
- this graph builder
-
setRequiredConversionPolicy
public GraphChangeSet<VID> setRequiredConversionPolicy(OnRequiredConversion requiredConversionPolicy)
Description copied from interface:GraphChangeSet
Sets the policy on what to do when an invalid type is encountered- Specified by:
setRequiredConversionPolicy
in interfaceGraphChangeSet<VID>
- Returns:
- this graph builder
-
toString
public java.lang.String toString()
- Overrides:
toString
in classGraphBuilderImpl<VID>
-
buildNewSnapshotAsync
public final PgxFuture<PgxGraph> buildNewSnapshotAsync()
Description copied from interface:GraphChangeSet
Builds a new snapshot of the graph out ofthis
GraphChangeSet
: the resultingPgxGraph
is a new snapshot of thePgxGraph
objectthis
was created from.- Specified by:
buildNewSnapshotAsync
in interfaceGraphChangeSet<VID>
- Returns:
- the
PgxFuture
to retrieve a newPgxGraph
object with the same name of the original graph and the changes added intothis
; the newPgxGraph
is a new snapshot of the original graph
-
getVertexChangeType
public ChangeType getVertexChangeType(VID id)
Description copied from interface:GraphChangeSet
Returns theChangeType
of the update for the vertex with the given ID- Specified by:
getVertexChangeType
in interfaceGraphChangeSet<VID>
- Parameters:
id
- the ID of the vertex that should be referenced- Returns:
- the
ChangeType
or null if the graph doesn't have an vertex with the given ID
-
getEdgeChangeType
public ChangeType getEdgeChangeType(java.lang.Object id)
Description copied from interface:GraphChangeSet
Returns theChangeType
of the update for the edge with the given ID- Specified by:
getEdgeChangeType
in interfaceGraphChangeSet<VID>
- Parameters:
id
- the ID of the edge that should be referenced- Returns:
- the
ChangeType
or null if the graph doesn't have an edge with the given ID
-
partitionedEdgeIds
public GraphBuilder<VID> partitionedEdgeIds(boolean partitionedIds)
Description copied from interface:GraphBuilder
Specifies if the final graph should useIdStrategy.PARTITIONED_IDS
for 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:
partitionedEdgeIds
in interfaceGraphBuilder<VID>
- Overrides:
partitionedEdgeIds
in classGraphBuilderImpl<VID>
- Parameters:
partitionedIds
- whether or not to useIdStrategy.PARTITIONED_IDS
for edges in the final graph- Returns:
- this graph builder
-
partitionedVertexIds
public GraphBuilder<VID> partitionedVertexIds(boolean partitionedIds)
Description copied from interface:GraphBuilder
Specifies if the final graph should useIdStrategy.PARTITIONED_IDS
for 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:
partitionedVertexIds
in interfaceGraphBuilder<VID>
- Overrides:
partitionedVertexIds
in classGraphBuilderImpl<VID>
- Parameters:
partitionedIds
- whether or not to useIdStrategy.PARTITIONED_IDS
for vertices in the final graph- Returns:
- this graph builder
-
-