RDF.ex v0.3.1 RDF.Serialization 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
import RDF.Sigils
@id ~I<http://example.com/some_format>
@extension "ext"
@content_type "application/some-format"
end
When @id, @extension and @content_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 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 module.
Link to this section Summary
Callbacks
The MIME type of the serialization format
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
A map with the supported options of the Encoder and Decoder for the serialization format
Link to this section Callbacks
The MIME type of the serialization format.
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.
A map with the supported options of the Encoder and Decoder for the serialization format.