From 54d9eff0147b63ec75c0592fcdbb0396463d2854 Mon Sep 17 00:00:00 2001 From: Marcel Otto Date: Thu, 8 Mar 2018 17:33:20 +0100 Subject: [PATCH] Move RDF.Reader and RDF.Writer into RDF.Serialization module --- CHANGELOG.md | 5 +++-- lib/rdf/serialization/format.ex | 16 ++++++++-------- lib/rdf/{ => serialization}/reader.ex | 6 +++--- lib/rdf/{ => serialization}/writer.ex | 6 +++--- 4 files changed, 17 insertions(+), 16 deletions(-) rename lib/rdf/{ => serialization}/reader.ex (86%) rename lib/rdf/{ => serialization}/writer.ex (89%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27036ad..121d3e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,10 @@ This project adheres to [Semantic Versioning](http://semver.org/) and ### Changed -- rename `RDF.Serialization` behaviour to `RDF.Serialization.Format`; the new +- renamed `RDF.Serialization` behaviour to `RDF.Serialization.Format`; the new `RDF.Serialization` module contains just simple RDF serialization related functions -- rename `RDF.Serialization.Format.content_type/0` to `RDF.Serialization.Format.media_type/0` +- renamed `RDF.Serialization.Format.content_type/0` to `RDF.Serialization.Format.media_type/0` +- moved `RDF.Reader` and `RDF.Writer` into `RDF.Serialization` module ### Added diff --git a/lib/rdf/serialization/format.ex b/lib/rdf/serialization/format.ex index 41c4d76..5abe639 100644 --- a/lib/rdf/serialization/format.ex +++ b/lib/rdf/serialization/format.ex @@ -79,22 +79,22 @@ defmodule RDF.Serialization.Format do defoverridable [decoder: 0, encoder: 0, options: 0] def read_string(content, opts \\ []), - do: RDF.Reader.read_string(decoder(), content, opts) + do: RDF.Serialization.Reader.read_string(decoder(), content, opts) def read_string!(content, opts \\ []), - do: RDF.Reader.read_string!(decoder(), content, opts) + do: RDF.Serialization.Reader.read_string!(decoder(), content, opts) def read_file(file, opts \\ []), - do: RDF.Reader.read_file(decoder(), file, opts) + do: RDF.Serialization.Reader.read_file(decoder(), file, opts) def read_file!(file, opts \\ []), - do: RDF.Reader.read_file!(decoder(), file, opts) + do: RDF.Serialization.Reader.read_file!(decoder(), file, opts) def write_string(data, opts \\ []), - do: RDF.Writer.write_string(encoder(), data, opts) + do: RDF.Serialization.Writer.write_string(encoder(), data, opts) def write_string!(data, opts \\ []), - do: RDF.Writer.write_string!(encoder(), data, opts) + do: RDF.Serialization.Writer.write_string!(encoder(), data, opts) def write_file(data, path, opts \\ []), - do: RDF.Writer.write_file(encoder(), data, path, opts) + do: RDF.Serialization.Writer.write_file(encoder(), data, path, opts) def write_file!(data, path, opts \\ []), - do: RDF.Writer.write_file!(encoder(), data, path, opts) + do: RDF.Serialization.Writer.write_file!(encoder(), data, path, opts) @before_compile unquote(__MODULE__) end diff --git a/lib/rdf/reader.ex b/lib/rdf/serialization/reader.ex similarity index 86% rename from lib/rdf/reader.ex rename to lib/rdf/serialization/reader.ex index 0d68fc7..d07baf5 100644 --- a/lib/rdf/reader.ex +++ b/lib/rdf/serialization/reader.ex @@ -1,9 +1,9 @@ -defmodule RDF.Reader do +defmodule RDF.Serialization.Reader do @moduledoc """ - General serialization-independent functions for reading a `RDF.Graph` or `RDF.Dataset` from a file or encoded-string. + General functions for reading a `RDF.Graph` or `RDF.Dataset` from a serialization file or encoded-string. You probably won't use these functions directly, but instead use the automatically - generated functions with same name on a `RDF.Serialization`, which implicitly + generated functions with same name on a `RDF.Serialization.Format`, which implicitly use the proper `RDF.Serialization.Decoder` module. """ diff --git a/lib/rdf/writer.ex b/lib/rdf/serialization/writer.ex similarity index 89% rename from lib/rdf/writer.ex rename to lib/rdf/serialization/writer.ex index d6f6b92..cd5ce03 100644 --- a/lib/rdf/writer.ex +++ b/lib/rdf/serialization/writer.ex @@ -1,9 +1,9 @@ -defmodule RDF.Writer do +defmodule RDF.Serialization.Writer do @moduledoc """ - General serialization-independent functions for writing the statements of a `RDF.Graph` or `RDF.Dataset` to a file or string. + General functions for writing the statements of a `RDF.Graph` or `RDF.Dataset` to a serialization file or string. You probably won't use these functions directly, but instead use the automatically - generated functions with same name on a `RDF.Serialization`, which implicitly + generated functions with same name on a `RDF.Serialization.Format`, which implicitly use the proper `RDF.Serialization.Encoder` module. """