Fix some warnings

This commit is contained in:
Marcel Otto 2017-08-11 18:33:12 +02:00
parent 6d00346dcd
commit eeffceb16d
4 changed files with 17 additions and 21 deletions

View file

@ -7,7 +7,7 @@ defmodule RDF.Serialization.ParseHelper do
def rdf_type, do: @rdf_type
def to_uri_string({:iriref, line, value}), do: value |> iri_unescape
def to_uri_string({:iriref, _line, value}), do: value |> iri_unescape
def to_uri({:iriref, line, value}) do
case URI.parse(iri_unescape(value)) do
@ -22,7 +22,7 @@ defmodule RDF.Serialization.ParseHelper do
end
end
def to_absolute_or_relative_uri({:iriref, line, value}) do
def to_absolute_or_relative_uri({:iriref, _line, value}) do
case URI.parse(iri_unescape(value)) do
uri = %URI{scheme: scheme} when not is_nil(scheme) ->
if String.ends_with?(value, "#") do

View file

@ -4,7 +4,7 @@ defmodule RDF.Turtle.Encoder do
use RDF.Serialization.Encoder
alias RDF.Turtle.Encoder.State
alias RDF.{Literal, BlankNode, Description, List}
alias RDF.{Literal, BlankNode, Description}
@indentation_char " "
@indentation 4
@ -117,7 +117,7 @@ defmodule RDF.Turtle.Encoder do
defp predications(description, state, nesting) do
description.predications
|> order_predications
|> order_predications()
|> Enum.map(&predication(&1, state, nesting))
|> Enum.join(" ;" <> newline_indent(nesting))
end

View file

@ -1,7 +1,7 @@
defmodule RDF.Turtle.Encoder.State do
@moduledoc false
alias RDF.{Literal, BlankNode, Description, List}
alias RDF.{BlankNode, Description}
def start_link(data, base, prefixes) do

View file

@ -129,8 +129,8 @@ defmodule RDF.Vocabulary.Namespace do
defmacro define_vocab_terms(terms, base_uri) do
terms
|> Stream.filter(fn
{term, true} -> valid_term?(term)
{term, original_term} -> true
{term, true} -> valid_term?(term)
{_, _} -> true
end)
|> Stream.map(fn
{term, true} -> {term, term}
@ -288,14 +288,12 @@ defmodule RDF.Vocabulary.Namespace do
def invalid_terms, do: @invalid_terms
defp validate_terms!(terms) do
aliased_terms = aliased_terms(terms)
terms
|> Enum.filter_map(
fn {term, _} ->
not term in aliased_terms and not valid_term?(term)
end,
fn {term, _} -> term end)
|> handle_invalid_terms!
with aliased_terms = aliased_terms(terms) do
for {term, _} <- terms, not term in aliased_terms and not valid_term?(term) do
term
end
|> handle_invalid_terms!
end
terms
end
@ -331,12 +329,10 @@ defmodule RDF.Vocabulary.Namespace do
end
defp detect_invalid_characters(terms) do
aliased_terms = aliased_terms(terms)
Enum.filter_map terms,
fn {term, _} ->
not term in aliased_terms and not valid_characters?(term)
end,
fn {term, _} -> term end
with aliased_terms = aliased_terms(terms) do
for {term, _} <- terms, not term in aliased_terms and not valid_characters?(term),
do: term
end
end
defp handle_invalid_characters([], _, terms), do: terms