jsonld - Improve handling of URNs in norm_url by avillar · Pull Request #2892 · RDFLib/rdflib (original) (raw)
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation4 Commits3 Checks20 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
Summary of changes
Improve handling of URNs in JSON-LD's norm_url
. This mainly makes it possible to use URNs in @base
.
Checklist
- Checked that there aren't other open pull requests for
the same change. - Checked that all tests and type checking passes.
- Considered granting push permissions to the PR branch,
so maintainers can fix minor issues and keep your PR up to date.
coverage: 90.609% (+0.004%) from 90.605%
when pulling 636a193 on avillar:fix-norm_url-urn
into cb5d058 on RDFLib:main.
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!