Open sharpaper opened 4 years ago
I'd be interested in this issue too. I understand it's easier to assign ids to blank nodes for serialization, but one of the upsides of JSON-LD is the nested format with JSON, which is more human-readable.
See also #52 :
How to use this from the command line with
rdfpipe
to convert from one format to another (with optional {compaction,}) could be helpfully added to README.rst.
The RDFlib maintainers are hoping to see JSON-LD 1.1 support completed soon and then for this package to me merged into the main RDFlib package as a main serializer/parser plugin.
If any of you are interested in completing JSON-LD 1.1 support in order to then take up other issues, such as this one, please let me or the rdflib-dev mailing list know. We have a couple of developers getting ready to look into this but more help will be greatly appreciated.
Is PyLD the only JSON-LD implementation with support for compaction at present? https://github.com/digitalbazaar/pyld/blob/316fbc2c9e25b3cf718b4ee189012a64b91f17e7/tests/runtests.py#L664
I don't think this issue should block the new rdflib major release which will hopefully contain a completed integrated json-ld 1.1 parser/serializer. Looking at https://rdflib.dev/ , JSON-LD [1.1] compaction (and docs for how to specify the serializer format parameter w/ the RDFlib API and the rdfpipe
CLI [#52]) would probably entail a minor version bump to e.g. 6.1.0?
I don't think this issue should block the new rdflib major release
Agreed. We discussed just bringing rdflib-jsonld into main rdflib right now but I think it sensible to prove the 1.1 support and then do that, since the support is part-way implemented already. Then we retain the Issues/PRs and commit history that added the 1.1 support here for historical record but port over all issues such as this to the main rdflib Issues tracker.
This is something I have interest in as well. Has there been any movement on supporting compact serialization of json-ld?
From https://github.com/google/yamlfmt/issues/125 ; it's called JSON-LD Framing :
reframe/compact/expand the underlying JSON-LD graph
- https://json-ld.org/playground/ has {Expanded, Compacted, Flattened, Framed,} JSON-LD 'compactions'(?)
- Compact serialization RDFLib/rdflib-jsonld#93
- https://www.w3.org/TR/json-ld11-framing/#framing-0
The following sections describe algorithms for framing JSON-LD documents. Framing is the process of taking a JSON-LD document, which expresses a graph of information, and applying a specific graph layout (called a Frame).
Is
g.serialize()
supposed to produce a compacted jsonld document? If I have this graph[node_a]->knows->[blank_node]
, when I retrievenode_a
with rdflib and then serialize with rdflib-jsonld, I obtain this documentwhereas I would expect this
Am I doing something wrong?