RDF.ex v0.7.0 RDF.Serialization.Format behaviour View Source
A behaviour for RDF serialization formats.
A RDF.Serialization
for a format can be implemented like this
defmodule SomeFormat do
use RDF.Serialization.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
moduler under the RDF.Serialization.Format
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 RDF.Serialization.Format
module.
Link to this section Summary
Callbacks
The RDF.Serialization.Decoder
module for the serialization format.
The RDF.Serialization.Encoder
module for the serialization format.
The usual file extension for the serialization format.
An IRI of the serialization format.
The MIME type of the serialization format.
An name atom of the serialization format.
A map with the supported options of the Encoder
and Decoder
for the serialization format.
Link to this section Callbacks
The RDF.Serialization.Decoder
module for the serialization format.
The RDF.Serialization.Encoder
module for the serialization format.
The usual file extension for the serialization format.
An IRI of the serialization format.
The MIME type of the serialization format.
An name atom of the serialization format.
A map with the supported options of the Encoder
and Decoder
for the serialization format.