digitalbazaar / jsonld.js

A JSON-LD Processor and API implementation in JavaScript
https://json-ld.org/
Other
1.64k stars 195 forks source link

Receive JSON-LD without context #472

Open hendrikbecker99 opened 2 years ago

hendrikbecker99 commented 2 years ago

Hi everyone,

I am currently using your parser to parse a JSON-LD document into RDF and back to JSON-LD.

Thereby I am facing the following issue:

The JSON-LD format that I receive in the end has not the same shape as it had before. I am using the flat and compact function. When using a frame, I get the exact format again.

(The first picture shows the original document and the second one the result I get after parsing back to JSON-LD)

My question is, if it is possible to get back to the original JSON-LD format WITHOUT giving a frame or the context.

I would be happy for any suggestions! JSONLD JSONLDAfter

davidlehn commented 2 years ago

It's hard to try solutions on an image. :-) Do you have a text version? And ideally the code snippet used to do the processing?

You might try setting omitGraph: true in the options to calls you are making.

hendrikbecker99 commented 2 years ago

I have uploaded the code that I used and the resulting files as well.

What I would like to do: Receive the result that is given in JSONLD_framed.txt, but without specifying a context or a frame. Is that possible in general?

CodeSnippets.txt JSONLD_before.txt JSONLD_compacted.txt JSONLD_flattened.txt JSONLD_framed.txt