Malformed Rdf parsing

I was reading up the code which lexes and parses N-Quads to solve the issue.

What we do is that if the elements of the quad(Subject, Object, Predicate, Label) are not an IRI / Literal / Blank node we ignore them.

In all of the below mutations that John mentions here

  1. mutation{ set { <alice> <follows> <bob> quad . }}

  2. mutation{ set { <alice> <follows> <bob> quad pentagon . }}

  3. mutation{ set { <alice> <follows> <bob> quad pentagon . hexagonafterdot}}

Label is not set or even lexed because it’s not an IRI or a Blank node. Basically, any part of input which doesn’t start with <, " or ‘_’ isn’t lexed.

So even mutation { set { <alice> lol <follows> <bob> . }} would ignore the lol and set the S, O and P.

A solution here would be probably to throw an error if we see something which is not a IRI/Blank Node or a Literal. Thoughts @mrjn?

Throwing an error sounds like a good idea. Just confirm with the RDF spec that it’s the right thing to do.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.