`termFromId` and `termToId` do not roundtrip on quoted literals
jeswr opened this issue · 3 comments
As demonstrated by this failing test doing a round-trip of termFromId
and termToId
causes Literal TermTypes to become NamedNode
term types because the internal id without literals gets used in
Line 236 in 520054a
termFromId
interprets it as a namedNode because it does not contain quotes.
We need to either (a) add quotes to literals missing them when Literal
s are created, or (b) remove
Line 236 in 520054a
Note that NamedNodes
can also become literals if we create a NamedNode
of the form new NamedNode('"s"')
I think the problem is in the test: new Literal('abc')
is not meaningful, because the (internal) Literal
constructor (which is the Term
constructor) requires a correct id
as argument. This can also be seen here: main...jeswr:N3.js:bug/literal-roundtrip-failure#diff-8dc308ca806460d3608d347268016fb538008d8f9926902f331cc3553ababbfaR228
Note that this differs from the exported literal
function (with which the test would succeed):
Lines 339 to 342 in 520054a
because the (internal) Literal constructor
These constructors are actually exported (c.f.
Lines 38 to 39 in 520054a
Good idea, following up in #313