Interface GraphChangeSet<VID>

    • Method Detail

      • addVertex

        VertexBuilder<VID> addVertex​(VID vertexId)
        Adds the vertex with the given id to the graph builder. If the addExistingVertexPolicy is set to ERROR throws an exception if a vertex with the given id already exists Otherwise a builder for that vertex is returned Throws an UnsupportedOperationException if vertex Id generation strategy is set to AUTO_GENERATED
        Specified by:
        addVertex in interface GraphBuilder<VID>
        Parameters:
        vertexId - the ID of the new vertex
        Returns:
        a vertex builder instance
      • addVertex

        VertexBuilder<VID> addVertex()
        Adds the vertex to the graph builder. If the addExistingVertexPolicy is set to ERROR throws an exception if a vertex already exists Otherwise a builder for that vertex is returned Throws an UnsupportedOperationException if vertex Id generation strategy for partitioned graphs . is set to AUTO_GENERATED
        Specified by:
        addVertex in interface GraphBuilder<VID>
        Returns:
        a vertex builder instance
      • addEdge

        EdgeBuilder<VID> addEdge​(long edgeId,
                                 VID srcVertex,
                                 VID dstVertex)
        Adds an edge with the given edge ID and the given source and destination vertices. If the addExistingEdgePolicy is set to ERROR throws an exception if an edge with the given id already exists Otherwise a builder for that edge is returned

        Throws an UnsupportedOperationException if edge Id generation strategy is set to AUTO_GENERATED

        Specified by:
        addEdge in interface GraphBuilder<VID>
        Parameters:
        edgeId - the ID of the new edge
        srcVertex - the source ID of the new edge
        dstVertex - the destination ID of the new edge
        Returns:
        an edge builder instance
      • addEdge

        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. If the addExistingEdgePolicy is set to ERROR throws an exception if an edge with the given id already exists Otherwise a builder for that edge is returned

        Throws an UnsupportedOperationException if edge Id generation strategy is set to AUTO_GENERATED

        Specified by:
        addEdge in interface GraphBuilder<VID>
        Parameters:
        edgeId - the ID of the new edge
        srcVertex - the source ID of the new edge
        dstVertex - the destination ID of the new edge
        Returns:
        an edge builder instance
      • addEdge

        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. If the addExistingEdgePolicy is set to ERROR throws an exception if an edge with the given id already exists Otherwise a builder for that edge is returned Throws an UnsupportedOperationException if edge Id generation strategy is set to AUTO_GENERATED
        Specified by:
        addEdge in interface GraphBuilder<VID>
        Parameters:
        edgeId - the ID of the new edge
        srcVertex - a VertexBuilderImpl instance representing the source vertex
        dstVertex - a VertexBuilderImpl instance representing the destination vertex
        Returns:
        an edge builder instance
        See Also:
        VertexBuilderImpl
      • addEdge

        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. If the addExistingEdgePolicy is set to ERROR throws an exception if an edge with the given id already exists Otherwise a builder for that edge is returned Throws an UnsupportedOperationException if edge Id generation strategy is set to AUTO_GENERATED
        Specified by:
        addEdge in interface GraphBuilder<VID>
        Parameters:
        edgeId - the ID of the new edge
        srcVertex - a VertexBuilderImpl instance representing the source vertex
        dstVertex - a VertexBuilderImpl instance representing the destination vertex
        Returns:
        an edge builder instance
        See Also:
        VertexBuilderImpl
      • removeVertex

        GraphChangeSet<VID> removeVertex​(VID vertexId)
        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.
        Parameters:
        vertexId - the ID of the vertex to be removed
        Returns:
        this graph change set
      • removeEdge

        GraphChangeSet<VID> removeEdge​(long edgeId)
        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.
        Parameters:
        edgeId - the ID of the edge to be removed
        Returns:
        this graph change set
      • removeEdge

        GraphChangeSet<VID> removeEdge​(java.lang.String edgeId)
        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.
        Parameters:
        edgeId - the ID of the edge to be removed
        Returns:
        this graph change set
      • updateVertex

        VertexModifier<VID> updateVertex​(VID vertexId)
        Returns a VertexModifier with which you can update vertex properties. Throws an exception if the vertex has been removed with this graph change set before.
        Parameters:
        vertexId - the ID of the vertex that should be updated
        Returns:
        a VertexModifier instance
      • updateEdge

        EdgeModifier<VID> updateEdge​(long edgeId)
        Returns a EdgeModifier with which you can update edge properties and the edge label.
        Parameters:
        edgeId - the ID of the edge that should be updated
        Returns:
        an VertexModifier instance
      • updateEdge

        EdgeModifier<VID> updateEdge​(java.lang.String edgeId)
        Returns a EdgeModifier with which you can update edge properties and the edge label.
        Parameters:
        edgeId - the ID of the edge that should be updated
        Returns:
        an VertexModifier instance
      • setAddExistingVertexPolicy

        GraphChangeSet<VID> setAddExistingVertexPolicy​(OnAddExistingElement addExistingVertexPolicy)
        Sets the policy on what to do when a vertex is added that already exists
        Parameters:
        addExistingVertexPolicy - the new policy
        Returns:
        this graph builder
      • setInvalidChangePolicy

        GraphChangeSet<VID> setInvalidChangePolicy​(OnInvalidChange invalidChangePolicy)
        Sets the policy on what to do when an invalid action is added
        Parameters:
        invalidChangePolicy -
        Returns:
        this graph builder
        Since:
        20.2.0
      • setRequiredConversionPolicy

        GraphChangeSet<VID> setRequiredConversionPolicy​(OnRequiredConversion requiredConversionPolicy)
        Sets the policy on what to do when an invalid type is encountered
        Parameters:
        requiredConversionPolicy -
        Returns:
        this graph builder
        Since:
        20.2.0
      • setAddExistingEdgePolicy

        GraphChangeSet<VID> setAddExistingEdgePolicy​(OnAddExistingElement addExistingEdgePolicy)
        Sets the policy on what to do when an edge is added that already exists
        Parameters:
        addExistingEdgePolicy - the new policy
        Returns:
        this graph builder
      • resetVertex

        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 interface GraphBuilder<VID>
        Parameters:
        vertexId - the ID of the vertex which should be reset
        Returns:
        this graph builder
      • resetEdge

        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 interface GraphBuilder<VID>
        Parameters:
        edgeId - the ID of the edge which should be reset
        Returns:
        this graph builder
      • resetEdge

        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 interface GraphBuilder<VID>
        Parameters:
        edgeId - the ID of the edge which should be reset
        Returns:
        this graph builder
      • setRetainEdgeIds

        default GraphChangeSet<VID> setRetainEdgeIds​(boolean retainEdgeIds)
        Description copied from interface: GraphBuilder
        Controls whether the edge ids provided in this graph builder are to be retained in the final graph. If true retain the edge ids, if false use internally generated edge ids.
        Specified by:
        setRetainEdgeIds in interface GraphBuilder<VID>
        Parameters:
        retainEdgeIds - whether or not to retain edge ids
        Returns:
        this graph builder
      • setRetainVertexIds

        default GraphChangeSet<VID> setRetainVertexIds​(boolean retainVertexIds)
        Description copied from interface: GraphBuilder
        Controls whether to retain the vertex ids provided in this graph builder are to be retained in the final graph. If true retain the vertex ids, if false use internally generated vertex ids of type Integer
        Specified by:
        setRetainVertexIds in interface GraphBuilder<VID>
        Parameters:
        retainVertexIds - whether or not to retain vertex ids
        Returns:
        this graph builder
      • buildNewSnapshotAsync

        PgxFuture<PgxGraph> buildNewSnapshotAsync()
        Builds a new snapshot of the graph out of this GraphChangeSet: the resulting PgxGraph is a new snapshot of the PgxGraph object this was created from.
        Returns:
        the PgxFuture to retrieve a new PgxGraph object with the same name of the original graph and the changes added into this; the new PgxGraph is a new snapshot of the original graph
        Since:
        20.0.0
      • buildNewSnapshot

        default PgxGraph buildNewSnapshot()
                                   throws java.util.concurrent.ExecutionException,
                                          java.lang.InterruptedException
        Blocking version of buildNewSnapshotAsync(). Calls buildNewSnapshotAsync() and waits for the returned PgxFuture to complete.
        Throws:
        java.lang.InterruptedException - if the caller thread gets interrupted while waiting for completion.
        java.util.concurrent.ExecutionException - if any exception occurred during asynchronous execution. The actual exception will be nested.
        Since:
        20.0.0
      • getVertexChangeType

        ChangeType getVertexChangeType​(VID id)
        Returns the ChangeType of the update for the vertex with the given ID
        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
        Since:
        22.3.0
      • getEdgeChangeType

        ChangeType getEdgeChangeType​(java.lang.Object id)
        Returns the ChangeType of the update for the edge with the given ID
        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
        Since:
        22.3.0