|
Is the following Turtle/N3 Long literal valid or should the quote inside it be escaped?
The Turtle specification says that you can use the \" escape inside long strings but doesn't say that you have to. Is the above literal valid or should it be encoded as follows instead?
Edit As an addition to my question is it still valid to not escape the quote if the quote occurs at the end of the literal e.g.
Or should it be the following:
I've had reports from other people that some RDF parsers don't understand this syntax despite the fact that they should since they should use a longest token (i.e. maximal munch) rule for parsing. |
|
The above literal is valid. From the spec:
Looking at lcharacter:
And in echaracter:
Character is basically everything, plus unicode escapes. So '"' is fine. It's probably clearer when you contrast
i.e. definitely not '"'. Concerning new question I think (much less certain here) the latter is correct, i.e. Also my example should work since a conforming parser should apply the longest token rule when parsing the input Surely it would never gobble up too much, all it should do is once it sees a sequence of 3 double quotes it should consume any immediatedly subsequent double quotes (since there is no valid syntax that would permit a quote to appear directly after a long literal without whitespace to separate it) I don't think it's a case that they agree I think it's a case that this is a corner case they haven't thought of and noone put in a test suite Reported it on rapper's bug tracker and Dave Beckett reckons it's been fixed in a recent version, but until I get back in the office in a couple of days time I don't have access to a suitable machine to test this on 1
Paolo reported on jena-devel. AndyS replied: "Illegal Turtle. The first 3 " in """" are the end of """-string, leaving a single " which is illegal." Hmmm ok, may still post to W3C Semantic Web list to try and get a definitive answer
showing 5 of 6
show 1 more comments
|
|
Answering my own question, seems you don't need to escape double quotes as one of the Turtle test suite tests uses an unescaped quote in a long literal. |


Hi Rob, thanks for the question (which highlights the problem). I've just send an email (http://bit.ly/brzlW8) on jena-devel about it. I think it's a real problem. Have you experienced it with a specific Turtle parser?
Just updated my answer (My money is on the latter). Good question, I'd ask the grammar geeks about it on the semweb list.