# `Gno.Changeset.Action`
[🔗](https://github.com/rdf-elixir/gno/blob/v0.1.0/lib/gno/changeset/action.ex#L1)

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 in `Gno.EffectiveChangeset` to track implicit removals
  from `:update` and `:replace` actions

`Gno.Changeset` uses only the first four; `Gno.EffectiveChangeset` uses all five.

# `changes`

```elixir
@type changes() ::
  Gno.Changeset.t() | Gno.EffectiveChangeset.t() | RDF.Diff.t() | keyword()
```

# `t`

```elixir
@type t() :: :add | :update | :replace | :remove | :overwrite
```

# `empty?`

Checks if a changeset structure contains any changes.

# `extract`

Extracts a map of actions from the given keywords and returns it with the remaining unprocessed keywords.

# `fields`

```elixir
@spec fields() :: [atom()]
```

Returns a list of the action fields.

## Example

    iex> Gno.Changeset.Action.fields()
    [:add, :update, :replace, :remove, :overwrite]

# `is_action_map`
*macro* 

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
