CEvent::CEvent(const CEvent & src, const CCopasiContainer * pParent): CCopasiContainer(src, pParent), CAnnotation(src), mpModel(static_cast<CModel *>(getObjectAncestor("Model"))), mAssignments(src.mAssignments, this), mDelayAssignment(src.mDelayAssignment), mFireAtInitialTime(src.mFireAtInitialTime), mPersistentTrigger(src.mPersistentTrigger), mpTriggerExpression(src.mpTriggerExpression != NULL ? new CExpression(*src.mpTriggerExpression, this) : NULL), mpDelayExpression(src.mpDelayExpression != NULL ? new CExpression(*src.mpDelayExpression, this) : NULL), mpPriorityExpression(src.mpPriorityExpression != NULL ? new CExpression(*src.mpPriorityExpression, this) : NULL), mType(src.mType) { mKey = (CCopasiRootContainer::getKeyFactory()->add(getObjectType(), this)); initObjects(); setMiriamAnnotation(src.getMiriamAnnotation(), mKey, src.mKey); }
bool CQRDFTreeView::enterProtected() { clear(); CCopasiObject *pObject = dynamic_cast< CCopasiObject * >(CCopasiRootContainer::getKeyFactory()->get(mKey)); if (pObject != NULL) { CModelEntity * pEntity = NULL; CEvent * pEvent = NULL; CReaction * pReaction = NULL; CFunction * pFunction = NULL; const std::string * pMiriamAnnotation = NULL; if ((pEntity = dynamic_cast< CModelEntity * >(pObject)) != NULL) pMiriamAnnotation = &pEntity->getMiriamAnnotation(); else if ((pEvent = dynamic_cast< CEvent * >(pObject)) != NULL) pMiriamAnnotation = &pEvent->getMiriamAnnotation(); else if ((pReaction = dynamic_cast< CReaction * >(pObject)) != NULL) pMiriamAnnotation = &pReaction->getMiriamAnnotation(); else if ((pFunction = dynamic_cast< CFunction * >(pObject)) != NULL) pMiriamAnnotation = &pFunction->getMiriamAnnotation(); if (pMiriamAnnotation && *pMiriamAnnotation != "") mpGraph = CRDFParser::graphFromXml(*pMiriamAnnotation); } CCopasiMessage::clearDeque(); if (CCopasiMessage::size() != 0) { QString Message = FROM_UTF8(CCopasiMessage::getAllMessageText()); CQMessageBox::warning(this, QString("RDF Warning"), Message, QMessageBox::Ok, QMessageBox::Ok); } if (mpGraph == NULL) mpGraph = new CRDFGraph; // We make sure that we always have an about node. mpGraph->createAboutNode(mKey); // We iterate of all triplets std::set< CRDFTriplet >::const_iterator it = mpGraph->getTriplets().begin(); std::set< CRDFTriplet >::const_iterator end = mpGraph->getTriplets().end(); for (; it != end; ++it) { CQRDFTreeViewItem * pSubjectItem = find(it->pSubject); if (pSubjectItem == NULL) { pSubjectItem = new CQRDFTreeViewItem(mpTreeWidget, NULL); insert(it->pSubject, pSubjectItem); // Display the subject information const CRDFSubject & Subject = it->pSubject->getSubject(); switch (Subject.getType()) { case CRDFSubject::RESOURCE: pSubjectItem->setText(COL_SUBJECT, FROM_UTF8(Subject.getResource())); break; case CRDFSubject::BLANK_NODE: pSubjectItem->setText(COL_SUBJECT, FROM_UTF8(Subject.getBlankNodeID())); break; } } CQRDFTreeViewItem * pObjectItem = NULL; if (it->Predicate.getURI() == "http://www.w3.org/1999/02/22-rdf-syntax-ns#subject") { pObjectItem = new CQRDFTreeViewItem(pSubjectItem, NULL); insert(it->pObject, pObjectItem); } else pObjectItem = find(it->pObject); if (pObjectItem == NULL) { pObjectItem = new CQRDFTreeViewItem(pSubjectItem, NULL); insert(it->pObject, pObjectItem); } else { QTreeWidgetItem * pParent = pObjectItem->parent(); if (pParent == NULL) { mpTreeWidget->invisibleRootItem()->removeChild(pObjectItem); pSubjectItem->addChild(pObjectItem); } else { pParent->removeChild(pObjectItem); pSubjectItem->addChild(pObjectItem); } } pObjectItem->setTriplet(*it); } mpTreeWidget->setFocus(); return true; }