Add HDT read/write serialization support#55
Open
sihingkk wants to merge 2 commits into
Open
Conversation
Please do this without a temporary file/in-memory, so we don't need a 2x memory/disk space for |
Read uses the hdt crate's dictionary iteration mapped into oxrdf quads, with literals parsed via oxrdf Literal::from_str. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
fixes #52 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds HDT (Header Dictionary Triples) as a supported format for
Model.read()andModel.write(), using the hdt crate.What's included
m.read("file.hdt")(format inferred from the.hdtextension, or passformat="hdt"). Implemented by iterating the HDT dictionary and mapping into oxrdf terms; literals are parsed via oxrdf's N-Triples-style lexical forms, matching the hdt crate's conventions.m.write("file.hdt", format="hdt"). The HDT four-section dictionary and triple bitmaps are built directly in memory and written straight to the output — no temporary file or intermediate N-Triples serialization. Literals with special characters are stored N-Triples-escaped, following the hdt crate's conventions.reads()/writes()reject"hdt"with a clear error since it is a binary format.py_maplib/tests/test_hdt.pycovering round-trips of IRIs, blank nodes, plain/typed/language-tagged literals, special characters, format inference, multi-graph behavior, and the error paths.Notes and limitations
Cargo.lockgrows by the hdt crate's dependency tree.All py_maplib tests pass (384 passed, 2 skipped).