Skip to content
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 and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set a @base before json-ld -> rdf nquads #5

Closed
cboettig opened this issue Dec 13, 2017 · 1 comment
Closed

Set a @base before json-ld -> rdf nquads #5

cboettig opened this issue Dec 13, 2017 · 1 comment

Comments

@cboettig
Copy link
Member

Otherwise jsonld::jsonld_to_rdf will drop triples if the id is not a URI. Setting a @base to the document URL / document path is the standard behavior (e.g. in json-ld.org/playground, or python rdflib), see ropensci/jsonld#9.

Not obvious what this base should be. One option is the anonymous id "@base": "_:", which will replace the local ids with ids like JSON-LD does for anonymous objects (elements that didn't declare an @id), i.e. _:b0, _:b1, etc. This destroys the original string used as the id, which semantically shouldn't matter but is probably not nice all the same.

Other libraries just set the base to the file path, i.e. "@base": "some:url/or/local/path", which seems a bit arbitrary, particularly when it's exposing full user paths in the data somewhat surreptitiously. Maybe a default like "@base": "doc:" would be best.

cboettig added a commit that referenced this issue Feb 15, 2018
Much much faster (and simpler) than manual expansion with `@base`.  Follow-up on #5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant