Fix #354: Remove empty RDF Description nodes after unsetModifiedDates - #481
Fix #354: Remove empty RDF Description nodes after unsetModifiedDates#481dyrpsf wants to merge 4 commits into
Conversation
|
Hi @fbergmann, thanks for the approval! I just pushed a quick update to fix the CI build failures. There was a syntax error in the unit test I added (mistakenly calling the date methods on The tests should compile cleanly and pass now. Let me know if anything else is needed before this can be merged! |
|
Hi @fbergmann, Apologies for the back-and-forth on the CI checks! I just pushed another small commit to fix the compilation error in the new test suite. I had mistakenly tried to call The extensive CMake builds should compile cleanly and pass this time. Thanks again for your patience and the approval! |
Description
Updated the
SBase::reconstructRDFAnnotation()cleanup logic insrc/sbml/SBase.cpp. Added a routine at the end of the function to iterate backwards through theRDFnode's children and delete any<rdf:Description>elements that have zero inner children. If the parent<rdf:RDF>block becomes completely empty as a result, it is also safely removed.I also added a unit test (
test_SBase_unsetModifiedDates_issue354) insrc/sbml/test/TestSBase.cppto explicitly verify that no detritus is left behind when dates are removed.Motivation and Context
Previously, calling
unsetModifiedDateswould successfully remove the date nodes but leave behind empty<rdf:Description rdf:about="#foo"/>elements in the XML tree. Over multiple cycles, these empty tags would accumulate as detritus in the model's annotation. This change ensures the XML tree remains clean after node removal.Fixes #354
Types of changes
Checklist:
Testing