# `SPARQL.Query.Result.Format`
[🔗](https://github.com/rdf-elixir/sparql-ex/blob/v0.3.12/lib/sparql/query/result/format.ex#L1)

A behaviour for SPARQL query result formats.

A `SPARQL.Query.Result.Format` for a format can be implemented like this

    defmodule SomeFormat do
      use SPARQL.Query.Result.Format
      import RDF.Sigils

      @id         ~I<http://example.com/some_format>
      @name       :some_format
      @extension  "ext"
      @media_type "application/some-format"
    end

When `@id`, `@name`, `@extension` and `@media_type` module attributes are
defined the resp. behaviour functions are generated automatically and return
these values.

Then you'll have to do the main work by implementing a
`RDF.Serialization.Encoder` and a `RDF.Serialization.Decoder` for the format.

By default, it is assumed that these are defined in `Encoder` and `Decoder`
modules under the module of the format, i.e. in the example above in
`SomeFormat.Encoder` and `SomeFormat.Decoder`.
If you want them in another module, you'll have to override the `encoder/0`
and/or `decoder/0` functions in your `SPARQL.Query.Result.Format` module.

# `decoder`

```elixir
@callback decoder() :: module()
```

The `SPARQL.Query.Result.Format.Decoder` module for the result format.

# `encoder`

```elixir
@callback encoder() :: module()
```

The `SPARQL.Query.Result.Format.Encoder` module for the result format.

# `extension`

```elixir
@callback extension() :: binary()
```

The usual file extension for the SPARQL query result format.

# `id`

```elixir
@callback id() :: RDF.IRI.t()
```

An IRI of the SPARQL query result format.

# `media_type`

```elixir
@callback media_type() :: binary()
```

The MIME type of the SPARQL query result format.

# `name`

```elixir
@callback name() :: atom()
```

An name atom of the SPARQL query result format under which it can referenced.

# `supported_query_forms`

```elixir
@callback supported_query_forms() :: [SPARQL.Query.forms()]
```

A list of the supported query forms of the SPARQL query result format.

---

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