-
-
Notifications
You must be signed in to change notification settings - Fork 27
Fix OverdeterminationValidator for L3V2 rateOf csymbol #276
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
base: master
Are you sure you want to change the base?
Conversation
0ac6e59 to
22659a7
Compare
|
Hi, this PR was automatically closed because I had to reset and clean up my branches while reverting recent changes. |
|
Hi everyone, Just a quick update: everything is now set and all issues have been resolved. The changes have been reapplied cleanly, and this PR, as well as all other PRs I previously mentioned with problems, are now in good shape. Feel free to review at your convenience. Thanks for your patience! |
draeger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far. I'd like to see a second review.
|
|
||
| Species species = model.getSpecies(id); | ||
| if (species != null) { | ||
| return species; | ||
| } | ||
|
|
||
| Compartment compartment = model.getCompartment(id); | ||
| if (compartment != null) { | ||
| return compartment; | ||
| } | ||
|
|
||
| Parameter parameter = model.getParameter(id); | ||
| if (parameter != null) { | ||
| return parameter; | ||
| } | ||
|
|
||
| Reaction reaction = model.getReaction(id); | ||
| if (reaction != null) { | ||
| return reaction; | ||
| } | ||
|
|
||
| return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would also be possible to simply call public NamedSBase findNamedSBase(String id) on model. If needed, a subsequent test could check if the returned instance of NamedSBase is one of the expected types (or null) to exclude others.
###Summary
Fixes #138 .
In SBML Level 3 Version 2, rateOf csymbols can target a reaction identifier. The OverdeterminationValidator was not correctly taking these references into account because, in some cases, the ASTNode for the identifier has no variable set, and the identifier was therefore ignored when building the bipartite graph. This could cause overdetermined models involving rateOf(reactionId) to go undetected.
Changes
which resolves an identifier string to the corresponding SBase in the model (Species, Compartment, Parameter, or Reaction).
to:
First use node.getVariable() as before.
If getVariable() returns null (which can happen for identifiers used under a rateOf csymbol in L3V2), fall back to resolveSBaseFromId(node.getName()).
Preserve existing behavior for:
excluding local parameters
special Level 1 parameter insertion ordering
ignoring time and Avogadro symbols.
As a result, algebraic rules whose MathML uses rateOf(reactionId) now correctly link to the corresponding reaction node in the validator’s bipartite graph.
Added core/test/org/sbml/jsbml/validator/OverdeterminationValidatorTest.java.
New test:
testGetVariablesResolvesReactionIdWhenVariableNotSet()Builds a minimal L3V2 model with a single reaction R1.
Creates an ASTNode that refers to "R1" by name, without setting its variable (mimicking the situation for rateOf targets).
Invokes the private getVariables(...) method via reflection.
Asserts that the resulting variable list contains the reaction R1.
Testing
On this branch I ran:
mvn -pl core -am -DskipTests install
mvn -pl core test
Both complete with BUILD SUCCESS. No changes were made to project POMs or external dependencies.