Open draeger opened 4 years ago
Along with this issue, while running the statements model.getPlugin(fbcNamespaceV1) == null
and model.getPlugin(fbcNamespaceV2) == null
for the model 01190 from the SBML test suite both returns false
value. However, the case should be that one of them should return true
value.
I can see that it can be confusing. We need at least to make the documentation clearer. My thinking on allowing namespace as well was to make it more convenient for people but make it work like when you use the package label, meaning returning the plugin if it does exist. Also, if we make the method strict, it will force people to update their code when a new version of the package is out, even if the code would have work properly without change.
I don't think this method is use too much with namespace so we could change it's behaviour.
I see two options:
What do you think ?
Also if you are really writing a piece of code for only a specific version of a package, you might just test it at the SBMLDocument level and stop right without doing anything else if it is not the right one.
@niko-rodrigue which convenient method in JSBML can be used to answer the question if an arbitrary instance of an SBase
has any extension package (of a specific short label or namespace) attached?
@niko-rodrigue which convenient method in JSBML can be used to answer the question if an arbitrary instance of an
SBase
has any extension package (of a specific short label or namespace) attached?
Not really related to the issue but you have: https://sbmlteam.github.io/jsbml/files/doc/api/1.5/org/sbml/jsbml/SBase.html#getNumPlugins--
as well as SBase#getExtensionCount()
Or if I misunderstood your question, SBase#isSetPlugin
Ok, but these methods won't answer the question if a specific extension, such as fbc, is attached to an instance of SBase. So, we can check if there is any extension but then don't know which one, nor if the one of interest is there.
The test
isSetPlugin
onAbstractSBase
should returntrue
if theSBase
has a child with the given namespace. In the current implementation, however, it returnstrue
if JSBML has (at some point) loaded a parser for parsing that namespace.For example, if a model has an FBC extension in package version 1, JSBML will return
true
when askingmodel.isSetPlugin
with the namespace of FBC package version 2 as argument. For testing, the model 01190 from the SBML test suite can be used.The desired behavior of this method (and the corresponding method
hasExtension
) is that it should only returntrue
if an extension with the given namespace exists.