1152 CPPUNIT_ASSERT(result ==
true);
1154 CPPUNIT_ASSERT(pModel != NULL);
1158 CPPUNIT_ASSERT(!miriamString.empty());
1163 CPPUNIT_ASSERT(pModifications != NULL);
1165 CPPUNIT_ASSERT(pModifications->
size() == 1);
1167 CPPUNIT_ASSERT(pModification != NULL);
1168 std::string dateTime = pModification->getDate();
1169 CPPUNIT_ASSERT(dateTime ==
"2007-06-05T11:40:04Z");
1171 dateTime =
"2008-06-05T11:40:04Z";
1172 CModification* pNewModification = miriamInfo.createModification(dateTime);
1173 CPPUNIT_ASSERT(pNewModification != NULL);
1174 CPPUNIT_ASSERT(pNewModification->
getDate() == dateTime);
1175 CPPUNIT_ASSERT(miriamInfo.save() ==
true);
1180 CPPUNIT_ASSERT(pCompartment != NULL);
1181 miriamInfo.load(pCompartment->getKey());
1183 CPPUNIT_ASSERT(pDescriptions != NULL);
1184 CPPUNIT_ASSERT(pDescriptions->
size() == 1);
1186 CPPUNIT_ASSERT(pDescription != NULL);
1187 std::string predicate = pDescription->getPredicate();
1188 CPPUNIT_ASSERT(predicate ==
"is version of");
1189 std::string resource = pDescription->getResource();
1190 CPPUNIT_ASSERT(resource ==
"Gene Ontology");
1191 std::string
id = pDescription->getId();
1192 CPPUNIT_ASSERT(
id ==
"GO:0005623");
1197 pNewDescription->
setId(
id);
1198 CPPUNIT_ASSERT(pNewDescription != NULL);
1199 CPPUNIT_ASSERT(pNewDescription->
getPredicate() ==
"is version of");
1200 CPPUNIT_ASSERT(pNewDescription->
getResource() ==
"Gene Ontology");
1201 CPPUNIT_ASSERT(pNewDescription->
getId() ==
"GO:0001111");
1202 CPPUNIT_ASSERT(miriamInfo.save() ==
true);
1205 CPPUNIT_ASSERT(content.empty() ==
false);
1207 XMLInputStream inputstream(content.c_str(),
false);
1208 XMLNode node(inputstream);
1209 CPPUNIT_ASSERT(node.getName() ==
"sbml");
1210 unsigned int i, iMax = node.getNumChildren();
1211 CPPUNIT_ASSERT(iMax == 1);
1212 const XMLNode* pModelNode = &node.getChild(0);
1213 CPPUNIT_ASSERT(pModelNode != NULL);
1214 CPPUNIT_ASSERT(pModelNode->getName() ==
"model");
1215 iMax = pModelNode->getNumChildren();
1216 CPPUNIT_ASSERT(iMax > 0);
1218 const XMLNode* pModelAnnotation = &pModelNode->getChild(0);
1219 CPPUNIT_ASSERT(pModelAnnotation != NULL);
1220 CPPUNIT_ASSERT(pModelAnnotation->getName() ==
"annotation");
1223 iMax = pModelAnnotation->getNumChildren();
1224 CPPUNIT_ASSERT(iMax == 3);
1225 const XMLNode* pMIRIAM1 = NULL, *pMIRIAM2 = NULL, *pOther = NULL;
1227 for (
unsigned int i = 0; i < iMax; ++i)
1229 if (pModelAnnotation->getChild(i).getName() ==
"RDF")
1231 pMIRIAM1 = &pModelAnnotation->getChild(i);
1233 else if (pModelAnnotation->getChild(i).getName() ==
"COPASI")
1235 pMIRIAM2 = &pModelAnnotation->getChild(i);
1237 else if (pModelAnnotation->getChild(i).getName() ==
"SOMEANNOTATION")
1239 pOther = &pModelAnnotation->getChild(i);
1243 CPPUNIT_ASSERT(pMIRIAM1 != NULL);
1244 CPPUNIT_ASSERT(pMIRIAM2 != NULL);
1245 CPPUNIT_ASSERT(pOther != NULL);
1248 const XMLNamespaces*
ns = &pMIRIAM2->getNamespaces();
1249 CPPUNIT_ASSERT(ns != NULL);
1250 int index = ns->getIndex(
"http://www.copasi.org/static/sbml");
1251 CPPUNIT_ASSERT(index != -1);
1252 CPPUNIT_ASSERT(ns->getPrefix(index) ==
"");
1253 iMax = pMIRIAM2->getNumChildren();
1254 CPPUNIT_ASSERT(iMax == 1);
1255 pMIRIAM2 = &pMIRIAM2->getChild(0);
1256 CPPUNIT_ASSERT(pMIRIAM2 != NULL);
1257 CPPUNIT_ASSERT(pMIRIAM2->getName() ==
"RDF");
1258 CPPUNIT_ASSERT(pMIRIAM2->getPrefix() ==
"rdf");
1259 ns = &pMIRIAM2->getNamespaces();
1260 CPPUNIT_ASSERT(ns != NULL);
1261 index = ns->getIndex(
"http://purl.org/dc/terms/");
1262 CPPUNIT_ASSERT(index != -1);
1263 CPPUNIT_ASSERT(ns->getPrefix(index) ==
"dcterms");
1264 index = ns->getIndex(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#");
1265 CPPUNIT_ASSERT(index != -1);
1266 CPPUNIT_ASSERT(ns->getPrefix(index) ==
"rdf");
1267 index = ns->getIndex(
"http://www.w3.org/2001/vcard-rdf/3.0#");
1268 CPPUNIT_ASSERT(index != -1);
1269 CPPUNIT_ASSERT(ns->getPrefix(index) ==
"vCard");
1271 CPPUNIT_ASSERT(pMIRIAM2->getNumChildren() == 1);
1272 pMIRIAM2 = &pMIRIAM2->getChild(0);
1273 CPPUNIT_ASSERT(pMIRIAM2 != NULL);
1274 CPPUNIT_ASSERT(pMIRIAM2->getName() ==
"Description");
1275 iMax = pMIRIAM2->getNumChildren();
1276 CPPUNIT_ASSERT(iMax > 0);
1278 for (
unsigned int i = 0; i < iMax; ++i)
1280 if (pMIRIAM2->getChild(i).getName() ==
"modified")
1282 pMIRIAM2 = &pMIRIAM2->getChild(i);
1286 CPPUNIT_ASSERT(pMIRIAM2->getName() ==
"modified");
1287 CPPUNIT_ASSERT(pMIRIAM2->getNumChildren() == 1);
1288 pMIRIAM2 = &pMIRIAM2->getChild(0);
1289 CPPUNIT_ASSERT(pMIRIAM2 != NULL);
1290 CPPUNIT_ASSERT(pMIRIAM2->getName() ==
"Bag");
1291 CPPUNIT_ASSERT(pMIRIAM2->getNumChildren() == 2);
1294 CPPUNIT_ASSERT(pMIRIAM1->getName() ==
"RDF");
1295 CPPUNIT_ASSERT(pMIRIAM1->getPrefix() ==
"rdf");
1296 ns = &pMIRIAM1->getNamespaces();
1297 CPPUNIT_ASSERT(ns != NULL);
1298 index = ns->getIndex(
"http://purl.org/dc/terms/");
1299 CPPUNIT_ASSERT(index != -1);
1300 CPPUNIT_ASSERT(ns->getPrefix(index) ==
"dcterms");
1301 index = ns->getIndex(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#");
1302 CPPUNIT_ASSERT(index != -1);
1303 CPPUNIT_ASSERT(ns->getPrefix(index) ==
"rdf");
1304 index = ns->getIndex(
"http://www.w3.org/2001/vcard-rdf/3.0#");
1305 CPPUNIT_ASSERT(index != -1);
1306 CPPUNIT_ASSERT(ns->getPrefix(index) ==
"vCard");
1310 CPPUNIT_ASSERT(pMIRIAM1->getNumChildren() == 1);
1311 pMIRIAM1 = &pMIRIAM1->getChild(0);
1312 CPPUNIT_ASSERT(pMIRIAM1 != NULL);
1313 CPPUNIT_ASSERT(pMIRIAM1->getName() ==
"Description");
1314 iMax = pMIRIAM1->getNumChildren();
1315 CPPUNIT_ASSERT(iMax > 0);
1317 for (
unsigned int i = 0; i < iMax; ++i)
1319 if (pMIRIAM1->getChild(i).getName() ==
"modified")
1321 pMIRIAM1 = &pMIRIAM1->getChild(i);
1325 CPPUNIT_ASSERT(pMIRIAM1->getName() ==
"modified");
1326 CPPUNIT_ASSERT(pMIRIAM1->getNumChildren() == 1);
1327 pMIRIAM1 = &pMIRIAM1->getChild(0);
1328 CPPUNIT_ASSERT(pMIRIAM1 != NULL);
1329 CPPUNIT_ASSERT(pMIRIAM1->getName() ==
"W3CDTF");
1330 CPPUNIT_ASSERT(pMIRIAM1->getNumChildren() == 1);
1331 pMIRIAM1 = &pMIRIAM1->getChild(0);
1332 CPPUNIT_ASSERT(pMIRIAM1 != NULL);
1333 CPPUNIT_ASSERT(pMIRIAM1->getCharacters() ==
"2008-06-05T11:40:04Z");
1337 iMax = pModelNode->getNumChildren();
1338 const XMLNode* pListOfCompartments = NULL;
1340 for (i = 0; i < iMax; ++i)
1342 if (pModelNode->getChild(i).getName() ==
"listOfCompartments")
1344 pListOfCompartments = &pModelNode->getChild(i);
1349 CPPUNIT_ASSERT(pListOfCompartments != NULL);
1350 iMax = pListOfCompartments->getNumChildren();
1352 CPPUNIT_ASSERT(iMax == 1);
1353 const XMLNode* pCompartmentNode = &pListOfCompartments->getChild(0);
1354 CPPUNIT_ASSERT(pCompartmentNode != NULL);
1355 CPPUNIT_ASSERT(pCompartmentNode->getName() ==
"compartment");
1356 iMax = pCompartmentNode->getNumChildren();
1357 CPPUNIT_ASSERT(iMax > 0);
1359 const XMLNode* pAnnotation = &pCompartmentNode->getChild(0);
1360 CPPUNIT_ASSERT(pAnnotation != NULL);
1361 CPPUNIT_ASSERT(pAnnotation->getName() ==
"annotation");
1364 iMax = pAnnotation->getNumChildren();
1365 CPPUNIT_ASSERT(iMax == 3);
1371 for (
unsigned int i = 0; i < iMax; ++i)
1373 if (pAnnotation->getChild(i).getName() ==
"RDF")
1375 pMIRIAM1 = &pAnnotation->getChild(i);
1377 else if (pAnnotation->getChild(i).getName() ==
"COPASI")
1379 pMIRIAM2 = &pAnnotation->getChild(i);
1381 else if (pAnnotation->getChild(i).getName() ==
"SOMEANNOTATION")
1383 pOther = &pAnnotation->getChild(i);
1387 CPPUNIT_ASSERT(pMIRIAM1 != NULL);
1388 CPPUNIT_ASSERT(pMIRIAM2 != NULL);
1389 CPPUNIT_ASSERT(pOther != NULL);
1392 ns = &pMIRIAM2->getNamespaces();
1393 CPPUNIT_ASSERT(ns != NULL);
1394 index = ns->getIndex(
"http://www.copasi.org/static/sbml");
1395 CPPUNIT_ASSERT(index != -1);
1396 CPPUNIT_ASSERT(ns->getPrefix(index) ==
"");
1397 iMax = pMIRIAM2->getNumChildren();
1398 CPPUNIT_ASSERT(iMax == 1);
1399 pMIRIAM2 = &pMIRIAM2->getChild(0);
1400 CPPUNIT_ASSERT(pMIRIAM2 != NULL);
1401 CPPUNIT_ASSERT(pMIRIAM2->getName() ==
"RDF");
1402 CPPUNIT_ASSERT(pMIRIAM2->getPrefix() ==
"rdf");
1403 ns = &pMIRIAM2->getNamespaces();
1404 CPPUNIT_ASSERT(ns != NULL);
1405 index = ns->getIndex(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#");
1406 CPPUNIT_ASSERT(index != -1);
1407 CPPUNIT_ASSERT(ns->getPrefix(index) ==
"rdf");
1409 CPPUNIT_ASSERT(pMIRIAM2->getNumChildren() == 1);
1410 pMIRIAM2 = &pMIRIAM2->getChild(0);
1411 CPPUNIT_ASSERT(pMIRIAM2 != NULL);
1412 CPPUNIT_ASSERT(pMIRIAM2->getName() ==
"Description");
1413 CPPUNIT_ASSERT(pMIRIAM2->getNumChildren() == 1);
1414 pMIRIAM2 = &pMIRIAM2->getChild(0);
1415 CPPUNIT_ASSERT(pMIRIAM2 != NULL);
1416 CPPUNIT_ASSERT(pMIRIAM2->getName() ==
"isVersionOf");
1417 CPPUNIT_ASSERT(pMIRIAM2->getNumChildren() == 1);
1418 pMIRIAM2 = &pMIRIAM2->getChild(0);
1419 CPPUNIT_ASSERT(pMIRIAM2 != NULL);
1420 CPPUNIT_ASSERT(pMIRIAM2->getName() ==
"Bag");
1421 CPPUNIT_ASSERT(pMIRIAM2->getNumChildren() == 2);
1422 CPPUNIT_ASSERT(pMIRIAM2->getChild(0).getName() ==
"li");
1423 CPPUNIT_ASSERT(pMIRIAM2->getChild(1).getName() ==
"li");
1426 CPPUNIT_ASSERT(pMIRIAM1->getName() ==
"RDF");
1427 CPPUNIT_ASSERT(pMIRIAM1->getPrefix() ==
"rdf");
1428 ns = &pMIRIAM1->getNamespaces();
1429 CPPUNIT_ASSERT(ns != NULL);
1430 index = ns->getIndex(
"http://purl.org/dc/terms/");
1431 CPPUNIT_ASSERT(index != -1);
1432 CPPUNIT_ASSERT(ns->getPrefix(index) ==
"dcterms");
1433 index = ns->getIndex(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#");
1434 CPPUNIT_ASSERT(index != -1);
1435 CPPUNIT_ASSERT(ns->getPrefix(index) ==
"rdf");
1436 index = ns->getIndex(
"http://www.w3.org/2001/vcard-rdf/3.0#");
1437 CPPUNIT_ASSERT(index != -1);
1438 CPPUNIT_ASSERT(ns->getPrefix(index) ==
"vCard");
1440 CPPUNIT_ASSERT(pMIRIAM1->getNumChildren() == 1);
1441 pMIRIAM1 = &pMIRIAM1->getChild(0);
1442 CPPUNIT_ASSERT(pMIRIAM1 != NULL);
1443 CPPUNIT_ASSERT(pMIRIAM1->getName() ==
"Description");
1444 CPPUNIT_ASSERT(pMIRIAM1->getNumChildren() == 1);
1445 pMIRIAM1 = &pMIRIAM1->getChild(0);
1446 CPPUNIT_ASSERT(pMIRIAM1 != NULL);
1447 CPPUNIT_ASSERT(pMIRIAM1->getName() ==
"isVersionOf");
1448 CPPUNIT_ASSERT(pMIRIAM1->getNumChildren() == 1);
1449 pMIRIAM1 = &pMIRIAM1->getChild(0);
1450 CPPUNIT_ASSERT(pMIRIAM1 != NULL);
1451 CPPUNIT_ASSERT(pMIRIAM1->getName() ==
"Bag");
1452 CPPUNIT_ASSERT(pMIRIAM1->getNumChildren() == 2);
1453 CPPUNIT_ASSERT(pMIRIAM1->getChild(0).getName() ==
"li");
1454 CPPUNIT_ASSERT(pMIRIAM1->getChild(1).getName() ==
"li");
1457 CPPUNIT_ASSERT(result ==
true);
static const char * MODEL_STRING8
static CCopasiDataModel * pCOPASIDATAMODEL
void load(const std::string &key="")
std::string exportSBMLToString(CProcessReport *pExportHandler, int sbmlLevel, int sbmlVersion)
virtual size_t size() const
void setResource(const std::string &resource)
const std::string & getMiriamAnnotation() const
const std::string & getId() const
const std::string & getDate() const
void setPredicate(const std::string &predicate)
const std::string & getKey() const
CCopasiVectorNS< CCompartment > & getCompartments()
std::string getPredicate() const
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
std::string getResource() const
void setId(const std::string &id)