-
Notifications
You must be signed in to change notification settings - Fork 580
Open
Description
I'm working with JSON-LD data which uses relative URIs as identifiers (example). The identifiers may be paths (like data/results.csv) or local identifiers, which in our case usually start with # (like #alice).
I want to parse this data into a Graph, run SPARQL on it to update it, then serialize it back to JSON-LD.
If I define a base URI (say https://example.org/) and use that both when parsing and serializing the data, I expect that the output will be the same (except for the ordering of @graph). However, I find that the relative @ids are now all prefixed with /, for example:
{
"@context": "https://w3id.org/ro/crate/1.2/context",
"@graph": [
{
"@id": "/data.csv",
"@type": "File",
"name": "Rainfall data for Katoomba, NSW Australia February 2022",
"encodingFormat": "text/csv",
"license": {"@id": "https://creativecommons.org/licenses/by-nc-sa/3.0/au/"}
},
{
"@id": "/#local-identifier",
"@type": "Organization",
"name": "Blah blah",
},
...
]
}
This happens regardless of whether the base URI has a trailing slash.
Is there any way to strip off the leading slash in the relative URIs when serializing?
Metadata
Metadata
Assignees
Labels
No labels