Closed avillar closed 2 months ago
Thanks @avillar This looks good. This will make it into the upcoming v7.1.0 release.
Quick question, is it common to have URN identifiers in JSON-LD? I've never seen it before personally. Is it even part of the JSON-LD spec?
I do however see the need for this fix in RDFLib, because we support URNs in all other serializations, and we need to be able to round-trip conversions to JSON-LD and back again, so we need to ensure URNs are preserved in the serialization.
I'm not sure how common they are "in the wild", but the JSON-LD spec specifically notes that IRIs are not limited to URLs, using an example of a UUID URN. In any case, as you mention, as JSON-LD is a concrete RDF syntax, so support for IRIs (including URNs) is desirable.
In our case, we use them for plain JSON + JSON-LD context = RDF conversions that we the run through a SHACL validator, so they're useful for identifying the focus nodes while signaling to the user that we're not talking about resolvable resources.
In our case, we use them for plain JSON + JSON-LD context = RDF conversions that we the run through a SHACL validator, so they're useful for identifying the focus nodes while signaling to the user that we're not talking about resolvable resources.
Nice example use case, thanks!
Summary of changes
Improve handling of URNs in JSON-LD's
norm_url
. This mainly makes it possible to use URNs in@base
.Checklist