Repository navigation
refactor: extract GEXF export from the Apotheosis facade (closes #18) - #25
danielhuici merged 4 commits into
Conversation
…rseame#18) draw(), add_attribute_schema() and save_gexf() move unchanged to a new export::gexf module that consumes the facade through its public API.
37b208b to
0ae7858
Compare
|
|
||
| // Once draw is built, we need to add the attribute schema to the GEXF XML | ||
| // Has to be done manually since gexf crate does not support it yet. | ||
| fn add_attribute_schema(xml: String, attributes: Vec<(String, String)>) -> String { |
There was a problem hiding this comment.
This functions shouldn't be necessary anymore (fixed at GEFX library)
|
Heads up: this PR will conflict with #34. This PR deletes the Whichever of the two merges second will get a real conflict there, not a false positive, one deletes the lines the other modifies. If #25 goes first, the |
Semantic resolution beyond the textual conflict in draw_model(): tests/api_contract.rs and the README usage example migrate from the removed Apotheosis::draw() method to the new export::gexf::draw() entry point.
The fork at danielhuici/gexf auto-collects node attribute keys and writes the <attributes> declaration section itself, so the manual XML patching in add_attribute_schema() is no longer needed. save_gexf() loses its model parameter, which was only read for that patching. The git source is allowed in deny.toml, like the tlsh one. This fix existed since May on apo2-parallelized (9c8b567) but never reached apotheosis2.
The documentation was written in July and reviewed against the code of that moment. Meanwhile reverseame#24 (distance type in the dump/load header), reverseame#25 (GEXF export extracted to export::gexf, gexf fork emits the attribute schema), reverseame#27 (record constructors return Result) and reverseame#31 (facade read accessors) landed. Update the interface document, the three views, the glossary and the README accordingly. Text only; the C&C component model and diagrams are untouched.
Semantic resolution: reverseame#25 moved draw()/save_gexf() from the facade to export::gexf, so this branch's changes to the old location are ported there instead: draw() returns Result<(), Box<dyn Error>>, save_gexf() propagates I/O and GEXF serialization errors with ? instead of let _ / unwrap. The port is smaller than the original commit because the gexf fork adopted in reverseame#25 had already removed add_attribute_schema and one of the two unwrap call sites.
Summary
apotheosis.rsmixed index coordination, persistence and GEXF visualization export (about 85 of its 250 lines, including manual XML string patching). Any change to the export format touched the same file holding the critical insert/search logic.Changes
src/export/gexf.rs(new):draw(),add_attribute_schema()andsave_gexf()moved unchanged, now a free functionexport::gexf::draw(&model, path)consuming the facade through its public API.src/controllers/apotheosis.rs:draw()removed. Two read-only accessors added:draw_model()(graph shape, one entry per layer) andrecord(index). Both are needed byexport::gexf::draw(), which lives outside this impl and cannot reachhnsw/recordsdirectly now that they are private ([Enhancement] Make Apotheosis internal fields private to protect the synchrony invariant #14/fix: make Apotheosis internal fields private (closes #14) #15).src/lib.rs:pub mod export;.Breaking change, declared: callers of
model.draw(path)move toexport::gexf::draw(&model, path). Verified nothing in this repo callsdraw()besides its own definition.Test plan
Test coverage for this refactor will be added as part of the dedicated test suite work (tests are being consolidated separately instead of per-PR).
cargo test,cargo checkpass locally.rustfmt --checkon the three changed files (apotheosis.rs,export/gexf.rs,export/mod.rs) passes. (src/lib.rswas excluded from the direct rustfmt check since it cascades to the whole module tree including unrelated pre-existing files.)cargo clippyon the full crate could not be verified locally (unrelated toolchain issue on this machine); will be validated by CI on this PR.Closes #18