Preserve literal objects when exporting unbound statements - #821
Merged
Merged
Conversation
Signed-off-by: dada-yan <BinjunYann@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.
Problem
An open statement can have a literal object without an ontology predicate. For example,
设备 A —状态→ "待复检"is stored and read byexport::facts_page, but its RDF statement has nordf:object:emit_factconstructed literal objects insidepredicate_id.map(...).Reproduced on
dev@91469dethrough the authenticated HTTP export route against PostgreSQL, as well as the serializer regression.Change
Construct the literal when
object_valueexists, using the optional predicate only to look up its datatype. Unbound values use the existing conservativexsd:stringrepresentation. Bound datatypes, entity objects, and the current-assertion gate retain their behavior. No predicate or ordinary assertion is invented for an unbound statement.Validation
Linux, Rust 1.98.1, dedicated PostgreSQL 16/pgvector container,
UTOPIA_TEST_REQUIRE_DB=1andUTOPIA_TEST_REQUIRE_PDFTOTEXT=1:cargo test --locked -p utopia-server unbound_literal_objects— both tests fail specifically on the missing object.insert_open_statement, retains its evidence, and leaves business rows, evidence, and queued jobs unchanged.cargo fmt --all --check, workspace Clippy with-D warnings, workspace tests, and workspace build pass.Scope and compatibility
Only
emit_factchanges in production. No schema, SQL, worker, alignment, or write-path change. The baseline includes #820; its relation-rule design is unaffected. Existing external exports are not rewritten and must be regenerated to recover omitted values. Other RDF omissions remain outside this fix.Combined regression verification
All five independent fixes merge cleanly onto the same dev baseline. On the combined Linux branch, format, workspace Clippy, build and the full test suite pass (952 passed, 0 failed, 1 explicitly ignored live-public-HTTPS test). A shared authenticated RDF fixture verifies unbound values, subsecond history and explicit ontology links together in Turtle and JSON-LD. Removing each fix individually makes its regression fail again; restoring all fixes returns the full suite to 952 passing tests. No database migration or historical rewrite is included.