Good afternoon,
I was trying to use appendAnnotation on my code, but it didn't work, the returned error wasn't any of the documented ones (LIBSBML_UNEXPECTED_ATTRIBUTE, LIBSBML_OPERATION_FAILED, LIBSBML_DUPLICATE_ANNOTATION_NS, LIBSBML_OPERATION_SUCCESS), but -14.
I thought my annotation had a format issue or something, and went to try the python example from your docs.
http://sbml.org/Software/libSBML/5.18.0/docs/python-api/append_annotation_8py-example.html
I tried to execute it with the following, valid SBML.
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" level="3" version="2">
<model id="CF_fact2">
<listOfCompartments>
<compartment id="Implicit_Compartment" name="Implicit Compartment" spatialDimensions="NaN" size="NaN" constant="false"/>
</listOfCompartments>
<listOfSpecies>
<species id="Asthma" name="Asthma" compartment="Implicit_Compartment" initialAmount="0" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="Obesity" name="Obesity" compartment="Implicit_Compartment" initialConcentration="0" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
</listOfSpecies>
<listOfReactions>
<reaction id="R1" name="R1" reversible="false">
<listOfReactants>
<speciesReference species="Obesity" stoichiometry="NaN" constant="false"/>
</listOfReactants>
<listOfProducts>
<speciesReference species="Asthma" stoichiometry="NaN" constant="false"/>
</listOfProducts>
</reaction>
</listOfReactions>
</model>
</sbml>
No errors are reported after executing the program, but the annotation is not added. The call returns -14.
I noticed that if the <bqbiol:isversionof> elements (both opening and closing tags) are removed from the annotation, the issue does not happen anymore. This might help to locate the issue.</bqbiol:isversionof>
Greetings,
Carlos Vega
This happens as well with python libsbml 5.17 and 5.16
Last edit: Carlos Vega 2020-01-31
Sorry for the inconvenience, we can certainly improve the documentation:
http://sbml.org/Software/libSBML/5.18.0/docs/cpp-api/operation_return_values_8h.html
The issue is, that there is no metaid set on the element in question, and so the annotation cannot be attached to it.