RDF.NTriples (RDF.ex v0.9.2) View Source
RDF.NTriples provides support for the N-Triples serialization format.
N-Triples is a line-based plain-text format for encoding an RDF graph. It is a very restricted, explicit and well-defined subset of both Turtle and Notation3 (N3).
An example of an RDF statement in N-Triples format:
<https://hex.pm/> <http://purl.org/dc/terms/title> "Hex" .
Link to this section Summary
Functions
Deserializes a graph or dataset from a file.
Deserializes a graph or dataset from a file.
Deserializes a graph or dataset from a stream.
Deserializes a graph or dataset from a stream.
Deserializes a graph or dataset from a string.
Deserializes a graph or dataset from a string.
Serializes a RDF data structure to a file.
Serializes a RDF data structure to a file.
Serializes a RDF data structure to a stream.
Serializes a RDF data structure to a string.
Serializes a RDF data structure to a string.
Link to this section Functions
Specs
read_file(Path.t(), keyword()) :: {:ok, RDF.Graph.t() | RDF.Dataset.t()} | {:error, any()}
Deserializes a graph or dataset from a file.
It returns an {:ok, data} tuple, with data being the deserialized graph or
dataset, or {:error, reason} if an error occurs.
Options
General serialization-independent options:
:stream: Allows to enable reading the data from a file directly via a stream (default:falseon this function,trueon the bang version):gzip: Allows to read directly from a gzipped file (default:false):file_mode: A list with the ElixirFile.openmodes to be used for reading (default:[:read, :utf8])
See the module documentation of the decoder for the available format-specific options, all of which can be used in this function and will be passed them through to the decoder.
Specs
read_file!(Path.t(), keyword()) :: RDF.Graph.t() | RDF.Dataset.t()
Deserializes a graph or dataset from a file.
As opposed to read_file/2, it raises an exception if an error occurs and
defaults to stream: true.
See read_file/3 for the available format-independent options.
See the module documentation of the decoder for the available format-specific options, all of which can be used in this function and will be passed them through to the decoder.
Specs
read_stream(Enumerable.t(), keyword()) :: {:ok, RDF.Graph.t() | RDF.Dataset.t()} | {:error, any()}
Deserializes a graph or dataset from a stream.
It returns an {:ok, data} tuple, with data being the deserialized graph or
dataset, or {:error, reason} if an error occurs.
See the module documentation of the decoder for the available format-specific options, all of which can be used in this function and will be passed them through to the decoder.
Specs
read_stream!(Enumerable.t(), keyword()) :: RDF.Graph.t() | RDF.Dataset.t()
Deserializes a graph or dataset from a stream.
As opposed to read_stream/2, it raises an exception if an error occurs.
See the module documentation of the decoder for the available format-specific options, all of which can be used in this function and will be passed them through to the decoder.
Specs
read_string(String.t(), keyword()) :: {:ok, RDF.Graph.t() | RDF.Dataset.t()} | {:error, any()}
Deserializes a graph or dataset from a string.
It returns an {:ok, data} tuple, with data being the deserialized graph or
dataset, or {:error, reason} if an error occurs.
See the module documentation of the decoder for the available format-specific options, all of which can be used in this function and will be passed them through to the decoder.
Specs
read_string!(String.t(), keyword()) :: RDF.Graph.t() | RDF.Dataset.t()
Deserializes a graph or dataset from a string.
As opposed to read_string/2, it raises an exception if an error occurs.
See the module documentation of the decoder for the available format-specific options, all of which can be used in this function and will be passed them through to the decoder.
Specs
write_file(RDF.Data.t(), Path.t(), keyword()) :: :ok | {:error, any()}
Serializes a RDF data structure to a file.
It returns :ok if successful or {:error, reason} if an error occurs.
Options
General serialization-independent options:
:stream: Allows to enable writing the serialized data to the file directly via a stream. Possible values::stringor:iodatafor writing to the file with a stream of strings respective IO lists,trueif you want to use streams, but don't care for the exact method orfalsefor not writing with a stream (default:falseon this function,:iodataon the bang version):gzip: Allows to write directly to a gzipped file (default:false):force: If not set totrue, an error is raised when the given file already exists (default:false):file_mode: A list with the ElixirFile.openmodes to be used for writing (default:[:write, :exclusive])
See the module documentation of the encoder for the available format-specific options, all of which can be used in this function and will be passed them through to the encoder.
Specs
write_file!(RDF.Data.t(), Path.t(), keyword()) :: :ok
Serializes a RDF data structure to a file.
As opposed to write_file/3, it raises an exception if an error occurs.
See write_file/3 for the available format-independent options.
See the module documentation of the encoder for the available format-specific options, all of which can be used in this function and will be passed them through to the encoder.
Specs
write_stream(RDF.Data.t(), keyword()) :: Enumerable.t()
Serializes a RDF data structure to a stream.
See the module documentation of the encoder for the available format-specific options, all of which can be used in this function and will be passed them through to the encoder.
Specs
write_string(RDF.Data.t(), keyword()) :: {:ok, String.t()} | {:error, any()}
Serializes a RDF data structure to a string.
It returns an {:ok, string} tuple, with string being the serialized graph or
dataset, or {:error, reason} if an error occurs.
See the module documentation of the encoder for the available format-specific options, all of which can be used in this function and will be passed them through to the encoder.
Specs
write_string!(RDF.Data.t(), keyword()) :: String.t()
Serializes a RDF data structure to a string.
As opposed to write_string/2, it raises an exception if an error occurs.
See the module documentation of the encoder for the available format-specific options, all of which can be used in this function and will be passed them through to the encoder.