Closed elf-pavlik closed 9 years ago
Seeing this error, I suspect that the string http://example.org/cartoons#Cat.c:Jerry
occurs somewhere in the input. This is incorrect, since the IRI should be delimited with angular brackets <…>
.
Can you give the exact Turtle input and expected output?
you can find exact input in the test i linked to: https://github.com/mcollina/levelgraph-n3/blob/3d3b6d64ea0b028dc9195633d6553e2920252237/test/putStream_spec.js#L6
"@prefix c: <http://example.org/cartoons#>.\n" +
"c:Tom a c:Cat.\n" +
"c:Jerry a c:Mouse;\n" +
" c:smarterThan c:Tom;\n" +
" c:place \"fantasy\".";
adding a space after c:Cat made it work again (it started to fail after only updating N3 from 0.2.3 to 0.3.4
if you like you can just
npm install && npm test
will pass testsnpm install && npm test
will fail this one testThe problem does not seem to be N3.js-related:
var N3 = require('n3');
var turtle = "@prefix c: <http://example.org/cartoons#>.\n" +
"c:Tom a c:Cat.\n" +
"c:Jerry a c:Mouse;\n" +
" c:smarterThan c:Tom;\n" +
" c:place \"fantasy\".";
new N3.Parser().parse(turtle, console.log);
works fine.
It's an issue with the levelgraph-n3 test. It does not generate the above Turtle do the parser, but rather:
@prefix c: <http://example.org/cartoons#>.c:Tom a c:Cat.c:Jerry a c:Mouse;c:smarterThan c:Tom;c:place "fantasy".
This is invalid Turtle, so the parser is correct to reject it.
The bug happens because the test accidentally removes newlines from the Turtle fragment. The following pull request fixes this: mcollina/levelgraph-n3/pull/14
BTW The reason for this is that the Turtle spec if different from earlier Turtle drafts, in that it now allows dots as part of prefixed names. Hence, without whitespace after a dot, we cannot disambiguate.
Thank you!
I tried updating levelgraph-n3 to latest version of n3.js, when running this test https://github.com/mcollina/levelgraph-n3/blob/3d3b6d64ea0b028dc9195633d6553e2920252237/test/putStream_spec.js
I started getting
Adding in test fixture a white space before . (after c:Cat) fixed those symptoms but I don't think (couldn't find in spec) that Turtle requires this white space before .