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

Periods in abbreviated Turtle URIs cause EOF when parsed #622

Closed
dbrnz opened this issue Jul 7, 2023 · 1 comment
Closed

Periods in abbreviated Turtle URIs cause EOF when parsed #622

dbrnz opened this issue Jul 7, 2023 · 1 comment

Comments

@dbrnz
Copy link

dbrnz commented Jul 7, 2023

The following Turtle:

@prefix : <#> .
:test.1 a <#Test> .

validates as correct using https://www.w3.org/2015/03/ShExValidata/ yet parsing it with rdflib.js produces Bad syntax: EOF found in middle of path syntax:

$rdf = require('rdflib');

const kb = $rdf.graph();

const ttl = `@prefix : <#> .
:test.1 a <#Test> .
`;

$rdf.parse(ttl, kb, 'http://example.org/test', 'text/turtle');
$ node rdftest.js
/tmp/node_modules/rdflib/lib/parse.js:111
        throw e2;
        ^

Error: SyntaxError: Line 2 of <http://example.org/test>: Bad syntax: EOF found in middle of path syntax
at: "" while trying to parse <http://example.org/test> as text/turtle
    at executeErrorCallback (/tmp/node_modules/rdflib/lib/parse.js:108:18)
    at Object.parse (/tmp/node_modules/rdflib/lib/parse.js:76:5)
    at Object.<anonymous> (/tmp/rdftest.js:9:6)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47 {
  cause: SyntaxError: Line 2 of <http://example.org/test>: Bad syntax: EOF found in middle of path syntax
  at: ""
      at BadSyntax (/tmp/node_modules/rdflib/lib/n3parser.js:1531:11)
      at SinkParser.path (/tmp/node_modules/rdflib/lib/n3parser.js:648:17)
      at SinkParser.item (/tmp/node_modules/rdflib/lib/n3parser.js:618:19)
      at SinkParser.subject (/tmp/node_modules/rdflib/lib/n3parser.js:531:19)
      at SinkParser.object (/tmp/node_modules/rdflib/lib/n3parser.js:1268:20)
      at SinkParser.statement (/tmp/node_modules/rdflib/lib/n3parser.js:518:20)
      at SinkParser.directiveOrStatement (/tmp/node_modules/rdflib/lib/n3parser.js:341:20)
      at SinkParser.feed (/tmp/node_modules/rdflib/lib/n3parser.js:324:22)
      at SinkParser.loadBuf (/tmp/node_modules/rdflib/lib/n3parser.js:303:12)
      at Object.parse (/tmp/node_modules/rdflib/lib/parse.js:42:9) {
    lineNo: 2,
    characterInFile: -1,
    syntaxProblem: 'EOF found in middle of path syntax'
  }
}

Node.js v19.8.1
@dbrnz
Copy link
Author

dbrnz commented Nov 27, 2023

Closing as this appears to be covered by #601.

@dbrnz dbrnz closed this as completed Nov 27, 2023
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

1 participant