Skip to content

Commit cb42f00

Browse files
authored
Merge pull request #243 from sbmlteam/fbc-v3-fix
#241:issues with fbc v3
2 parents 8344b88 + 71396f9 commit cb42f00

File tree

9 files changed

+209
-171
lines changed

9 files changed

+209
-171
lines changed

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.19.5
1+
5.19.6

configure

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#! /bin/sh
22
# From configure.ac Revision.
33
# Guess values for system-dependent variables and create Makefiles.
4-
# Generated by GNU Autoconf 2.69 for libSBML 5.19.5.
4+
# Generated by GNU Autoconf 2.69 for libSBML 5.19.6.
55
#
66
# Report bugs to <[email protected]>.
77
#
@@ -735,8 +735,8 @@ MAKEFLAGS=
735735
# Identity of this package.
736736
PACKAGE_NAME='libSBML'
737737
PACKAGE_TARNAME='libsbml'
738-
PACKAGE_VERSION='5.19.5'
739-
PACKAGE_STRING='libSBML 5.19.5'
738+
PACKAGE_VERSION='5.19.6'
739+
PACKAGE_STRING='libSBML 5.19.6'
740740
PACKAGE_BUGREPORT='[email protected]'
741741
PACKAGE_URL='http://sbml.org/Software/libSBML'
742742

@@ -1629,7 +1629,7 @@ if test "$ac_init_help" = "long"; then
16291629
# Omit some internal or obsolete options to make the list less imposing.
16301630
# This message is too long to be a string in the A/UX 3.1 sh.
16311631
cat <<_ACEOF
1632-
\`configure' configures libSBML 5.19.5 to adapt to many kinds of systems.
1632+
\`configure' configures libSBML 5.19.6 to adapt to many kinds of systems.
16331633

16341634
Usage: $0 [OPTION]... [VAR=VALUE]...
16351635

@@ -1695,7 +1695,7 @@ fi
16951695

16961696
if test -n "$ac_init_help"; then
16971697
case $ac_init_help in
1698-
short | recursive ) echo "Configuration of libSBML 5.19.5:";;
1698+
short | recursive ) echo "Configuration of libSBML 5.19.6:";;
16991699
esac
17001700
cat <<\_ACEOF
17011701

@@ -1851,7 +1851,7 @@ fi
18511851
test -n "$ac_init_help" && exit $ac_status
18521852
if $ac_init_version; then
18531853
cat <<\_ACEOF
1854-
libSBML configure 5.19.5
1854+
libSBML configure 5.19.6
18551855
generated by GNU Autoconf 2.69
18561856

18571857
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2570,7 +2570,7 @@ cat >config.log <<_ACEOF
25702570
This file contains any messages produced by compilers while
25712571
running configure, to aid debugging if configure makes a mistake.
25722572

2573-
It was created by libSBML $as_me 5.19.5, which was
2573+
It was created by libSBML $as_me 5.19.6, which was
25742574
generated by GNU Autoconf 2.69. Invocation command line was
25752575

25762576
$ $0 $@
@@ -27754,7 +27754,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
2775427754
# report actual input values of CONFIG_FILES etc. instead of their
2775527755
# values after options handling.
2775627756
ac_log="
27757-
This file was extended by libSBML $as_me 5.19.5, which was
27757+
This file was extended by libSBML $as_me 5.19.6, which was
2775827758
generated by GNU Autoconf 2.69. Invocation command line was
2775927759

2776027760
CONFIG_FILES = $CONFIG_FILES
@@ -27817,7 +27817,7 @@ _ACEOF
2781727817
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2781827818
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
2781927819
ac_cs_version="\\
27820-
libSBML config.status 5.19.5
27820+
libSBML config.status 5.19.6
2782127821
configured by $0, generated by GNU Autoconf 2.69,
2782227822
with options \\"\$ac_cs_config\\"
2782327823

src/sbml/common/libsbml-version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
*
5252
* A version string of the form "1.2.3".
5353
*/
54-
#define LIBSBML_DOTTED_VERSION "5.19.5"
54+
#define LIBSBML_DOTTED_VERSION "5.19.6"
5555

5656

5757
/**

src/sbml/packages/fbc/extension/FbcSBasePlugin.cpp

Lines changed: 89 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ FbcSBasePlugin::createKeyValuePair()
230230

231231
try
232232
{
233-
FBC_CREATE_NS(fbcns, getSBMLNamespaces());
233+
FBC_CREATE_NS_WITH_VERSION(fbcns, getSBMLNamespaces(), getPackageVersion());
234234
kvp = new KeyValuePair(fbcns);
235235
delete fbcns;
236236
}
@@ -872,87 +872,94 @@ FbcSBasePlugin::createObject(XMLInputStream& stream)
872872

873873
/** @endcond */
874874

875-
/** @cond doxygenLibsbmlInternal */
876-
/**
877-
* Synchronizes the annotation of this SBML object.
878-
*
879-
* Annotation element (XMLNode* mAnnotation) is synchronized with the
880-
* current CVTerm objects (List* mCVTerm).
881-
* Currently, this method is called in getAnnotation, isSetAnnotation,
882-
* and writeElements methods.
883-
*/
884-
void
885-
FbcSBasePlugin::writeKeyValuePairsAnnotation(SBase* parentObject) const
886-
{
887-
if (parentObject == NULL) return;
888-
889-
890-
XMLNode *parentAnnotation = parentObject->getAnnotation();
891-
if (parentAnnotation != NULL && parentAnnotation->getNumChildren() > 0)
892-
{
893-
// deleteFbcAnnotation(parentAnnotation);
894-
}
895-
896-
XMLToken ann_token = XMLToken(XMLTriple("annotation", "", ""), XMLAttributes());
897-
XMLNode* annt = new XMLNode(ann_token);
898-
899-
900-
901-
if (mKeyValuePairs.size() > 0)
902-
{
903-
XMLAttributes loga_attr = XMLAttributes();
904-
loga_attr.add("xmlns", FbcExtension::getXmlnsL3V1V3());
905-
XMLToken loga_token = XMLToken(XMLTriple("listOfKeyValuePairs", FbcExtension::getXmlnsL3V1V1(), ""), loga_attr);
906-
XMLNode loga = XMLNode(loga_token);
907-
908-
for (unsigned int i = 0; i < mKeyValuePairs.size(); ++i)
909-
loga.addChild(mKeyValuePairs.get(i)->toXML());
910-
911-
// then add the ones toXML()
912-
annt->addChild(loga);
913-
}
914-
915-
916-
if (annt && annt->getNumChildren() > 0)
917-
{
918-
parentObject->appendAnnotation(annt);
919-
}
920-
delete annt;
921-
}
922-
/** @endcond */
923-
924-
925-
/** @cond doxygenLibsbmlInternal */
926-
/**
927-
* Parse L2 annotation if supported
928-
*
929-
*/
930-
void
931-
FbcSBasePlugin::parseAnnotation(SBase *parentObject, XMLNode *pAnnotation)
932-
{
933-
mKeyValuePairs.setSBMLDocument(mSBML);
934-
// don't read if we have an invalid node or already a gene associations object
935-
if (pAnnotation == NULL || mKeyValuePairs.size() > 0)
936-
return;
937-
938-
// annotation element has been parsed by the parent element
939-
// (Model) of this plugin object, thus the annotation element
940-
// set to the above pAnnotation variable is parsed in this block.
941-
942-
XMLNode& listOfKeyValuePairs = pAnnotation->getChild("listOfKeyValuePairs");
943-
if (listOfKeyValuePairs.getNumChildren() == 0)
944-
return;
945-
946-
// read the xml node, overriding that all errors are flagged as
947-
// warnings
948-
mKeyValuePairs.read(listOfKeyValuePairs, LIBSBML_OVERRIDE_WARNING);
949-
// remove listOfLayouts annotation
950-
parentObject->removeTopLevelAnnotationElement("listOfKeyValuePairs", "", false);
951-
952-
}
953-
/** @endcond */
954-
955-
875+
/** @cond doxygenLibsbmlInternal */
876+
/**
877+
* Synchronizes the annotation of this SBML object.
878+
*
879+
* Annotation element (XMLNode* mAnnotation) is synchronized with the
880+
* current CVTerm objects (List* mCVTerm).
881+
* Currently, this method is called in getAnnotation, isSetAnnotation,
882+
* and writeElements methods.
883+
*/
884+
void
885+
FbcSBasePlugin::writeKeyValuePairsAnnotation(SBase* parentObject) const
886+
{
887+
if (parentObject == NULL) return;
888+
889+
890+
XMLNode *parentAnnotation = parentObject->getAnnotation();
891+
if (parentAnnotation != NULL && parentAnnotation->getNumChildren() > 0)
892+
{
893+
// deleteFbcAnnotation(parentAnnotation);
894+
}
895+
896+
XMLToken ann_token = XMLToken(XMLTriple("annotation", "", ""), XMLAttributes());
897+
XMLNode* annt = new XMLNode(ann_token);
898+
899+
900+
901+
if (mKeyValuePairs.size() > 0)
902+
{
903+
XMLAttributes loga_attr = XMLAttributes();
904+
loga_attr.add("xmlns", mKeyValuePairs.getXmlns());
905+
XMLToken loga_token = XMLToken(XMLTriple("listOfKeyValuePairs", mKeyValuePairs.getXmlns(), ""), loga_attr);
906+
XMLNode loga = XMLNode(loga_token);
907+
908+
for (unsigned int i = 0; i < mKeyValuePairs.size(); ++i)
909+
loga.addChild(mKeyValuePairs.get(i)->toXML());
910+
911+
// then add the ones toXML()
912+
annt->addChild(loga);
913+
}
914+
915+
916+
if (annt && annt->getNumChildren() > 0)
917+
{
918+
parentObject->appendAnnotation(annt);
919+
}
920+
delete annt;
921+
}
922+
/** @endcond */
923+
924+
925+
/** @cond doxygenLibsbmlInternal */
926+
/**
927+
* Parse L2 annotation if supported
928+
*
929+
*/
930+
void
931+
FbcSBasePlugin::parseAnnotation(SBase *parentObject, XMLNode *pAnnotation)
932+
{
933+
mKeyValuePairs.setSBMLDocument(mSBML);
934+
// don't read if we have an invalid node or already a gene associations object
935+
if (pAnnotation == NULL || mKeyValuePairs.size() > 0)
936+
return;
937+
938+
// annotation element has been parsed by the parent element
939+
// (Model) of this plugin object, thus the annotation element
940+
// set to the above pAnnotation variable is parsed in this block.
941+
942+
XMLNode& listOfKeyValuePairs = pAnnotation->getChild("listOfKeyValuePairs");
943+
if (listOfKeyValuePairs.getNumChildren() == 0)
944+
return;
945+
946+
XMLNamespaces oldNs = listOfKeyValuePairs.getNamespaces();
947+
948+
// read the xml node, overriding that all errors are flagged as
949+
// warnings
950+
mKeyValuePairs.read(listOfKeyValuePairs, LIBSBML_OVERRIDE_WARNING);
951+
952+
// unfortunately the namespaces are overwritten at that point with the one from the
953+
// document, so restore it
954+
mKeyValuePairs.setXmlns(&oldNs, listOfKeyValuePairs.getPrefix());
955+
956+
// remove listOfLayouts annotation
957+
parentObject->removeTopLevelAnnotationElement("listOfKeyValuePairs", "", false);
958+
959+
}
960+
/** @endcond */
961+
962+
956963

957964

958965

src/sbml/packages/fbc/extension/test/TestWriteFbcExtension.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,14 @@ START_TEST(test_FbcExtension_create_and_write_L3V1V3)
451451

452452
FbcSBasePlugin* sbaseplugin3 = dynamic_cast<FbcSBasePlugin*>(objective->getPlugin("fbc"));
453453

454+
ListOfKeyValuePairs *kvp_list = sbaseplugin3->getListOfKeyValuePairs();
455+
fail_unless(kvp_list->isSetXmlns());
456+
fail_unless(kvp_list->getXmlns() == "http://sbml.org/fbc/keyvaluepair");
457+
454458
KeyValuePair * kvp3 = sbaseplugin3->createKeyValuePair();
455-
kvp3->setKey("key3");
456-
kvp3->setUri("my_annotation");
457-
kvp3->setValue("objective-value");
459+
fail_unless(kvp3->setKey("key3") == LIBSBML_OPERATION_SUCCESS);
460+
fail_unless(kvp3->setUri("my_annotation") == LIBSBML_OPERATION_SUCCESS);
461+
fail_unless(kvp3->setValue("objective-value") == LIBSBML_OPERATION_SUCCESS);
458462

459463
//FbcSBasePlugin* sbaseplugin4 = dynamic_cast<FbcSBasePlugin*>(document->getPlugin("fbc"));
460464
//// this dynamic cast is null
Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version3" level="3" version="1" fbc:required="false">
3-
<!-- <annotation>
4-
<listOfKeyValuePairs xlns="http://www.sbml.org/sbml/level3/version1/fbc/version3">
5-
<keyValuePair key="key4" value="doc-value" uri="my_annotation"/>
6-
</listOfKeyValuePairs>
7-
</annotation>
8-
-->
93
<model id="m" fbc:strict="true">
104
<annotation>
11-
<listOfKeyValuePairs xlns="http://www.sbml.org/sbml/level3/version1/fbc/version3">
5+
<listOfKeyValuePairs xmlns="http://sbml.org/fbc/keyvaluepair">
126
<keyValuePair key="key2" value="model-value" uri="my_annotation"/>
137
</listOfKeyValuePairs>
148
</annotation>
159
<listOfCompartments>
1610
<compartment id="comp" spatialDimensions="3" size="1" constant="true">
1711
<annotation>
18-
<listOfKeyValuePairs xlns="http://www.sbml.org/sbml/level3/version1/fbc/version3">
12+
<listOfKeyValuePairs xmlns="http://sbml.org/fbc/keyvaluepair">
1913
<keyValuePair key="key" value="comp-value" uri="my_annotation"/>
2014
</listOfKeyValuePairs>
2115
</annotation>
@@ -24,7 +18,7 @@
2418
<listOfSpecies>
2519
<species id="S" compartment="comp" boundaryCondition="false" fbc:charge="2.5">
2620
<annotation>
27-
<listOfKeyValuePairs xlns="http://www.sbml.org/sbml/level3/version1/fbc/version3">
21+
<listOfKeyValuePairs xmlns="http://sbml.org/fbc/keyvaluepair">
2822
<keyValuePair key="key1" value="species-value" uri="my_annotation"/>
2923
</listOfKeyValuePairs>
3024
</annotation>
@@ -33,7 +27,7 @@
3327
<fbc:listOfObjectives fbc:activeObjective="obj1">
3428
<fbc:objective fbc:id="obj1" fbc:type="maximize">
3529
<annotation>
36-
<listOfKeyValuePairs xlns="http://www.sbml.org/sbml/level3/version1/fbc/version3">
30+
<listOfKeyValuePairs xmlns="http://sbml.org/fbc/keyvaluepair">
3731
<keyValuePair key="key3" value="objective-value" uri="my_annotation"/>
3832
</listOfKeyValuePairs>
3933
</annotation>
@@ -44,13 +38,10 @@
4438
</fbc:listOfObjectives>
4539
<fbc:listOfUserDefinedConstraints>
4640
<fbc:userDefinedConstraint fbc:id="uc2" fbc:lowerBound="uc2lb" fbc:upperBound="uc2ub">
47-
4841
<fbc:listOfUserDefinedConstraintComponents>
49-
5042
<fbc:userDefinedConstraintComponent fbc:coefficient="2" fbc:variable="Avar" fbc:variableType="linear"/>
5143
</fbc:listOfUserDefinedConstraintComponents>
5244
</fbc:userDefinedConstraint>
5345
</fbc:listOfUserDefinedConstraints>
54-
5546
</model>
5647
</sbml>

0 commit comments

Comments
 (0)