Skip to content

Commit c8948c1

Browse files
committed
Changes rate rule converter error to warning
The rate rule converter previously treated the absence of rate rules as an error, causing conversion to fail. This change corrects this behavior by downgrading the error to a warning and allowing the conversion to proceed successfully. This ensures that models without rate rules are handled gracefully.
1 parent 7ec2396 commit c8948c1

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

src/sbml/SBMLErrorTable.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8095,15 +8095,15 @@ static const sbmlErrorTableEntry errorTable[] =
80958095
ModelContainsNoRateRules,
80968096
"Model contains no rate rules",
80978097
LIBSBML_CAT_RATE_RULE_CONVERSION,
8098-
LIBSBML_SEV_ERROR,
8099-
LIBSBML_SEV_ERROR,
8100-
LIBSBML_SEV_ERROR,
8101-
LIBSBML_SEV_ERROR,
8102-
LIBSBML_SEV_ERROR,
8103-
LIBSBML_SEV_ERROR,
8104-
LIBSBML_SEV_ERROR,
8105-
LIBSBML_SEV_ERROR,
8106-
LIBSBML_SEV_ERROR,
8098+
LIBSBML_SEV_WARNING,
8099+
LIBSBML_SEV_WARNING,
8100+
LIBSBML_SEV_WARNING,
8101+
LIBSBML_SEV_WARNING,
8102+
LIBSBML_SEV_WARNING,
8103+
LIBSBML_SEV_WARNING,
8104+
LIBSBML_SEV_WARNING,
8105+
LIBSBML_SEV_WARNING,
8106+
LIBSBML_SEV_WARNING,
81078107
"The model contains no rate rules and so cannot be converted to reactions.",
81088108
{"",
81098109
"",
@@ -8115,7 +8115,7 @@ static const sbmlErrorTableEntry errorTable[] =
81158115
""}
81168116
},
81178117

8118-
//90103
8118+
//90103S.NESSTALENT SLEEP
81198119
{
81208120
ModelAlreadyContainsReactions,
81218121
"Model already contains reactions",

src/sbml/conversion/SBMLRateRuleConverter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ SBMLRateRuleConverter::isDocumentAppropriate(OperationReturnValues_t& returnValu
380380
{
381381
mDocument->getErrorLog()->logError(ModelContainsNoRateRules, mDocument->getLevel(),
382382
mDocument->getVersion(), "There are no rate rules present.");
383-
returnValue = LIBSBML_OPERATION_FAILED;
384-
return false;
383+
returnValue = LIBSBML_OPERATION_SUCCESS;
384+
return true;
385385
}
386386
else
387387
{
@@ -399,7 +399,7 @@ SBMLRateRuleConverter::isDocumentAppropriate(OperationReturnValues_t& returnValu
399399
{
400400
mDocument->getErrorLog()->logError(ModelContainsNoRateRules, mDocument->getLevel(),
401401
mDocument->getVersion(), "There are no rate rules present.");
402-
returnValue = LIBSBML_OPERATION_FAILED;
402+
returnValue = LIBSBML_OPERATION_SUCCESS;
403403
return false;
404404
}
405405
}

src/sbml/conversion/test/TestRoundtripConverter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
* <!--------------------------------------------------------------------------
77
* This file is part of libSBML. Please visit http://sbml.org for more
88
* information about SBML, and the latest version of libSBML.
9-
*
10-
* Copyright (C) 2013-2018 jointly by the following organizations:
9+
*
1110
* 1. California Institute of Technology, Pasadena, CA, USA
1211
* 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
1312
* 3. University of Heidelberg, Heidelberg, Germany

src/sbml/conversion/test/TestSBMLRateRuleConverter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ START_TEST(test_conversion_raterule_converter_invalid)
231231

232232
rule_rn_converter->setDocument(doc);
233233

234-
fail_unless(rule_rn_converter->convert() == LIBSBML_OPERATION_FAILED);
234+
fail_unless(rule_rn_converter->convert() == LIBSBML_OPERATION_SUCCESS);
235235

236236
Parameter* parameter1 = model->createParameter();
237237
parameter1->setId("s");
@@ -1062,7 +1062,7 @@ START_TEST(test_converter_errors_1)
10621062

10631063
rule_rn_converter->setDocument(d);
10641064
int ret = rule_rn_converter->convert();
1065-
fail_unless(ret == LIBSBML_OPERATION_FAILED);
1065+
fail_unless(ret == LIBSBML_OPERATION_SUCCESS);
10661066
fail_unless(d->getNumErrors() == 1);
10671067
fail_unless(d->getError(0)->getErrorId() == 90102);
10681068
fail_unless(d->getError(0)->getCategory() == LIBSBML_CAT_RATE_RULE_CONVERSION);
@@ -1084,7 +1084,7 @@ START_TEST(test_converter_errors_2)
10841084

10851085
rule_rn_converter->setDocument(d);
10861086
int ret = rule_rn_converter->convert();
1087-
fail_unless(ret == LIBSBML_OPERATION_FAILED);
1087+
fail_unless(ret == LIBSBML_OPERATION_SUCCESS);
10881088
fail_unless(d->getNumErrors() == 1);
10891089
fail_unless(d->getError(0)->getErrorId() == 90102);
10901090
fail_unless(d->getError(0)->getCategory() == LIBSBML_CAT_RATE_RULE_CONVERSION);

0 commit comments

Comments
 (0)