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

Generate relative parents when writing with baseIRI. #512

Open
ajuvercr opened this issue Mar 27, 2025 · 1 comment · May be fixed by #513
Open

Generate relative parents when writing with baseIRI. #512

ajuvercr opened this issue Mar 27, 2025 · 1 comment · May be fixed by #513

Comments

@ajuvercr
Copy link

When supplying a baseIRI, the Writer might want follow the same algorithm as path.relative to also allow for relative parent IRIs.

  const baseIRI = "https://example.com/ns/1/2/3/";
  const parser = new Parser({ baseIRI });

  const input = "<a> <../../b> <../..>.";
  const turtle = parser.parse(input);

  const writer = new Writer({ baseIRI });

  writer.addQuads(turtle);
  const txt = await new Promise((res) => writer.end((_, e) => res(e)));
  console.log("Expected\n" + input);
  console.log("Got\n" + txt);
Expected
<a> <../../b> <../..>.
Got
<a> <https://example.com/ns/1/b> <https://example.com/ns/1/>.

Is this feature on the roadmap or should I stick with regexing the resulting output?

@jeswr
Copy link
Collaborator

jeswr commented Mar 27, 2025

There are no plans to implement this at present, but I think a PR that adds this as an opt-in feature would be accepted - so long as there are no associated performance degradations.

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

Successfully merging a pull request may close this issue.

2 participants