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

Configuration of a commit operation for a `Gno.Service`.

Defines the `Gno.CommitMiddleware` pipeline and handles different input changeset types.
Implements `Gno.CommitOperation.Type` to provide the standard commit workflow
executed by `Gno.Commit.Processor`:

- Initializes changesets from various input formats
- Computes effective changesets by querying current state
- Builds and executes SPARQL updates
- Handles empty changesets (configurable via `on_no_effective_changes`)
- Performs rollback on failure

## Properties

- `middlewares` - ordered list of `Gno.CommitMiddleware` instances invoked
  at each state transition
- `on_no_effective_changes` - what to do when the computed
  `Gno.EffectiveChangeset` contains no changes:
  - `"error"` (default) — return an error
  - `"skip"` — skip the transaction phase, proceed to post-commit
  - `"proceed"` — continue with an empty changeset through all phases

# `t`

```elixir
@type t() :: %Gno.CommitOperation{
  __additional_statements__: term(),
  __id__: term(),
  middlewares: term(),
  on_no_effective_changes: term()
}
```

# `build`

# `build`

Builds a commit operation with the given ID and attributes.

# `build!`

# `build!`

# `build_id`

# `from`

```elixir
@spec from(Grax.Schema.t()) :: {:ok, t()} | {:error, any()}
```

# `from!`

```elixir
@spec from!(Grax.Schema.t()) :: t()
```

# `load`

```elixir
@spec load(
  RDF.Graph.t() | RDF.Description.t(),
  RDF.IRI.coercible() | RDF.BlankNode.t(),
  opts :: keyword()
) :: {:ok, t()} | {:error, any()}
```

# `load!`

```elixir
@spec load!(
  RDF.Graph.t() | RDF.Description.t(),
  RDF.IRI.coercible() | RDF.BlankNode.t(),
  opts :: keyword()
) :: t()
```

# `new`

Creates a new commit operation with an auto-generated blank node ID.

# `new!`

# `type`

Returns the commit operation type module for the given IRI, or `nil` if not a commit operation type.

# `type?`

```elixir
@spec type?(module()) :: boolean()
```

Checks if the given `module` is a `Gno.CommitOperation.Type`.

## Example

    iex> Gno.CommitOperation.type?(Gno.CommitOperation)
    true

    iex> Gno.CommitOperation.type?(Gno.Commit)
    false

    iex> Gno.CommitOperation.type?(Gno.CommitLogger)
    false

    iex> Gno.CommitOperation.type?(NonExisting)
    false

---

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