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

can't parse Wikidata EntitySchema shex with shex-to-json #90

Open
maxlath opened this issue May 3, 2021 · 3 comments
Open

can't parse Wikidata EntitySchema shex with shex-to-json #90

maxlath opened this issue May 3, 2021 · 3 comments

Comments

@maxlath
Copy link
Contributor

maxlath commented May 3, 2021

the following command

shex-to-json  https://www.wikidata.org/wiki/Special:EntitySchemaText/E233

fails with this error:

aborting: Error: error parsing JSON https://www.wikidata.org/wiki/Special:EntitySchemaText/E233: SyntaxError: Unexpected token P in JSON at position 0
    at parseShExJ (/some/project/node_modules/shex/lib/ShExLoader.js:274:14)
    at /some/project/node_modules/shex/lib/ShExLoader.js:103:14
    at tryCatcher (/some/project/node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (/some/project/node_modules/bluebird/js/main/promise.js:510:31)
    at Promise._settlePromiseAt (/some/project/node_modules/bluebird/js/main/promise.js:584:18)
    at Promise._settlePromises (/some/project/node_modules/bluebird/js/main/promise.js:700:14)
    at Async._drainQueue (/some/project/node_modules/bluebird/js/main/async.js:123:16)
    at Async._drainQueues (/some/project/node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues (/some/project/node_modules/bluebird/js/main/async.js:15:14)
    at processImmediate (internal/timers.js:461:21)

It seems it can't parse the PREFIX keyword(?). This shex doesn't seem to be a problem for the python library. Any clue on what's wrong?

@ericprud
Copy link
Contributor

ericprud commented May 3, 2021

Did you get shex-to-json from an npm package or from github? I just tried with github and it gave me 268 lines of JSON. If your answer is npm, was it https://www.npmjs.com/package/shex or https://www.npmjs.com/package/@shexjs/cli ? (The latter is newer; I should really re-package the former.)

@maxlath
Copy link
Contributor Author

maxlath commented May 3, 2021

I got it from the shex module on npm; using @shexjs/cli fixes the problem indeed.

It comes with another (minor) issue though:

Error: Cannot find module '@shexjs/parser'
Require stack:
- /path/node_modules/@shexjs/loader/shex-loader.js
- /path/node_modules/@shexjs/cli/bin/shex-to-json

Running npm i @shexjs/parser solves that missing dependency problem

@ericprud
Copy link
Contributor

ericprud commented May 3, 2021

according to CI tests, this should be resolved in the reorg-tests branch (top-level package.json doesn't have e.g. @shexjs/parser deps). I'll keep this open until I merge into main and publish new NPMs.

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

2 participants