From feccb452b00c3ec4972f3129b9377ee4413dd7f9 Mon Sep 17 00:00:00 2001 From: Sarah Keating Date: Mon, 26 Aug 2024 13:34:29 +0100 Subject: [PATCH 1/3] fixed files incorrectly reporting xml issue- --- src/sbml/SBase.cpp | 11 +++++++++-- src/sbml/SBase.h | 3 ++- ...9107-fail-01-04-10102.xml => 99107-fail-01-06.xml} | 0 ...9107-fail-01-06-10102.xml => 99107-fail-01-07.xml} | 0 .../99107-fail-01-08.xml} | 2 +- .../99107-fail-01-09.xml} | 2 +- .../99108-fail-01-06.xml} | 2 +- .../20517-fail-01-07.xml} | 2 +- .../20517-fail-01-08.xml} | 2 +- .../20517-fail-01-09.xml} | 2 +- 10 files changed, 17 insertions(+), 9 deletions(-) rename src/sbml/validator/test/test-data/libsbml-constraints/{99107-fail-01-04-10102.xml => 99107-fail-01-06.xml} (100%) rename src/sbml/validator/test/test-data/libsbml-constraints/{99107-fail-01-06-10102.xml => 99107-fail-01-07.xml} (100%) rename src/sbml/validator/test/test-data/{sbml-xml-constraints/10102-fail-01-27-20517.xml => libsbml-constraints/99107-fail-01-08.xml} (80%) rename src/sbml/validator/test/test-data/{sbml-xml-constraints/10102-fail-01-29-20517.xml => libsbml-constraints/99107-fail-01-09.xml} (86%) rename src/sbml/validator/test/test-data/{sbml-xml-constraints/10102-fail-01-28-20517.xml => libsbml-constraints/99108-fail-01-06.xml} (86%) rename src/sbml/validator/test/test-data/{sbml-xml-constraints/10102-fail-01-30-20517.xml => sbml-general-consistency-constraints/20517-fail-01-07.xml} (87%) rename src/sbml/validator/test/test-data/{sbml-xml-constraints/10102-fail-01-32-20517.xml => sbml-general-consistency-constraints/20517-fail-01-08.xml} (88%) rename src/sbml/validator/test/test-data/{sbml-xml-constraints/10102-fail-01-31-20517.xml => sbml-general-consistency-constraints/20517-fail-01-09.xml} (88%) diff --git a/src/sbml/SBase.cpp b/src/sbml/SBase.cpp index 4e1ada2ac5..8da56652b1 100644 --- a/src/sbml/SBase.cpp +++ b/src/sbml/SBase.cpp @@ -4576,6 +4576,7 @@ SBase::read (XMLInputStream& stream) else if ( next.isStart() ) { const std::string nextName = next.getName(); + const std::string nextURI = next.getURI(); #if 0 cout << "[DEBUG] SBase::read " << nextName << " uri " << stream.peek().getURI() << endl; @@ -4620,7 +4621,7 @@ SBase::read (XMLInputStream& stream) || readAnnotation(stream) || readNotes(stream) )) { - logUnknownElement(nextName, getLevel(), getVersion()); + logUnknownElement(nextName, getLevel(), getVersion(), nextURI); stream.skipPastEnd( stream.next() ); } } @@ -5343,11 +5344,17 @@ SBase::logUnknownAttribute( const string& attribute, void SBase::logUnknownElement( const string& element, const unsigned int level, - const unsigned int version ) + const unsigned int version, + const string& URI) { bool logged = false; ostringstream msg; + // if we have an unknown element that is not in an SBML name space + // this is perfectly allowed XML + if (SBMLNamespaces::getSBMLNamespaceURI(level, version) != URI) + return; + if (level > 2 && getTypeCode() == SBML_LIST_OF) { int tc = static_cast(this)->getItemTypeCode(); diff --git a/src/sbml/SBase.h b/src/sbml/SBase.h index 5ed23d9dcb..df17ac3e5c 100644 --- a/src/sbml/SBase.h +++ b/src/sbml/SBase.h @@ -3532,7 +3532,8 @@ newModel.addSpecies(s1); */ void logUnknownElement( const std::string& element, const unsigned int level, - const unsigned int version ); + const unsigned int version, + const std::string& URI = NULL); /** diff --git a/src/sbml/validator/test/test-data/libsbml-constraints/99107-fail-01-04-10102.xml b/src/sbml/validator/test/test-data/libsbml-constraints/99107-fail-01-06.xml similarity index 100% rename from src/sbml/validator/test/test-data/libsbml-constraints/99107-fail-01-04-10102.xml rename to src/sbml/validator/test/test-data/libsbml-constraints/99107-fail-01-06.xml diff --git a/src/sbml/validator/test/test-data/libsbml-constraints/99107-fail-01-06-10102.xml b/src/sbml/validator/test/test-data/libsbml-constraints/99107-fail-01-07.xml similarity index 100% rename from src/sbml/validator/test/test-data/libsbml-constraints/99107-fail-01-06-10102.xml rename to src/sbml/validator/test/test-data/libsbml-constraints/99107-fail-01-07.xml diff --git a/src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-27-20517.xml b/src/sbml/validator/test/test-data/libsbml-constraints/99107-fail-01-08.xml similarity index 80% rename from src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-27-20517.xml rename to src/sbml/validator/test/test-data/libsbml-constraints/99107-fail-01-08.xml index 69370fd243..f60c1bb550 100644 --- a/src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-27-20517.xml +++ b/src/sbml/validator/test/test-data/libsbml-constraints/99107-fail-01-08.xml @@ -1,6 +1,6 @@ +xmlns:appear="http://www.sbml.org/sbml/level3/version1/appear" appear:required="true"> diff --git a/src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-29-20517.xml b/src/sbml/validator/test/test-data/libsbml-constraints/99107-fail-01-09.xml similarity index 86% rename from src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-29-20517.xml rename to src/sbml/validator/test/test-data/libsbml-constraints/99107-fail-01-09.xml index ff0a4a7137..cce61f113a 100644 --- a/src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-29-20517.xml +++ b/src/sbml/validator/test/test-data/libsbml-constraints/99107-fail-01-09.xml @@ -1,6 +1,6 @@ diff --git a/src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-28-20517.xml b/src/sbml/validator/test/test-data/libsbml-constraints/99108-fail-01-06.xml similarity index 86% rename from src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-28-20517.xml rename to src/sbml/validator/test/test-data/libsbml-constraints/99108-fail-01-06.xml index bdc090f245..c53076cd87 100644 --- a/src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-28-20517.xml +++ b/src/sbml/validator/test/test-data/libsbml-constraints/99108-fail-01-06.xml @@ -1,6 +1,6 @@ diff --git a/src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-30-20517.xml b/src/sbml/validator/test/test-data/sbml-general-consistency-constraints/20517-fail-01-07.xml similarity index 87% rename from src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-30-20517.xml rename to src/sbml/validator/test/test-data/sbml-general-consistency-constraints/20517-fail-01-07.xml index 1877ba8743..43726846a6 100644 --- a/src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-30-20517.xml +++ b/src/sbml/validator/test/test-data/sbml-general-consistency-constraints/20517-fail-01-07.xml @@ -1,6 +1,6 @@ +xmlns:appear="http://www.sbother"> diff --git a/src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-32-20517.xml b/src/sbml/validator/test/test-data/sbml-general-consistency-constraints/20517-fail-01-08.xml similarity index 88% rename from src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-32-20517.xml rename to src/sbml/validator/test/test-data/sbml-general-consistency-constraints/20517-fail-01-08.xml index 2da0266d66..d8544069c2 100644 --- a/src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-32-20517.xml +++ b/src/sbml/validator/test/test-data/sbml-general-consistency-constraints/20517-fail-01-08.xml @@ -1,6 +1,6 @@ diff --git a/src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-31-20517.xml b/src/sbml/validator/test/test-data/sbml-general-consistency-constraints/20517-fail-01-09.xml similarity index 88% rename from src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-31-20517.xml rename to src/sbml/validator/test/test-data/sbml-general-consistency-constraints/20517-fail-01-09.xml index 7815afde46..5c83a7d1de 100644 --- a/src/sbml/validator/test/test-data/sbml-xml-constraints/10102-fail-01-31-20517.xml +++ b/src/sbml/validator/test/test-data/sbml-general-consistency-constraints/20517-fail-01-09.xml @@ -1,6 +1,6 @@ From 368ffa01399f0175c89c4a4975f4a876fad2cb76 Mon Sep 17 00:00:00 2001 From: Sarah Keating Date: Mon, 26 Aug 2024 13:41:23 +0100 Subject: [PATCH 2/3] Removed places where we say: This functionality will be improved in later versions --- src/sbml/SBMLErrorTable.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/sbml/SBMLErrorTable.h b/src/sbml/SBMLErrorTable.h index 4f07775286..53d2a1d6e4 100644 --- a/src/sbml/SBMLErrorTable.h +++ b/src/sbml/SBMLErrorTable.h @@ -11047,8 +11047,7 @@ static const sbmlErrorTableEntry errorTable[] = "LibSBML expected to read the annotation into a ModelHistory " "object. Unfortunately, some attributes were not present or correct " "and the resulting ModelHistory object will not correctly " - "produce the annotation. This functionality will be improved in " - "later versions of libSBML. ", + "produce the annotation. ", {"", "", "L2V2 Section 6.3", @@ -11076,8 +11075,7 @@ static const sbmlErrorTableEntry errorTable[] = "LibSBML expected to read the annotation into a ModelHistory " "object. Unfortunately, some attributes were not present or correct " "and the resulting ModelHistory object is NULL. Thus it will fail to " - "produce the annotation. This functionality will be improved in " - "later versions of libSBML. ", + "produce the annotation. ", {"", "", "L2V2 Section 6.3", From 77ed53694cf187bb19a84480255b5cd647c9a59d Mon Sep 17 00:00:00 2001 From: Sarah Keating Date: Thu, 29 Aug 2024 13:13:17 +0100 Subject: [PATCH 3/3] fix ex the test that fail after my correction to incorrect tests --- src/sbml/SBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sbml/SBase.cpp b/src/sbml/SBase.cpp index 8da56652b1..3ba470d240 100644 --- a/src/sbml/SBase.cpp +++ b/src/sbml/SBase.cpp @@ -5352,7 +5352,7 @@ SBase::logUnknownElement( const string& element, // if we have an unknown element that is not in an SBML name space // this is perfectly allowed XML - if (SBMLNamespaces::getSBMLNamespaceURI(level, version) != URI) + if (getPackageName() == "core" && SBMLNamespaces::getSBMLNamespaceURI(level, version) != URI) return; if (level > 2 && getTypeCode() == SBML_LIST_OF)