-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Can we remove the custom escape sequences definition #180
Comments
@jeswr I thought they were the same - can you outline the differences between the escape sequences? |
The difference as far as I can tell is that N3 will error on "unecessary" escapes wheras turtle will not. A good example is the following test case ✖ query-survey-10
new grammar is more restrictive re allowed escapes
Error: Expected to throw an error when parsing.
Input: # PxButton | e | bash .euler http://www.w3.org/2001/sw/DataAccess/tests/data/survey/survey-sample.ttl http://eulersharp.sourceforge.net/2003/03swap/rdfs-rules.n3 --nope --think --query query-survey-10.n3
@prefix str: <http://www.w3.org/2000/10/swap/string#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix q: <http://www.w3.org/2004/ql#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
[]
q:select {<> q:answer (?R)};
q:where {?R ?x ?y; log:uri ?S. ?S str:matches "http://example\.org/.*"}. |
The literal in this test case is valid in turtle but invalid in N3. |
@jeswr you are right that this is not allowed in N3 (it has annoyed me on a few occasions) - but seems that both the Turtle and N3 grammar don't allow for it. Otherwise, what changes would you suggest to the grammar to allow for them? |
@jeswr (and @william-vw) —
In other words, If something else is to be understood as "The literal in this test case", I suggest you be explicit in identifying and quoting it, rather than indirectly referencing it. |
I think Turtle is silent on how to handle ECHAR-like escapes outside of the defined range for ECHAR. I think, for example |
Well, since it's not an IRI or a Blank Node, it must be a literal. In fact according to some definition (e.g., The extra escaping required within the regular expression literal is part of its interpretation as a regular expression. |
@gkellogg — You are, of course, correct. Mental shortcuts aren't always conformant with reality. My thinking was that this regex (literal) is not meant to be interpreted by anything that would consider the For me, this suggests that testing for acceptance/support of "unecessary" escaping would require a different test. |
My original comment was based testing against a turtle parser which I had incorrectly assumed was fully spec compliant. Having tested against some other implementations and looked more closely at the spec I now see that the N3 and Turtle spec are aligned on this matter. My apologies for not spending more time testing this before raising the issue. It does beg the question of why the N3 spec doesn't just defer to https://www.w3.org/TR/turtle/#sec-escapes to defined escape sequences and instead copy/pastes the definition.
@TallTed The test I have linked to is a negative test. That is; it is supposed to fail and does contain unnecessary escapes. Note; if the parser is lenient on unecessary escapes that this will be parsed as the literal |
@jeswr so can we close this issue? |
Yes - but noting the possible action item "It does beg the question of why the N3 spec doesn't just defer to https://www.w3.org/TR/turtle/#sec-escapes to defined escape sequences and instead copy/pastes the definition." |
@jeswr Good point - it would make it easier for folks to spot the differences (or not, in this case) with Turtle. Feel free to post a PR. |
As far as I can tell; the only part of this spec that is more restrictive than turtle is https://w3c.github.io/N3/spec/#escseq.
N3 was originally created to be a strict superset of Turtle; and I think it is critical that this behavior is maintained. Therefore can we not use the same escape sequence logic as Turtle?
The text was updated successfully, but these errors were encountered: