core: allow blank nodes as predicates
since JSON-LD supports them when producing generalized RDF
This commit is contained in:
parent
425546349d
commit
e09714158c
1 changed files with 4 additions and 0 deletions
|
@ -61,6 +61,10 @@ defmodule RDF.Triple do
|
|||
@doc false
|
||||
def convert_predicate(uri)
|
||||
def convert_predicate(uri = %URI{}), do: uri
|
||||
# Note: Although, RDF does not allow blank nodes for properties, JSON-LD allows
|
||||
# them, by introducing the notion of "generalized RDF".
|
||||
# TODO: Support an option `:strict_rdf` to explicitly disallow them or produce warnings or ...
|
||||
def convert_predicate(bnode = %BlankNode{}), do: bnode
|
||||
def convert_predicate(uri) when is_atom(uri) or is_binary(uri), do: RDF.uri(uri)
|
||||
def convert_predicate(arg), do: raise RDF.Triple.InvalidPredicateError, predicate: arg
|
||||
|
||||
|
|
Loading…
Reference in a new issue