Remove unnecessary whitespace
This commit is contained in:
parent
b5b7fefc3d
commit
eb71b26f08
4 changed files with 36 additions and 36 deletions
|
@ -58,7 +58,7 @@ defmodule RDF.Vocabulary.Namespace do
|
|||
end
|
||||
|
||||
@base_iri unquote(base_iri)
|
||||
def __base_iri__, do: @base_iri
|
||||
def __base_iri__, do: @base_iri
|
||||
|
||||
@strict unquote(strict)
|
||||
def __strict__, do: @strict
|
||||
|
|
|
@ -17,7 +17,7 @@ defmodule RDF.SerializationTest do
|
|||
|
||||
@example_graph RDF.Graph.new [{EX.S, EX.p, EX.O}]
|
||||
@example_graph_turtle """
|
||||
@prefix : <#{to_string(EX. __base_iri__)}> .
|
||||
@prefix : <#{to_string(EX.__base_iri__)}> .
|
||||
|
||||
:S
|
||||
:p :O .
|
||||
|
@ -122,19 +122,19 @@ defmodule RDF.SerializationTest do
|
|||
describe "write_string/2" do
|
||||
test "with name of available format" do
|
||||
assert RDF.Serialization.write_string(@example_graph, format: :turtle,
|
||||
prefixes: %{"" => EX. __base_iri__}) ==
|
||||
prefixes: %{"" => EX.__base_iri__}) ==
|
||||
{:ok, @example_graph_turtle}
|
||||
end
|
||||
|
||||
test "with invalid format name" do
|
||||
assert RDF.Serialization.write_string(@example_graph, format: :foo,
|
||||
prefixes: %{"" => EX. __base_iri__}) ==
|
||||
prefixes: %{"" => EX.__base_iri__}) ==
|
||||
{:error, "unable to detect serialization format"}
|
||||
end
|
||||
|
||||
test "with media type" do
|
||||
assert RDF.Serialization.write_string(@example_graph, media_type: "text/turtle",
|
||||
prefixes: %{"" => EX. __base_iri__}) ==
|
||||
prefixes: %{"" => EX.__base_iri__}) ==
|
||||
{:ok, @example_graph_turtle}
|
||||
end
|
||||
end
|
||||
|
@ -142,20 +142,20 @@ defmodule RDF.SerializationTest do
|
|||
describe "write_string!/2" do
|
||||
test "with name of available format" do
|
||||
assert RDF.Serialization.write_string!(@example_graph, format: :turtle,
|
||||
prefixes: %{"" => EX. __base_iri__}) ==
|
||||
prefixes: %{"" => EX.__base_iri__}) ==
|
||||
@example_graph_turtle
|
||||
end
|
||||
|
||||
test "with invalid format name" do
|
||||
assert_raise RuntimeError, "unable to detect serialization format", fn ->
|
||||
RDF.Serialization.write_string!(@example_graph, format: :foo,
|
||||
prefixes: %{"" => EX. __base_iri__})
|
||||
prefixes: %{"" => EX.__base_iri__})
|
||||
end
|
||||
end
|
||||
|
||||
test "with media type" do
|
||||
assert RDF.Serialization.write_string!(@example_graph, media_type: "text/turtle",
|
||||
prefixes: %{"" => EX. __base_iri__}) ==
|
||||
prefixes: %{"" => EX.__base_iri__}) ==
|
||||
@example_graph_turtle
|
||||
end
|
||||
end
|
||||
|
@ -165,7 +165,7 @@ defmodule RDF.SerializationTest do
|
|||
file = file("write_file_test.ttl")
|
||||
if File.exists?(file), do: File.rm(file)
|
||||
assert RDF.Serialization.write_file(@example_graph, file,
|
||||
prefixes: %{"" => EX. __base_iri__}) == :ok
|
||||
prefixes: %{"" => EX.__base_iri__}) == :ok
|
||||
assert File.exists?(file)
|
||||
assert File.read!(file) == @example_graph_turtle
|
||||
File.rm(file)
|
||||
|
@ -175,7 +175,7 @@ defmodule RDF.SerializationTest do
|
|||
file = file("write_file_test.nt")
|
||||
if File.exists?(file), do: File.rm(file)
|
||||
assert RDF.Serialization.write_file(@example_graph, file, format: :turtle,
|
||||
prefixes: %{"" => EX. __base_iri__}) == :ok
|
||||
prefixes: %{"" => EX.__base_iri__}) == :ok
|
||||
assert File.exists?(file)
|
||||
assert File.read!(file) == @example_graph_turtle
|
||||
File.rm(file)
|
||||
|
@ -187,7 +187,7 @@ defmodule RDF.SerializationTest do
|
|||
file = file("write_file_test.ttl")
|
||||
if File.exists?(file), do: File.rm(file)
|
||||
assert RDF.Serialization.write_file!(@example_graph, file,
|
||||
prefixes: %{"" => EX. __base_iri__}) == :ok
|
||||
prefixes: %{"" => EX.__base_iri__}) == :ok
|
||||
assert File.exists?(file)
|
||||
assert File.read!(file) == @example_graph_turtle
|
||||
File.rm(file)
|
||||
|
@ -197,7 +197,7 @@ defmodule RDF.SerializationTest do
|
|||
file = file("write_file_test.nt")
|
||||
if File.exists?(file), do: File.rm(file)
|
||||
assert RDF.Serialization.write_file!(@example_graph, file, format: :turtle,
|
||||
prefixes: %{"" => EX. __base_iri__}) == :ok
|
||||
prefixes: %{"" => EX.__base_iri__}) == :ok
|
||||
assert File.exists?(file)
|
||||
assert File.read!(file) == @example_graph_turtle
|
||||
File.rm(file)
|
||||
|
|
|
@ -46,11 +46,11 @@ defmodule RDF.Turtle.EncoderTest do
|
|||
{EX.S1, EX.p2, EX.O3},
|
||||
{EX.S2, EX.p3, EX.O4},
|
||||
]), prefixes: %{
|
||||
ex: EX. __base_iri__,
|
||||
xsd: XSD. __base_iri__
|
||||
ex: EX.__base_iri__,
|
||||
xsd: XSD.__base_iri__
|
||||
}) ==
|
||||
"""
|
||||
@prefix ex: <#{to_string(EX. __base_iri__)}> .
|
||||
@prefix ex: <#{to_string(EX.__base_iri__)}> .
|
||||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
||||
|
||||
ex:S1
|
||||
|
@ -64,9 +64,9 @@ defmodule RDF.Turtle.EncoderTest do
|
|||
|
||||
test "statements with empty prefixed names" do
|
||||
assert Turtle.Encoder.encode!(Graph.new({EX.S, EX.p, EX.O}),
|
||||
prefixes: %{"" => EX. __base_iri__}) ==
|
||||
prefixes: %{"" => EX.__base_iri__}) ==
|
||||
"""
|
||||
@prefix : <#{to_string(EX. __base_iri__)}> .
|
||||
@prefix : <#{to_string(EX.__base_iri__)}> .
|
||||
|
||||
:S
|
||||
:p :O .
|
||||
|
@ -104,22 +104,22 @@ defmodule RDF.Turtle.EncoderTest do
|
|||
|
||||
test "ordering of descriptions" do
|
||||
assert Turtle.Encoder.encode!(Graph.new([
|
||||
{EX. __base_iri__, RDF.type, OWL.Ontology},
|
||||
{EX.__base_iri__, RDF.type, OWL.Ontology},
|
||||
{EX.S1, RDF.type, EX.O},
|
||||
{EX.S2, RDF.type, RDFS.Class},
|
||||
{EX.S3, RDF.type, RDF.Property},
|
||||
]),
|
||||
base: EX. __base_iri__,
|
||||
base: EX.__base_iri__,
|
||||
prefixes: %{
|
||||
rdf: RDF. __base_iri__,
|
||||
rdfs: RDFS. __base_iri__,
|
||||
owl: OWL. __base_iri__,
|
||||
rdf: RDF.__base_iri__,
|
||||
rdfs: RDFS.__base_iri__,
|
||||
owl: OWL.__base_iri__,
|
||||
}) ==
|
||||
"""
|
||||
@base <#{to_string(EX. __base_iri__)}> .
|
||||
@prefix rdf: <#{to_string(RDF. __base_iri__)}> .
|
||||
@prefix rdfs: <#{to_string(RDFS. __base_iri__)}> .
|
||||
@prefix owl: <#{to_string(OWL. __base_iri__)}> .
|
||||
@base <#{to_string(EX.__base_iri__)}> .
|
||||
@prefix rdf: <#{to_string(RDF.__base_iri__)}> .
|
||||
@prefix rdfs: <#{to_string(RDFS.__base_iri__)}> .
|
||||
@prefix owl: <#{to_string(OWL.__base_iri__)}> .
|
||||
|
||||
<>
|
||||
a owl:Ontology .
|
||||
|
@ -141,7 +141,7 @@ defmodule RDF.Turtle.EncoderTest do
|
|||
setup do
|
||||
{:ok,
|
||||
prefixes: %{
|
||||
RDF.iri(EX. __base_iri__) => "ex",
|
||||
RDF.iri(EX.__base_iri__) => "ex",
|
||||
~I<http://example.org/> => "ex2"
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ defmodule RDF.Turtle.EncoderTest do
|
|||
end
|
||||
|
||||
test "hash iri namespace without name", %{prefixes: prefixes} do
|
||||
assert Turtle.Encoder.prefixed_name(RDF.iri(EX. __base_iri__), prefixes) ==
|
||||
assert Turtle.Encoder.prefixed_name(RDF.iri(EX.__base_iri__), prefixes) ==
|
||||
"ex:"
|
||||
end
|
||||
|
||||
|
@ -396,9 +396,9 @@ defmodule RDF.Turtle.EncoderTest do
|
|||
# |> assert_serialization(
|
||||
# prefixes: %{
|
||||
# ex: ~I<http://example.com/>,
|
||||
# rdf: RDF.NS.RDF. __base_iri__,
|
||||
# rdfs: RDFS. __base_iri__,
|
||||
# owl: OWL. __base_iri__,
|
||||
# rdf: RDF.NS.RDF.__base_iri__,
|
||||
# rdfs: RDFS.__base_iri__,
|
||||
# owl: OWL.__base_iri__,
|
||||
# },
|
||||
# matches: [
|
||||
# {~r[ex:a\s+rdfs:domain \[\s+a owl:Class;\s+owl:unionOf\s+\(ex:b\s+ex:c\)\s*\]\s*\.],
|
||||
|
@ -419,7 +419,7 @@ defmodule RDF.Turtle.EncoderTest do
|
|||
|> RDF.rest(RDF.nil))
|
||||
|> Graph.add({EX.Baz, EX.quux, ~B<Bar>})
|
||||
|> assert_serialization(
|
||||
prefixes: %{ex: EX. __base_iri__},
|
||||
prefixes: %{ex: EX.__base_iri__},
|
||||
# TODO: provide a positive match
|
||||
neg_matches: [
|
||||
{~r[\(\s*ex:Foo\s+ex:Bar\s*\)], "does include the list as a Turtle list"}
|
||||
|
@ -491,7 +491,7 @@ defmodule RDF.Turtle.EncoderTest do
|
|||
~r[@prefix xsd: <http://www.w3.org/2001/XMLSchema#> \.],
|
||||
~r["http://foo/"\^\^xsd:anyURI \.]
|
||||
],
|
||||
prefixes: %{xsd: XSD. __base_iri__}
|
||||
prefixes: %{xsd: XSD.__base_iri__}
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -667,12 +667,12 @@ defmodule RDF.Vocabulary.NamespaceTest do
|
|||
end
|
||||
|
||||
|
||||
test " __base_iri__ returns the base_iri" do
|
||||
test "__base_iri__ returns the base_iri" do
|
||||
alias TestNS.ExampleFromGraph, as: HashVocab
|
||||
alias TestNS.ExampleFromNTriplesFile, as: SlashVocab
|
||||
|
||||
assert HashVocab. __base_iri__ == "http://example.com/from_graph#"
|
||||
assert SlashVocab. __base_iri__ == "http://example.com/from_ntriples/"
|
||||
assert HashVocab.__base_iri__ == "http://example.com/from_graph#"
|
||||
assert SlashVocab.__base_iri__ == "http://example.com/from_ntriples/"
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue