kianschmalenbach / rdf-browser

A Firefox Add-on that requests RDF files and renders RDF files as Turtle documents with clickable links
MIT License
17 stars 6 forks source link

Add-On takes an eternity to fail to parse thing descriptions #27

Open MattesWhite opened 3 years ago

MattesWhite commented 3 years ago

When parsing a resource containing a W3C Thing Description (TD) the RDF browser add-on takes an eternity to parse which blocks the whole browser and all tabs and finally fails with, e.g.:

RDF Browser: Error

The RDF-document at https://solid.ti.rw.fau.de/public/2021/test-td.jsonld could not be displayed properly.

The reason is displayed below:

TypeError: scopedContext[key]['@context'] is undefined

BTW you can check if things work by requesting from https://solid.ti.rw.fau.de/public/2021/test-td.jsonld .

I think the problem is that TDs use a predefined JSON-LD context: https://www.w3.org/2019/wot/td/v1 This context is rather complex and causes there probably the long time to compile.

I don't know if you can do something about this...

BTW the JSON-LD playground parses the contents of the file correctly: permalink

aharth commented 3 years ago

Any chance to get that issue investigated?

Maybe we need to file a bug in the JSON-LD parsing library?

aharth commented 3 years ago

Looking up the referenced context https://www.w3.org/2019/wot/td/v1 brings down the browser...

kianschmalenbach commented 3 years ago

This behavior occurs because the jsonld-streaming-parser fails at parsing the referenced context https://www.w3.org/2019/wot/td/v1.

I tried using jsonld.js instead, as @MattesWhite mentioned that this library can parse the respective context without problems. However, this did not succeed due to two reasons:

Since the jsonld-streaming-parser library used by RDF browser seems to provide a widely-used and standard-compliant JSON-LD parser and with respect to the problems mentioned above, I do not think that replacing the parsing library for JSON-LD is a suitable solution to this problem. Probably, a bug report in the jsonld-streaming-parser library could make sense.