Defines the action types and shared utilities for Gno.Changeset and Gno.EffectiveChangeset.
The five action types are:
:add— insert new statements:update— add statements, overwriting at property level (subject+predicate):replace— add statements, overwriting at subject level:remove— delete statements:overwrite— only used inGno.EffectiveChangesetto track implicit removals from:updateand:replaceactions
Gno.Changeset uses only the first four; Gno.EffectiveChangeset uses all five.
Summary
Functions
Checks if a changeset structure contains any changes.
Extracts a map of actions from the given keywords and returns it with the remaining unprocessed keywords.
Returns a list of the action fields.
Returns true if map contains at least on action field; otherwise returns false.
Types
@type changes() :: Gno.Changeset.t() | Gno.EffectiveChangeset.t() | RDF.Diff.t() | keyword()
@type t() :: :add | :update | :replace | :remove | :overwrite
Functions
Checks if a changeset structure contains any changes.
Extracts a map of actions from the given keywords and returns it with the remaining unprocessed keywords.
@spec fields() :: [atom()]
Returns a list of the action fields.
Example
iex> Gno.Changeset.Action.fields()
[:add, :update, :replace, :remove, :overwrite]
Returns true if map contains at least on action field; otherwise returns false.
Note, that a single :overwrite doesn't count.
Example
iex> is_action_map(:add)
false
iex> is_action_map(%{foo: []})
false
iex> is_action_map(%{add: []})
true
iex> is_action_map(%{remove: [], replace: []})
true
iex> is_action_map(%{overwrite: []})
false
iex> is_action_map(%Gno.Changeset{})
true