Skip to content

Conversation

@dyrpsf
Copy link

@dyrpsf dyrpsf commented Jan 14, 2026

###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

  1. OverdeterminationValidator
  • Added a helper:
private SBase resolveSBaseFromId(String id)

which resolves an identifier string to the corresponding SBase in the model (Species, Compartment, Parameter, or Reaction).

  • Updated
private void getVariables(ListOf<LocalParameter> param,
                          ASTNode node,
                          List<SBase> variables,
                          int level)

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.

  1. Tests
  • 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.

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 this pull request may close these issues.

correct OverdeterminationValidator for L3V2

1 participant