data-model-spec
data-model-spec copied to clipboard
Add optional direction for literals
As mentioned in #172, RDF 1.2 is scheduled to introduce the base direction concept for literals.
This PR proposes a backwards-compatible addition to the data model spec to handle this addition in RDF.
The literal interface change is quite straightforward, I don't expect much discussion on this.
The data factory on the other hand might deserve some discussion. I went for extending the types of the second optional argument of the literal()
method. An alternative might have been to add a third optional argument, but I didn't go for that in this PR due to the possibility of defining a direction in combination with a datatype (which is illegal according to the RDF 1.2 spec).
Can we define that direction must be falsy instead of undefined for other kinds of literals? That would allow aligning direction to language with an empty string and still be backward compatible.
Yes, agreed, that makes sense :-)