diff --git a/lib/rdf/dataset.ex b/lib/rdf/dataset.ex index 54c5bee..db4ccf8 100644 --- a/lib/rdf/dataset.ex +++ b/lib/rdf/dataset.ex @@ -319,7 +319,7 @@ defmodule RDF.Dataset do %__MODULE__{ dataset | graphs: - if Enum.empty?(new_graph) do + if Graph.empty?(new_graph) do Map.delete(dataset.graphs, graph_name) else Map.put(dataset.graphs, graph_name, new_graph) @@ -475,7 +475,7 @@ defmodule RDF.Dataset do {{s, p, o}, popped_graph} = Graph.pop(graph) popped = - if Enum.empty?(popped_graph), + if Graph.empty?(popped_graph), do: graphs |> Map.delete(graph_name), else: graphs |> Map.put(graph_name, popped_graph) diff --git a/lib/rdf/diff.ex b/lib/rdf/diff.ex index 9676fbd..80038e7 100644 --- a/lib/rdf/diff.ex +++ b/lib/rdf/diff.ex @@ -33,7 +33,7 @@ defmodule RDF.Diff do defp coerce_graph(nil), do: Graph.new() defp coerce_graph(%Description{} = description), - do: if(Enum.empty?(description), do: Graph.new(), else: Graph.new(description)) + do: if(Description.empty?(description), do: Graph.new(), else: Graph.new(description)) defp coerce_graph(data), do: Graph.new(init: data) diff --git a/lib/rdf/graph.ex b/lib/rdf/graph.ex index dea1f54..e12c918 100644 --- a/lib/rdf/graph.ex +++ b/lib/rdf/graph.ex @@ -196,7 +196,7 @@ defmodule RDF.Graph do def add(graph, input, opts \\ []) def add(%__MODULE__{descriptions: descriptions} = graph, %Description{} = description, opts) do - if Enum.empty?(description) do + if Description.empty?(description) do graph else %__MODULE__{ @@ -430,7 +430,7 @@ defmodule RDF.Graph do %__MODULE__{ graph | descriptions: - if Enum.empty?(new_description) do + if Description.empty?(new_description) do Map.delete(descriptions, subject) else Map.put(descriptions, subject, new_description) @@ -739,7 +739,7 @@ defmodule RDF.Graph do {triple, popped_description} = Description.pop(description) popped = - if Enum.empty?(popped_description), + if Description.empty?(popped_description), do: descriptions |> Map.delete(subject), else: descriptions |> Map.put(subject, popped_description) diff --git a/lib/rdf/inspect.ex b/lib/rdf/inspect.ex index dbdb1db..2139b15 100644 --- a/lib/rdf/inspect.ex +++ b/lib/rdf/inspect.ex @@ -32,7 +32,7 @@ defimpl Inspect, for: RDF.Description do header = "#RDF.Description ">" else body = diff --git a/lib/rdf/serializations/turtle_encoder.ex b/lib/rdf/serializations/turtle_encoder.ex index b50b7af..0f25be7 100644 --- a/lib/rdf/serializations/turtle_encoder.ex +++ b/lib/rdf/serializations/turtle_encoder.ex @@ -253,7 +253,7 @@ defmodule RDF.Turtle.Encoder do defp blank_node_property_list(description, state, nesting) do indented = nesting + @indentation - if Enum.empty?(description) do + if Description.empty?(description) do "[]" else "[" <> @@ -348,7 +348,7 @@ defmodule RDF.Turtle.Encoder do defp list_subject_description(description) do description = Description.delete_predicates(description, [RDF.first(), RDF.rest()]) - if Enum.count(description.predications) == 0 do + if Description.empty?(description) do # since the Turtle grammar doesn't allow bare lists, we add a statement description |> RDF.type(RDF.List) else diff --git a/lib/rdf/star/graph.ex b/lib/rdf/star/graph.ex index 99f7967..e4c831f 100644 --- a/lib/rdf/star/graph.ex +++ b/lib/rdf/star/graph.ex @@ -73,7 +73,7 @@ defmodule RDF.Star.Graph do description_without_quoted_triples = Description.without_quoted_triple_objects(description) - if Enum.empty?(description_without_quoted_triples) do + if Description.empty?(description_without_quoted_triples) do Map.delete(descriptions, subject) else Map.put(descriptions, subject, description_without_quoted_triples)