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

Triples containing Variable result in invalid turtle #383

Open
mrkvon opened this issue Apr 3, 2024 · 3 comments
Open

Triples containing Variable result in invalid turtle #383

mrkvon opened this issue Apr 3, 2024 · 3 comments

Comments

@mrkvon
Copy link

mrkvon commented Apr 3, 2024

When creating a triple with Variables in it, and then writing it as text/turtle, the outcome is invalid turtle.

const writer = new Writer({ format: 'text/turtle' })
writer.addQuad(new Quad(new Variable('a'), new NamedNode(foaf.knows), new Variable('c')))
writer.end((err, result) => {
  console.log(result)
})

This yields

?a <http://xmlns.com/foaf/0.1/knows> ?c.

which is invalid turtle.

Along the argumentation in #165, this could rather throw error or gracefully drop the triples containing Variable.

@mrkvon mrkvon changed the title Triples with Variable result in invalid turtle Triples containing Variable result in invalid turtle Apr 3, 2024
@RubenVerborgh
Copy link
Member

Working as intended (writer always expects valid input), but we can indeed accept a PR along the lines of #165 to perform optional input sanitization.

@mrkvon
Copy link
Author

mrkvon commented Apr 3, 2024

Indeed relevant only if a feature like #339 (comment) is included.

@bergos
Copy link
Member

bergos commented Apr 3, 2024

May I throw in one of my recent blog posts RDF/JS for Data Processing. Summary of the blog post: Validation is a spectrum, and what is valid RDF depends on the context. That's why I like a modular approach, and rdf-validation could be one building block. Nevertheless, if a media type is given, it's legit that a serializer validates that the output is according to the spec. But I would recommend using flags, as mentioned in #339, to control the behavior, and ideally there is no performance impact.

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

3 participants