LinkedDataFragments / Client.js

[DEPRECATED] A JavaScript client for Triple Pattern Fragments interfaces.
http://linkeddatafragments.org/
Other
92 stars 35 forks source link

Unhandled 'error' event #43

Closed akuckartz closed 4 years ago

akuckartz commented 6 years ago

Any suggestion what might be going wrong here? I am executing

$ ldf-client http://localhost:5000/dbpedia2015 "SELECT * { ?s ?p <http://dbpedia.org/resource/Belgium>. ?s ?p ?o } LIMIT 10"

and the result is:

[[Fri Oct 20 2017 21:28:38 GMT+0200 (CEST)] WARNING ReorderingGraphPatternIterator Unexpected "<http://commons.dbpedia.org/resource/File:2009_v\\u0113l\\u0113\\u0161anas_Jelgava.png>," on line 38.
[Fri Oct 20 2017 21:28:38 GMT+0200 (CEST)] WARNING ReorderingGraphPatternIterator Unexpected "<http://commons.dbpedia.org/resource/File:2009_v\\u0113l\\u0113\\u0161anas_Jelgava.png>," on line 38.
]
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: Unexpected "<http://dbpedia.org/resource/Citro\\u00EBn_Traction_Avant>" on line 36.
    at Object._syntaxError (/usr/local/lib/node_modules/ldf-client/node_modules/n3/lib/N3Lexer.js:360:12)
    at reportSyntaxError (/usr/local/lib/node_modules/ldf-client/node_modules/n3/lib/N3Lexer.js:327:54)
    at Object._tokenizeToEnd (/usr/local/lib/node_modules/ldf-client/node_modules/n3/lib/N3Lexer.js:313:18)
    at TrigFragmentIterator._parseData (/usr/local/lib/node_modules/ldf-client/node_modules/n3/lib/N3Lexer.js:395:16)
    at TrigFragmentIterator.TurtleFragmentIterator._transform (/usr/local/lib/node_modules/ldf-client/lib/triple-pattern-fragments/TurtleFragmentIterator.js:47:8)
    at readAndTransform (/usr/local/lib/node_modules/ldf-client/node_modules/asynciterator/asynciterator.js:959:12)
    at TrigFragmentIterator.TransformIterator._read (/usr/local/lib/node_modules/ldf-client/node_modules/asynciterator/asynciterator.js:945:3)
    at TrigFragmentIterator.BufferedIterator._fillBuffer (/usr/local/lib/node_modules/ldf-client/node_modules/asynciterator/asynciterator.js:768:10)
    at Immediate.fillBufferAsyncCallback (/usr/local/lib/node_modules/ldf-client/node_modules/asynciterator/asynciterator.js:800:8)
    at runCallback (timers.js:674:20)
mielvds commented 6 years ago

The uri http://dbpedia.org/resource/Citro\\u00EBn_Traction_Avant is invalid. The error is because the server allows for invalid uris in its datasource, but the client doesn't. Fix your data in your datasource (probably HDT?) and everything will be fine

@RubenVerborgh shouldn't N3.js prevent you from serializing invalid URIs, since it doesn't parse them?

RubenVerborgh commented 6 years ago

@akuckartz My bet is that a) this interface is using an HDT backend b) with an invalid HDT file that was generated without specifying -f turtle. The default parser of HDT was broken (and has since been removed).

@mielvds The problem is that the HDT module passes invalid IRIs to the writer. The N3.js parser, which would detect this, is never involved on the server (only on the client).

akuckartz commented 6 years ago

Thanks a lot for the quick replies!

So this HDT file I mentioned in https://github.com/LinkedDataFragments/Server.js/issues/60#issuecomment-338014627 likely is broken: http://gaia.infor.uva.es/hdt/dbpedia2015.hdt.gz

akuckartz commented 6 years ago

I seem to have stumbled upon errors in the HDT file resulting from these issues (when they still existed): https://github.com/rdfhdt/hdt-cpp/issues/12 and https://github.com/rdfhdt/hdt-cpp/issues/91

I think I should ask the maintainer of http://gaia.infor.uva.es/hdt/ to recreate the file.

rubensworks commented 4 years ago

This project has now been deprecated in favor of Comunica, where this should not be a problem anymore. If it is, feel free to open a new issue there.