core: graph names can be blank nodes
This commit is contained in:
parent
f586acb8b5
commit
08f276ee41
2 changed files with 7 additions and 2 deletions
|
@ -10,7 +10,7 @@ defmodule RDF.Graph do
|
||||||
|
|
||||||
@behaviour Access
|
@behaviour Access
|
||||||
|
|
||||||
alias RDF.{Description, Triple}
|
alias RDF.{Description, Triple, Quad}
|
||||||
|
|
||||||
@type t :: module
|
@type t :: module
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ defmodule RDF.Graph do
|
||||||
Creates an empty named `RDF.Graph`.
|
Creates an empty named `RDF.Graph`.
|
||||||
"""
|
"""
|
||||||
def new(name),
|
def new(name),
|
||||||
do: %RDF.Graph{name: RDF.uri(name)}
|
do: %RDF.Graph{name: Quad.convert_graph_context(name)}
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Creates a named `RDF.Graph` with an initial triple.
|
Creates a named `RDF.Graph` with an initial triple.
|
||||||
|
|
|
@ -14,6 +14,11 @@ defmodule RDF.GraphTest do
|
||||||
assert named_graph?(named_graph())
|
assert named_graph?(named_graph())
|
||||||
end
|
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
|
test "creating an empty graph with a convertible graph name" do
|
||||||
assert named_graph("http://example.com/graph/GraphName")
|
assert named_graph("http://example.com/graph/GraphName")
|
||||||
|> named_graph?(uri("http://example.com/graph/GraphName"))
|
|> named_graph?(uri("http://example.com/graph/GraphName"))
|
||||||
|
|
Loading…
Reference in a new issue