A changeset containing only the minimal changes needed to achieve the desired state.
Unlike Gno.Changeset, an effective changeset is computed by querying the
current repository state. Statements that already exist are removed from
:add/:update/:replace, and statements that don't exist are removed
from :remove.
The :overwrite Field
When :update or :replace actions take effect, existing statements are
implicitly removed. The :overwrite field makes these removals explicit:
:updateoverwrites at property level: existing values for the same subject+predicate combinations are captured as overwrites:replaceoverwrites at subject level: all existing statements about the same subjects are captured as overwrites
This tracking enables reliable inversion via invert/1 - without knowing
what was overwritten, the original state cannot be reconstructed.
Summary
Functions
Returns a combined graph of all statements that will be deleted by the changeset.
Creates the empty changeset.
Returns if the given changeset is empty.
Extracts a Gno.EffectiveChangeset from the given keywords and returns it with the remaining unprocessed keywords.
Deserializes an effective changeset from an RDF.Dataset.
Returns a combined graph of all statements that will be inserted by the changeset.
Inverts the changeset.
Limits the changeset to the given scope.
Merge the changes of a list of Gno.EffectiveChangesets into one.
Merge the changes of two Gno.EffectiveChangesets into one.
Creates a new valid changeset.
Creates a new valid changeset.
Serializes the effective changeset to an RDF.Dataset.
Validates the given changeset structure.
Types
@type t() :: %Gno.EffectiveChangeset{ add: RDF.Graph.t() | nil, overwrite: RDF.Graph.t() | nil, remove: RDF.Graph.t() | nil, replace: RDF.Graph.t() | nil, update: RDF.Graph.t() | nil }
Functions
Returns a combined graph of all statements that will be deleted by the changeset.
@spec empty() :: t()
Creates the empty changeset.
Returns if the given changeset is empty.
Extracts a Gno.EffectiveChangeset from the given keywords and returns it with the remaining unprocessed keywords.
Deserializes an effective changeset from an RDF.Dataset.
Returns a combined graph of all statements that will be inserted by the changeset.
Inverts the changeset.
Limits the changeset to the given scope.
The scope can be one of :dataset, or :resource.
For :resource the scope can be given as a list of resources.
Merge the changes of a list of Gno.EffectiveChangesets into one.
Warning
This function can be used to collapse the changes of multiple consecutive
EffectiveChangesets from a changeset sequence into one and relies on the fact that these
consist of complete effective changes incl. overwrites, which might lead to surprising
results and limits its general applicability. E.g. a single merged replace does not
remove the statements with only matching subjects from the other actions, but only
the fully matching statements, since we rely on the fact that a complete EffectiveChangeset
includes also the overwrites of these statements, leading to the removals of
these statements during the merge.
Merge the changes of two Gno.EffectiveChangesets into one.
Warning
This function can be used to collapse the changes of multiple consecutive
EffectiveChangesets from a changeset sequence into one and relies on the fact that these
consist of complete effective changes incl. overwrites, which might lead to surprising
results and limits its general applicability. E.g. a single merged replace does not
remove the statements with only matching subjects from the other actions, but only
the fully matching statements, since we rely on the fact that a complete EffectiveChangeset
includes also the overwrites of these statements, leading to the removals of
these statements during the merge.
@spec new(Gno.Changeset.Action.changes(), opts :: keyword()) :: {:ok, t()} | {:error, any()}
Creates a new valid changeset.
@spec new!(Gno.Changeset.Action.changes(), opts :: keyword()) :: t()
Creates a new valid changeset.
As opposed to new/1 this function fails in error cases.
Serializes the effective changeset to an RDF.Dataset.
Validates the given changeset structure.
If valid, the given structure is returned unchanged in an :ok tuple.
Otherwise, an :error tuple is returned.