Fix #354: Remove empty RDF Description nodes after unsetModifiedDates#481
Open
dyrpsf wants to merge 2 commits into
Open
Fix #354: Remove empty RDF Description nodes after unsetModifiedDates#481dyrpsf wants to merge 2 commits into
dyrpsf wants to merge 2 commits into
Conversation
fbergmann
approved these changes
Jun 29, 2026
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.
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