Add a method to strip unused namespaces for packages not being used
cjmyers opened this issue · comments
Since packages with required flag true prevent a file from being analyzed by a software that does not support that package, it would be good to strip package namespace and required flags (basically disable the plugin) when it is not needed. Namely, this should occur when the file does not use anything in that package namespace.
Could you please provide such a model, so that I can test if the code I am working on is correct?
@mephenor You can just take some models from biomodels and add some package namespaces and version declaration on the sbml element and test if they are removed by your method.
Some examples here.
Added a PackageDisabler class with a disableUnused method to core/src/util that should handle this.
A removePackage method is also present, which should take care of Issue #136
It would be good to add some junit tests for those utilities.
Sorry, haven't got around to do the tests due to exams.
If I need namespaces from ext, where should i put the tests, so that I don't get circular dependencies?
Putting them into core or ext doesn't work.
Top level tests (i.e. not in core but in test/org/sbml/jsbml) don't seem to run for me, as they either are not run by Maven's test phase, can't resolve namespaces in Intellij or fail, if I explicitly try to run them with Maven, also due to namespace resolution problems, if I remember correctly. Is there something I am missing, like some special configuration?
Coming back to this a bit late, @mephenor if you have some test files written, please send them over to me I will deal with them. Putting them on the top level test folder should be fine, at least for ant but maven should be fine as well.