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

JSON-LD 1.1 support #3654

Closed
VladimirAlexiev opened this issue Feb 1, 2022 · 12 comments
Closed

JSON-LD 1.1 support #3654

VladimirAlexiev opened this issue Feb 1, 2022 · 12 comments
Assignees
Labels
dependencies Pull requests that update a dependency file 📶 enhancement issue is a new feature or improvement M3 📦 rio affects the Rio RDF Parser/Writer toolkit
Milestone

Comments

@VladimirAlexiev
Copy link

VladimirAlexiev commented Feb 1, 2022

JSON-LD becomes more and more important, especially for Distributed Identifiers, Verifiable Credentials, IoT, etc.

Some initiatives are using JSON Schema to specify their JSONLD payload, which requires the ability to produce (write out) very precise JSONLD.

An examination of "JSON-LD" issues here shows a number if stalled issues and some bugs.

Some of them are due to this project (eg unable to specify context while writing/compacting), others are due to the underlying jsonld-java.

In particular, it's unclear whether jsonld-java will support 1.1. Two crucial 1.1 features are Framing and Scoped contexts.

I find jsonld-java/jsonld-java#284 (comment) especially telling. Conformance test percentages are very low .

There's a suggestion to switch to https://github.com/filip26/titanium-json-ld. Its conformance test percentages are nearly perfect https://w3c.github.io/json-ld-api/reports/#subj_Titanium_JSON_LD_Java . A guy who seems to know stuff about JSONLD recommends it w3c/vc-data-model#843 (comment).

But a later comment states that jsonld-java is significantly more performant.

Please comment:

  • is improved JSON-LD important for you, in particular providing a context in write?
  • is JSON-LD 1.1 important for you?
  • should rdf4j switch to titanium-jsonld?

Cc @jeenbroekstra @JervenBolleman @fsteeg @ansell

@VladimirAlexiev
Copy link
Author

VladimirAlexiev commented Feb 1, 2022

jsonld-java also does not have canonization (URDNA2015) jsonld-java/jsonld-java#249, which is important for crypto signing apps. Titanium has it (as an extension): https://github.com/filip26/titanium-json-ld#extensions

kbss-cvut/jb4jsonld#37 also considers switching to titanium.

@ansell
Copy link
Contributor

ansell commented Feb 1, 2022

I haven't had any bandwidth to support JSONLD-Java and the 1.1 features have not been added, so no qualms with switching to a library that has 1.1 features implemented.

@barthanssens barthanssens added dependencies Pull requests that update a dependency file 📦 rio affects the Rio RDF Parser/Writer toolkit 📶 enhancement issue is a new feature or improvement labels Feb 1, 2022
@barthanssens
Copy link
Contributor

Would it be an option to be somewhat able to switch between both ?
I.e. there could be a second rio module for the titanium json-ld library as long as they aren't included both at the same time, AND if some refactoring on the way RDF4J sets option part is done (e.g. #1755), it might provide a gentle upgrade path...

@VladimirAlexiev
Copy link
Author

VladimirAlexiev commented Feb 2, 2022

@barthanssens That's an option, as soon as the pros and cons of each alternative are clearly described.

On the topic of Parser performance (direction JSONLD->RDF):

Streaming may improve performance by significantly reducing required memory

@VladimirAlexiev
Copy link
Author

VladimirAlexiev commented Apr 7, 2022

Jena has integrated Titanium to a large degree: https://issues.apache.org/jira/browse/JENA-1948.

Update on https://github.com/umbreak/jsonld-benchmarks (great news!):

The Json-LD Java implementation is ~ 4.6 times faster in average than Titanium.
In the current state (02.04.2022), the Titanium library is 2x faster than in its initial state (03.12.2020).

@VladimirAlexiev
Copy link
Author

json-ld/yaml-ld#20 (comment) has some info on JSON-LD 1.1 conformance, including a summary table.
image

Conformance leaders: Titanium (Java), JSON::LD (Ruby), PyLD (Python), jsonld.js (JavaScript)

@VladimirAlexiev
Copy link
Author

VladimirAlexiev commented Aug 17, 2022

We need some request headers (or criteria) to decide when fetching JSON-LD data from the repo:

This goes beyond jsonld 1.1 support and back to 1.0 support:

  • the currently used library jsonld-java can use any given context (right @ansell ?)
  • but there's no way in rdf4j to ask for a specific context (right @abrokenjester ?)

@amivanoff
Copy link
Contributor

amivanoff commented Jul 19, 2023

It looks like after latest improvements in Titanium (v. 1.3.2) the Json-LD Java implementation is only ~17% faster in average than Titanium. And in one test it even outperform Json-LD by 17%

@hmottestad
Copy link
Contributor

It looks like after latest improvements in Titanium (v. 1.3.2) the Json-LD Java implementation is only ~17% faster in average than Titanium. And in one test it even outperform Json-LD by 17%

Which implementations are you comparing? And what are you comparing?

@amivanoff
Copy link
Contributor

amivanoff commented Jul 20, 2023

It looks like after latest improvements in Titanium (v. 1.3.2) the Json-LD Java implementation is only ~17% faster in average than Titanium. And in one test it even outperform Json-LD by 17%

Which implementations are you comparing? And what are you comparing?

It's the same test like in #3654 (comment)

Test https://github.com/umbreak/jsonld-benchmarks but with newer Latest titanium-jsonld 1.3.2 from March 2023 and latest JSONLD-Java 0.13.4 from December 2021.

  • In average Json-LD Java is still ~17% faster than Titanium, but not several times faster.
  • In one test Titanium outperform Json-LD by 17%

@hmottestad
Copy link
Contributor

I'm working on contributing some performance optimisations to Titanium JSON-LD. Based on my single benchmark file with 600 000 triples I've currently managed to improve JSON-LD to RDF conversion by 3x, expanding by almost 2x and flattening by 4x.

@barthanssens
Copy link
Contributor

Impressive !

hmottestad added a commit that referenced this issue Mar 14, 2024
@hmottestad hmottestad added this to the 5.0.0 milestone Mar 18, 2024
@hmottestad hmottestad added the M3 label Mar 18, 2024
@hmottestad hmottestad self-assigned this Mar 18, 2024
@hmottestad hmottestad changed the title JSON-LD 1.1 support, switch to titanium-jsonld? JSON-LD 1.1 support Mar 18, 2024
hmottestad added a commit that referenced this issue Mar 27, 2024
* GH-3654 fixes to be more compatible with existing code

* use dependency management

* fix dependency
hmottestad added a commit that referenced this issue Apr 19, 2024
hmottestad added a commit that referenced this issue Apr 19, 2024
* GH-3654 add caching in document loader

* GH-3654 update javadocs

* remove problematic test

* fix copyright

* try to fix junit issues

* try to fix junit issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file 📶 enhancement issue is a new feature or improvement M3 📦 rio affects the Rio RDF Parser/Writer toolkit
Projects
None yet
Development

No branches or pull requests

5 participants