Repository navigation
The graph exports as RDF, with its intervals and its evidence - #320
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
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.
Closes #308. Design in 0020.
owl_import.rsread OWL in and five packs shipped inside the binary; nothing went the other way.GET /api/v1/kbs/{id}/export?format=turtle|jsonldnow streams a whole base as RDF — the vocabulary, the entities, every fact with both its clocks, the evidence behind each one, and the derivations with their premises.What a statement looks like
Real output, from a base whose only content arrived through
rememberover MCP:That one block carries the four things a REST response could not: the interval, the moment we came to believe it, the document it came from, and the sentence itself. Note what is missing —
rdf:predicate. The ontology never acceptedpreviously_managed, so no predicate is minted for it (0010); the model's wording rides as a literal where a reader can see that the vocabulary has a hole.The choices the record argues
schema:Organization. Home-grown ones are minted from their key, so the file stays readable.prov:invalidatedAtTimeis exactly our recording axis;schema:validFrom/validThroughare the world axis. Three terms have no standard spelling and get a minted one underurn:utopia:ns:— confidence, the derived flag, and the proposed predicate.valid_from_precisionmaps ontoxsd:gYear/xsd:gYearMonth/xsd:date, and "ended, date unknown" exports asutopia:endedUnknownrather than being flattened into "still true".Identity defaults to a URN and
?base=https://…/mints HTTP IRIs for a deployment that publishes at a known address. Stability over dereferenceability: two exports a year apart have to line up, and a self-hosted instance does not know its own public URL.Streaming
A base with a hundred thousand facts is exactly the base someone wants exported, and exactly the one that dies if the file is assembled in memory first. Every source is paged by id and serialised into a buffer that is drained into the response after each page. The cost is honest and stated in the module header: an error mid-file truncates it, because the headers went out long ago.
Verified
Eleven unit tests in
rdf.rsthat parse the output back rather than grepping it, since the only thing an export must guarantee is that it loads: imported IRIs survive; a live fact is both a statement and a triple; a closed interval and a retracted row are statements only; a year staysxsd:gYear; "ended, date unknown" says so; no predicate is invented; an attribute carries its datatype; a derivation names its rule and premises; evidence points back at the document and the sentence; JSON-LD and Turtle yield the same triple count; a badbaseis refused.an_export_carries_the_whole_ledger.rs, database-backed, asserts the queries do not inherit the interface's filters: the retracted fact is there, the deleted document is there, the ontology-less wording is there, the premise is there — and the merged-away entity is the one thing that is gone.End to end against a running deployment: confirmed two pending facts, exported, and got
text/turtlewithContent-Disposition: attachment; filename="general.ttl", prefixes, classes with their descriptions, statements with intervals and lineage, documents asprov:Entity; the JSON-LD form parses as twelve node objects;?base=mints HTTP IRIs;?format=n3is refused with 422.Full
utopia-storesuite (40 binaries) green against a freshly migrated database withUTOPIA_TEST_REQUIRE_DB=1, 142 server unit tests green,cargo fmt --checkandcargo clippy --all-targetsclean.Not included
A download button, a docs page, and a SPARQL endpoint — the record says why each waits.
oxrdfiois one new dependency;oxrdfandoxttlwere already in the tree for the import side.🤖 Generated with Claude Code