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

Refactor the json-ld parser to not use a whole N3 library #349

Open
timbl opened this issue Sep 4, 2019 · 4 comments
Open

Refactor the json-ld parser to not use a whole N3 library #349

timbl opened this issue Sep 4, 2019 · 4 comments

Comments

@timbl
Copy link
Member

timbl commented Sep 4, 2019

Currently the way JSON-LD parser has been ported into rdflib is a horrible kludge. It parses it, puts it into a store in a separate N3.js library which is imports, then re-serializes it into something which rdflib.js could parse anyway, and then parse that into the rdflib store.

This involves a huge amount of code and a huge amount of time.

Solution is to change the code of the jsonld parser to write directly to the rdflib store.

(This may be a dup of an earlier issue but I could not find that)

@jamsden
Copy link

jamsden commented Sep 4, 2019

Should include the serializer too.

@elf-pavlik
Copy link
Contributor

Maybe parser could just implement RDF/JS Sink. Big part of RDF/JS goals relates to ease of using various implementations of parsers with various implementations of stores. Actually I see existing JSON-LD parser implementing RDF/JS Sink listed on http://rdf.js.org/

rescribet pushed a commit to rescribet/rdflib.js that referenced this issue Oct 2, 2019
rescribet pushed a commit to rescribet/rdflib.js that referenced this issue Oct 2, 2019
rescribet pushed a commit to rescribet/rdflib.js that referenced this issue Oct 15, 2019
rescribet pushed a commit to rescribet/rdflib.js that referenced this issue Oct 15, 2019
rescribet pushed a commit to rescribet/rdflib.js that referenced this issue Oct 15, 2019
rescribet pushed a commit to rescribet/rdflib.js that referenced this issue Oct 16, 2019
rescribet pushed a commit to rescribet/rdflib.js that referenced this issue Oct 17, 2019
rescribet pushed a commit to rescribet/rdflib.js that referenced this issue Oct 18, 2019
rescribet pushed a commit to rescribet/rdflib.js that referenced this issue Oct 18, 2019
rescribet pushed a commit to rescribet/rdflib.js that referenced this issue Oct 18, 2019
rescribet pushed a commit to rescribet/rdflib.js that referenced this issue Oct 18, 2019
@josephguillaume
Copy link

Looks like this change has been merged already in Oct 2019 16daad7, with some issues still remaining #408 #435 #430

I'm not sure whether the serialiser has been changed or needs to be, and it looks like an RDF/JS Sink approach has not been used, but it seems like this issue can be closed?

@josephguillaume
Copy link

It appears the serialisation works by converting to ntriples (https://github.com/linkeddata/rdflib.js/blob/master/src/serialize.ts#L72), then to quads, and finally using jsonld.fromRDF (https://github.com/linkeddata/rdflib.js/blob/master/src/convert.js#L25), but given the title here mentions the parser, perhaps optimising that process should be a new issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants