diff --git a/lib/rdf/graph.ex b/lib/rdf/graph.ex index 5a34689..0945122 100644 --- a/lib/rdf/graph.ex +++ b/lib/rdf/graph.ex @@ -10,7 +10,7 @@ defmodule RDF.Graph do @behaviour Access - alias RDF.{Description, Triple} + alias RDF.{Description, Triple, Quad} @type t :: module @@ -54,7 +54,7 @@ defmodule RDF.Graph do Creates an empty named `RDF.Graph`. """ def new(name), - do: %RDF.Graph{name: RDF.uri(name)} + do: %RDF.Graph{name: Quad.convert_graph_context(name)} @doc """ Creates a named `RDF.Graph` with an initial triple. diff --git a/test/unit/graph_test.exs b/test/unit/graph_test.exs index 3dbae61..96e20f2 100644 --- a/test/unit/graph_test.exs +++ b/test/unit/graph_test.exs @@ -14,6 +14,11 @@ defmodule RDF.GraphTest do assert named_graph?(named_graph()) end + test "creating an empty graph with a blank node as graph name" do + assert named_graph(bnode("graph_name")) + |> named_graph?(bnode("graph_name")) + end + test "creating an empty graph with a convertible graph name" do assert named_graph("http://example.com/graph/GraphName") |> named_graph?(uri("http://example.com/graph/GraphName"))