Upgrade to RDF.ex 0.9

This commit is contained in:
Marcel Otto 2020-10-13 16:27:56 +02:00
parent efd5d36567
commit 6563326079
4 changed files with 17 additions and 8 deletions

View File

@ -45,9 +45,7 @@ defmodule JSON.LD.Decoder do
property == "@type" ->
Graph.add(
rdf_graph,
node_to_rdf(subject),
NS.RDF.type(),
Enum.map(values, &node_to_rdf/1)
{node_to_rdf(subject), NS.RDF.type(), Enum.map(values, &node_to_rdf/1)}
)
JSON.LD.keyword?(property) ->
@ -91,7 +89,7 @@ defmodule JSON.LD.Decoder do
dataset
else
graph_name = if graph_name == "@default", do: nil, else: graph_name
Dataset.add(dataset, rdf_graph, graph_name)
Dataset.add(dataset, rdf_graph, graph: graph_name)
end
else
dataset

View File

@ -63,7 +63,7 @@ defmodule JSON.LD.Mixfile do
defp deps do
[
{:rdf, "~> 0.8"},
{:rdf, "~> 0.9"},
{:jason, "~> 1.2"},
{:httpoison, "~> 1.7"},
{:dialyxir, "~> 1.0", only: :dev, runtime: false},

View File

@ -26,7 +26,7 @@
"plug_crypto": {:hex, :plug_crypto, "1.1.2", "bdd187572cc26dbd95b87136290425f2b580a116d3fb1f564216918c9730d227", [:mix], [], "hexpm", "6b8b608f895b6ffcfad49c37c7883e8df98ae19c6a28113b02aa1e9c5b22d6b5"},
"protocol_ex": {:hex, :protocol_ex, "0.4.3", "4acbe35da85109dc40315c1139bb7a65ebc7fc102d384cd8b3038384fbb9b282", [:mix], [], "hexpm", "6ca5ddb3505c9c86f17cd3f19838b34bf89966ae17078f79f81983b6a4391fe9"},
"ranch": {:hex, :ranch, "1.7.1", "6b1fab51b49196860b733a49c07604465a47bdb78aa10c1c16a3d199f7f8c881", [:rebar3], [], "hexpm", "451d8527787df716d99dc36162fca05934915db0b6141bbdac2ea8d3c7afc7d7"},
"rdf": {:hex, :rdf, "0.8.1", "df47fa9775cad307ab0fbcf528a78ea0c092ac78d53ca7809ad5b66e10e40b7c", [:mix], [{:decimal, "~> 1.5", [hex: :decimal, repo: "hexpm", optional: false]}, {:protocol_ex, "~> 0.4", [hex: :protocol_ex, repo: "hexpm", optional: false]}], "hexpm", "48ae2875aac76fd0c9e88fd21471b0fa70efe6d391e4041d843ea3af4d56ec13"},
"rdf": {:hex, :rdf, "0.9.0", "830e8966f85395a62ae6599e550f1b99fe0e6fef7ef5df5687f4a0471e3d5365", [:mix], [{:decimal, "~> 1.5", [hex: :decimal, repo: "hexpm", optional: false]}, {:protocol_ex, "~> 0.4", [hex: :protocol_ex, repo: "hexpm", optional: false]}], "hexpm", "ad9feea3ea4e71fb1354ed4d3f3ae7ae8634087959115ccc27c0eca790701022"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
"telemetry": {:hex, :telemetry, "0.4.1", "ae2718484892448a24470e6aa341bc847c3277bfb8d4e9289f7474d752c09c7f", [:rebar3], [], "hexpm", "4738382e36a0a9a2b6e25d67c960e40e1a2c95560b9f936d8e29de8cd858480f"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.5.0", "8516502659002cec19e244ebd90d312183064be95025a319a6c7e89f4bccd65b", [:rebar3], [], "hexpm", "d48d002e15f5cc105a696cf2f1bbb3fc72b4b770a184d8420c8db20da2674b38"},

View File

@ -22,8 +22,19 @@ defmodule JSON.LD.EncoderTest do
def gets_serialized_to(input, output, opts \\ []) do
data_structs = Keyword.get(opts, :data_structs, [Dataset, Graph])
Enum.each(data_structs, fn data_struct ->
assert JSON.LD.Encoder.from_rdf!(data_struct.new(input), opts) == output
Enum.each(data_structs, fn
RDF.Description ->
subject =
case input do
{subject, _, _} -> subject
[{subject, _, _} | _] -> subject
end
assert JSON.LD.Encoder.from_rdf!(RDF.Description.new(subject, init: input), opts) ==
output
data_struct ->
assert JSON.LD.Encoder.from_rdf!(data_struct.new(input), opts) == output
end)
end