RDF.Serialization.Encoder behaviour (RDF.ex v0.9.2) View Source
A behaviour for encoders of RDF data structures in a specific RDF.Serialization
format.
Link to this section Summary
Callbacks
Serializes a RDF data structure into a string.
Serializes a RDF data structure into a string.
Serializes a RDF data structure into a stream.
Link to this section Callbacks
Specs
encode(RDF.Data.t(), keyword()) :: {:ok, String.t()} | {:error, any()}
Serializes a RDF data structure into a string.
It should return an {:ok, string}
tuple, with string
being the serialized
RDF data structure, or {:error, reason}
if an error occurs.
Specs
encode!(RDF.Data.t(), keyword()) :: String.t()
Serializes a RDF data structure into a string.
As opposed to encode
, it raises an exception if an error occurs.
Note: The __using__
macro automatically provides an overridable default
implementation based on the non-bang encode
function.
Specs
stream(RDF.Data.t(), keyword()) :: Enumerable.t()
Serializes a RDF data structure into a stream.
It should return a stream emitting either strings or iodata of the
serialized RDF data structure. If both forms are supported the form
should be configurable via the :mode
option and its values :string
respective :iodata
.