Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't add ModelHistory without dates even in L3V2 #290

Closed
avandecreme opened this issue Jan 3, 2023 · 4 comments · Fixed by #295
Closed

Can't add ModelHistory without dates even in L3V2 #290

avandecreme opened this issue Jan 3, 2023 · 4 comments · Fixed by #295

Comments

@avandecreme
Copy link
Contributor

avandecreme commented Jan 3, 2023

#265 adds support for ModelHistory without dates in L3V2.

However, when running the addModelHistory.c example with the parts adding the dates commented out on a L3V2 SBML file, we still get the following output: Set model history: invalid object.

The reason for that is that ModelHistory::hasRequiredAttributes is called on a model history which does not have a parent SBML object (yet) so we are falling in the level < 3 branch here:

if (parent == NULL || parent->getLevel() < 3)

@fbergmann
Copy link
Member

is it possible to call ModelHistory::setParentSBMLObject before? Without knowing the sbml context, it is not possible to decide whether the element is valid or not. So i think the fix here would be to add extern C overloads for accessing the parent sbml object.

@avandecreme
Copy link
Contributor Author

For the exact issue I guess we could fix it by setting (and unsetting it after the check) the parent before calling history->hasRequiredAttributes() here:

else if (!(history->hasRequiredAttributes()))

If someone wants to call ModelHistory::hasRequiredAttributes directly, I guess we have to make C bindings to access the parent sbml object indeed.

Another option would be to pass the SBML version as a parameter to hasRequiredAttributes but that would be quite a big change.

@fbergmann
Copy link
Member

For the exact issue I guess we could fix it by setting (and unsetting it after the check) the parent before calling history->hasRequiredAttributes() here

i think that is could idea, if no parent has been set, we temporarily set before the check, and unset after.

@skeating skeating mentioned this issue Feb 13, 2023
8 tasks
@avandecreme
Copy link
Contributor Author

Thanks for fixing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants