You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use a spec-compliant JSON-LD processor to read/write Croissant files
#1059
mlcroissant does not process JSON-LD with the standard algorithms and relies on custom code around rdflib.
We are extending Croissant with other vocabularies, and we keep running into issues because mlcroissant rejects or fails to read some valid JSON-LD documents:
The @context is only partly taken into account
Some valid @context forms are rejected, e.g. a list of contexts or a remote context.
Nodes that reference each other crash the parser
Writing back with to_json does not follow standard JSON-LD compaction
The internal base IRI is not absolute, so compliant processors reject it.
Some of these have already been reported in #566, #884, #950, #904.
The list is probably not exhaustive: as long as the processing differs from the JSON-LD spec, it's hard to anticipate what will break next.
Croissant metadata is encoded in JSON-LD and relies on JSON-LD 1.1 features (@json, @container: @language, @base), and the spec states that "any Croissant-compliant tool will have an identical interpretation of the data".
pyld is pure Python and would only bring cachetools, frozendict and lxml as new dependencies.
Would that be acceptable? mlcroissant could then delegate JSON-LD processing to a maintained, spec-compliant implementation and benefit from its error handling and bug fixes. It would focus on mapping the expanded JSON-LD to its dataclasses and validating the shape of the metadata.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hello,
mlcroissant does not process JSON-LD with the standard algorithms and relies on custom code around rdflib.
We are extending Croissant with other vocabularies, and we keep running into issues because mlcroissant rejects or fails to read some valid JSON-LD documents:
@contextis only partly taken into account@contextforms are rejected, e.g. a list of contexts or a remote context.to_jsondoes not follow standard JSON-LD compactionSome of these have already been reported in #566, #884, #950, #904.
The list is probably not exhaustive: as long as the processing differs from the JSON-LD spec, it's hard to anticipate what will break next.
Croissant metadata is encoded in JSON-LD and relies on JSON-LD 1.1 features (
@json,@container: @language,@base), and the spec states that "any Croissant-compliant tool will have an identical interpretation of the data".What about using a spec-compliant JSON-LD 1.1 processor such as pyld (https://github.com/digitalbazaar/pyld) for both reading and writing?
pyld is pure Python and would only bring
cachetools,frozendictandlxmlas new dependencies.Would that be acceptable? mlcroissant could then delegate JSON-LD processing to a maintained, spec-compliant implementation and benefit from its error handling and bug fixes. It would focus on mapping the expanded JSON-LD to its dataclasses and validating the shape of the metadata.
Happy to contribute to a plan and the PRs
All reactions