COPASI API  4.16.103
Public Member Functions | Private Attributes | List of all members
CMIRIAMInfo Class Reference

#include <CModelMIRIAMInfo.h>

Inheritance diagram for CMIRIAMInfo:
Inheritance graph
[legend]
Collaboration diagram for CMIRIAMInfo:
Collaboration graph
[legend]

Public Member Functions

 CMIRIAMInfo ()
 
CBiologicalDescriptioncreateBiologicalDescription ()
 
CCreatorcreateCreator (const std::string &objectName)
 
CModificationcreateModification (const std::string &objectName)
 
CReferencecreateReference (const std::string &objectName)
 
const CCopasiVector
< CBiologicalDescription > & 
getBiologicalDescriptions () const
 
const std::string getCreatedDT () const
 
const CCopasiVector< CCreator > & getCreators () const
 
virtual const std::string & getKey () const
 
const CCopasiVector
< CModification > & 
getModifications () const
 
CRDFGraphgetRDFGraph ()
 
const CCopasiVector< CReference > & getReferences () const
 
void load (const std::string &key="")
 
void loadBiologicalDescriptions ()
 
void loadCreators ()
 
void loadModifications ()
 
void loadReferences ()
 
bool removeBiologicalDescription (int position)
 
bool removeCreator (int position)
 
bool removeModification (int position)
 
bool removeReference (int position)
 
bool save ()
 
void setCreatedDT (const std::string &dt)
 
 ~CMIRIAMInfo ()
 
- Public Member Functions inherited from CCopasiContainer
virtual bool add (CCopasiObject *pObject, const bool &adopt=true)
 
 CCopasiContainer (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=CCopasiObject::Container)
 
 CCopasiContainer (const CCopasiContainer &src, const CCopasiContainer *pParent=NULL)
 
virtual std::string getChildObjectUnits (const CCopasiObject *pObject) const
 
virtual const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
virtual const objectMapgetObjects () const
 
virtual std::string getUnits () const
 
virtual const CCopasiObjectgetValueObject () const
 
virtual bool remove (CCopasiObject *pObject)
 
virtual ~CCopasiContainer ()
 
- Public Member Functions inherited from CCopasiObject
void addDirectDependency (const CCopasiObject *pObject)
 
 CCopasiObject (const CCopasiObject &src, const CCopasiContainer *pParent=NULL)
 
void clearDirectDependencies ()
 
void clearRefresh ()
 
bool dependsOn (DataObjectSet candidates, const DataObjectSet &context=DataObjectSet()) const
 
void getAllDependencies (DataObjectSet &dependencies, const DataObjectSet &context) const
 
virtual CCopasiObjectName getCN () const
 
virtual const DataObjectSetgetDirectDependencies (const DataObjectSet &context=DataObjectSet()) const
 
CCopasiContainergetObjectAncestor (const std::string &type) const
 
CCopasiDataModelgetObjectDataModel ()
 
const CCopasiDataModelgetObjectDataModel () const
 
virtual std::string getObjectDisplayName (bool regular=true, bool richtext=false) const
 
const std::string & getObjectName () const
 
CCopasiContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
virtual RefreshgetRefresh () const
 
UpdateMethodgetUpdateMethod () const
 
virtual voidgetValuePointer () const
 
bool hasCircularDependencies (DataObjectSet &candidates, DataObjectSet &verified, const DataObjectSet &context) const
 
bool hasUpdateMethod () const
 
bool isArray () const
 
bool isContainer () const
 
bool isDataModel () const
 
bool isMatrix () const
 
bool isNameVector () const
 
bool isNonUniqueName () const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const
 
bool isReference () const
 
bool isRoot () const
 
bool isSeparator () const
 
bool isStaticString () const
 
bool isValueBool () const
 
bool isValueDbl () const
 
bool isValueInt () const
 
bool isValueInt64 () const
 
bool isValueString () const
 
bool isVector () const
 
virtual bool mustBeDeleted (const DataObjectSet &deletedObjects) const
 
virtual void print (std::ostream *ostream) const
 
void removeDirectDependency (const CCopasiObject *pObject)
 
void setDirectDependencies (const DataObjectSet &directDependencies)
 
bool setObjectName (const std::string &name)
 
virtual bool setObjectParent (const CCopasiContainer *pParent)
 
void setObjectValue (const C_FLOAT64 &value)
 
void setObjectValue (const C_INT32 &value)
 
void setObjectValue (const bool &value)
 
template<class CType >
void setRefresh (CType *pType, void(CType::*method)(void))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_FLOAT64 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_INT32 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const bool &))
 
virtual ~CCopasiObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
virtual ~CObjectInterface ()
 

Private Attributes

CCopasiVector
< CBiologicalDescription
mBiologicalDescriptions
 
CRDFTriplet mCreated
 
CRDFObject mCreatedObj
 
CCopasiVector< CCreatormCreators
 
std::string mKey
 
CCopasiVector< CModificationmModifications
 
CRDFGraphmpRDFGraph
 
CCopasiVector< CReferencemReferences
 
CRDFTriplet mTriplet
 

Additional Inherited Members

- Public Types inherited from CCopasiContainer
typedef std::multimap
< std::string, CCopasiObject * > 
objectMap
 
- Public Types inherited from CCopasiObject
typedef std::set< const
CCopasiObject * > 
DataObjectSet
 
typedef std::vector< Refresh * > DataUpdateSequence
 
- Public Types inherited from CObjectInterface
typedef std::set< const
CObjectInterface * > 
ObjectSet
 
typedef std::vector
< CObjectInterface * > 
UpdateSequence
 
- Static Public Member Functions inherited from CCopasiObject
static std::vector< Refresh * > buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
 
static void setRenameHandler (CRenameHandler *rh)
 
- Static Public Attributes inherited from CCopasiContainer
static const std::vector
< CCopasiContainer * > 
EmptyList
 
- Protected Types inherited from CCopasiObject
enum  Flag {
  Container = 0x1, Vector = 0x2, Matrix = 0x4, NameVector = 0x8,
  Reference = 0x10, ValueBool = 0x20, ValueInt = 0x40, ValueInt64 = 0x80,
  ValueDbl = 0x100, NonUniqueName = 0x200, StaticString = 0x400, ValueString = 0x800,
  Separator = 0x1000, ModelEntity = 0x2000, Array = 0x4000, DataModel = 0x8000,
  Root = 0x10000, Gui = 0x20000
}
 
- Protected Member Functions inherited from CCopasiContainer
template<class CType >
CCopasiObjectaddMatrixReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddObjectReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddVectorReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
void initObjects ()
 
- Protected Member Functions inherited from CCopasiObject
 CCopasiObject ()
 
 CCopasiObject (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=0)
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

CMIRIAMInfo: Stores all MIRIAM info for a Model.

Definition at line 38 of file CModelMIRIAMInfo.h.

Constructor & Destructor Documentation

CMIRIAMInfo::CMIRIAMInfo ( )

Definition at line 37 of file CModelMIRIAMInfo.cpp.

37  :
38  CCopasiContainer("CMIRIAMInfoObject", NULL, "CMIRIAMInfo"),
39  mKey(""),
40  mCreators("Creators", this),
41  mReferences("References", this),
42  mModifications("Modifieds", this),
43  mBiologicalDescriptions("BiologicalDescriptions", this),
44  mCreatedObj(),
45  mpRDFGraph(NULL),
46  mTriplet(NULL, CRDFPredicate::about, NULL),
47  mCreated()
48 {}
CCopasiVector< CCreator > mCreators
CCopasiVector< CBiologicalDescription > mBiologicalDescriptions
CRDFTriplet mTriplet
CRDFTriplet mCreated
CCopasiVector< CModification > mModifications
CCopasiVector< CReference > mReferences
std::string mKey
CRDFObject mCreatedObj
CRDFGraph * mpRDFGraph
CMIRIAMInfo::~CMIRIAMInfo ( )

Definition at line 50 of file CModelMIRIAMInfo.cpp.

References mpRDFGraph, and pdelete.

#define pdelete(p)
Definition: copasi.h:215
CRDFGraph * mpRDFGraph

Member Function Documentation

CBiologicalDescription * CMIRIAMInfo::createBiologicalDescription ( )

Definition at line 312 of file CModelMIRIAMInfo.cpp.

References CCopasiVector< T >::add(), CRDFGraph::addTriplet(), CRDFGraph::getAboutNode(), CRDFNode::getSubject(), mBiologicalDescriptions, mpRDFGraph, CRDFObject::RESOURCE, CRDFObject::setResource(), and CRDFObject::setType().

Referenced by CQBiologicalDescriptionDM::insertRows().

313 {
314  const CRDFSubject & Subject = mpRDFGraph->getAboutNode()->getSubject();
315  CRDFObject Object;
317  Object.setResource("", false);
318 
319  CRDFTriplet Triplet = mpRDFGraph->addTriplet(Subject, std::string("---"), Object);
320 
321  if (!Triplet)
322  return NULL;
323 
324  CBiologicalDescription * pBiologicalDescription =
325  new CBiologicalDescription(Triplet);
326 
327  if (!mBiologicalDescriptions.add(pBiologicalDescription, true))
328  {
329  delete pBiologicalDescription;
330  return NULL;
331  }
332 
333  return pBiologicalDescription;
334 }
const CRDFSubject & getSubject() const
Definition: CRDFNode.cpp:69
CCopasiVector< CBiologicalDescription > mBiologicalDescriptions
void setType(const eObjectType &type)
Definition: CRDFObject.cpp:82
CRDFTriplet addTriplet(const CRDFSubject &subject, const CRDFPredicate &predicate, const CRDFObject &object)
Definition: CRDFGraph.cpp:141
virtual bool add(const CType &src)
void setResource(const std::string &resource, const bool &isLocal)
Definition: CRDFObject.cpp:88
CRDFGraph * mpRDFGraph
const CRDFNode * getAboutNode() const
Definition: CRDFGraph.cpp:82
CCreator * CMIRIAMInfo::createCreator ( const std::string &  objectName)

Definition at line 59 of file CModelMIRIAMInfo.cpp.

References CCopasiVector< T >::add(), CRDFGraph::addTriplet(), CRDFObject::BLANK_NODE, CRDFPredicate::dcterms_creator, CRDFGraph::generatedNodeId(), CRDFGraph::getAboutNode(), CRDFNode::getSubject(), CRDFPredicate::getURI(), mCreators, mpRDFGraph, CRDFObject::setBlankNodeId(), and CRDFObject::setType().

Referenced by CQCreatorDM::insertRows().

60 {
61  const CRDFSubject & Subject = mpRDFGraph->getAboutNode()->getSubject();
62  CRDFObject Object;
64  std::string Id = mpRDFGraph->generatedNodeId();
65  Object.setBlankNodeId(Id);
66 
67  CRDFTriplet Triplet =
68  mpRDFGraph->addTriplet(Subject,
70  Object);
71 
72  if (!Triplet)
73  return NULL;
74 
75  CCreator * pCreator = new CCreator(Triplet);
76 
77  if (!mCreators.add(pCreator, true))
78  {
79  delete pCreator;
80  return NULL;
81  }
82 
83  return pCreator;
84 }
CCopasiVector< CCreator > mCreators
const CRDFSubject & getSubject() const
Definition: CRDFNode.cpp:69
void setType(const eObjectType &type)
Definition: CRDFObject.cpp:82
CRDFTriplet addTriplet(const CRDFSubject &subject, const CRDFPredicate &predicate, const CRDFObject &object)
Definition: CRDFGraph.cpp:141
virtual bool add(const CType &src)
const std::string & getURI() const
CRDFGraph * mpRDFGraph
const CRDFNode * getAboutNode() const
Definition: CRDFGraph.cpp:82
void setBlankNodeId(const std::string &blankNodeId)
Definition: CRDFObject.cpp:100
std::string generatedNodeId(const std::string &existingId="")
Definition: CRDFGraph.cpp:380
CModification * CMIRIAMInfo::createModification ( const std::string &  objectName)

Definition at line 248 of file CModelMIRIAMInfo.cpp.

References CCopasiVector< T >::add(), CRDFGraph::addTriplet(), CRDFObject::BLANK_NODE, CRDFPredicate::dcterms_modified, CRDFGraph::generatedNodeId(), CRDFGraph::getAboutNode(), CRDFNode::getSubject(), CRDFPredicate::getURI(), mModifications, mpRDFGraph, CRDFObject::setBlankNodeId(), CModification::setDate(), and CRDFObject::setType().

Referenced by CQModifiedDM::insertRows().

249 {
250  const CRDFSubject & Subject = mpRDFGraph->getAboutNode()->getSubject();
251  CRDFObject Object;
253  std::string Id = mpRDFGraph->generatedNodeId();
254  Object.setBlankNodeId(Id);
255 
256  CRDFTriplet Triplet =
257  mpRDFGraph->addTriplet(Subject,
259  Object);
260 
261  if (!Triplet)
262  return NULL;
263 
264  CModification * pModification = new CModification(Triplet);
265 
266  if (dateTime.size())
267  pModification->setDate(dateTime);
268 
269  if (!mModifications.add(pModification, true))
270  {
271  delete pModification;
272  return NULL;
273  }
274 
275  return pModification;
276 }
const CRDFSubject & getSubject() const
Definition: CRDFNode.cpp:69
void setType(const eObjectType &type)
Definition: CRDFObject.cpp:82
CRDFTriplet addTriplet(const CRDFSubject &subject, const CRDFPredicate &predicate, const CRDFObject &object)
Definition: CRDFGraph.cpp:141
virtual bool add(const CType &src)
CCopasiVector< CModification > mModifications
void setDate(const std::string &date)
Definition: CModified.cpp:67
const std::string & getURI() const
CRDFGraph * mpRDFGraph
const CRDFNode * getAboutNode() const
Definition: CRDFGraph.cpp:82
void setBlankNodeId(const std::string &blankNodeId)
Definition: CRDFObject.cpp:100
std::string generatedNodeId(const std::string &existingId="")
Definition: CRDFGraph.cpp:380
CReference * CMIRIAMInfo::createReference ( const std::string &  objectName)

Definition at line 137 of file CModelMIRIAMInfo.cpp.

References CCopasiVector< T >::add(), CRDFGraph::addTriplet(), CRDFObject::BLANK_NODE, CRDFPredicate::dcterms_bibliographicCitation, CRDFGraph::generatedNodeId(), CRDFGraph::getAboutNode(), CRDFNode::getSubject(), CRDFPredicate::getURI(), mpRDFGraph, mReferences, CRDFObject::setBlankNodeId(), and CRDFObject::setType().

Referenced by CQReferenceDM::insertRows().

138 {
139  const CRDFSubject & Subject = mpRDFGraph->getAboutNode()->getSubject();
140  CRDFObject Object;
142  std::string Id = mpRDFGraph->generatedNodeId();
143  Object.setBlankNodeId(Id);
144 
145  CRDFTriplet Triplet =
146  mpRDFGraph->addTriplet(Subject,
148  Object);
149 
150  if (!Triplet)
151  return NULL;
152 
153  CReference * pReference = new CReference(Triplet);
154 
155  if (!mReferences.add(pReference, true))
156  {
157  delete pReference;
158  return NULL;
159  }
160 
161  return pReference;
162 }
const CRDFSubject & getSubject() const
Definition: CRDFNode.cpp:69
void setType(const eObjectType &type)
Definition: CRDFObject.cpp:82
CRDFTriplet addTriplet(const CRDFSubject &subject, const CRDFPredicate &predicate, const CRDFObject &object)
Definition: CRDFGraph.cpp:141
virtual bool add(const CType &src)
CCopasiVector< CReference > mReferences
const std::string & getURI() const
CRDFGraph * mpRDFGraph
const CRDFNode * getAboutNode() const
Definition: CRDFGraph.cpp:82
void setBlankNodeId(const std::string &blankNodeId)
Definition: CRDFObject.cpp:100
std::string generatedNodeId(const std::string &existingId="")
Definition: CRDFGraph.cpp:380
const CCopasiVector< CBiologicalDescription > & CMIRIAMInfo::getBiologicalDescriptions ( ) const
const std::string CMIRIAMInfo::getCreatedDT ( ) const

Definition at line 212 of file CModelMIRIAMInfo.cpp.

References CRDFPredicate::dcterms_W3CDTF, CRDFNode::getFieldValue(), mCreated, and CRDFTriplet::pObject.

Referenced by CQMiriamWidget::showEvent(), CQMiriamWidget::slotCreatedDTChanged(), CQMiriamWidget::update(), and CSBMLExporter::updateMIRIAMAnnotation().

213 {
214  if (!mCreated)
215  return "";
216 
218 }
CRDFTriplet mCreated
const std::string & getFieldValue(const CRDFPredicate::ePredicateType &predicate) const
Definition: CRDFNode.cpp:113
CRDFNode * pObject
Definition: CRDFTriplet.h:42
const CCopasiVector< CCreator > & CMIRIAMInfo::getCreators ( ) const
const std::string & CMIRIAMInfo::getKey ( ) const
virtual

Reimplemented from CCopasiObject.

Definition at line 475 of file CModelMIRIAMInfo.cpp.

References mKey.

Referenced by CQMiriamWidget::update().

476 {return mKey;}
std::string mKey
const CCopasiVector< CModification > & CMIRIAMInfo::getModifications ( ) const
CRDFGraph * CMIRIAMInfo::getRDFGraph ( )

Definition at line 53 of file CModelMIRIAMInfo.cpp.

References mpRDFGraph.

54 {return mpRDFGraph;}
CRDFGraph * mpRDFGraph
const CCopasiVector< CReference > & CMIRIAMInfo::getReferences ( ) const
void CMIRIAMInfo::load ( const std::string &  key = "")

Definition at line 399 of file CModelMIRIAMInfo.cpp.

References CAnnotation::castObject(), CRDFGraph::createAboutNode(), CRDFPredicate::dcterms_created, CKeyFactory::get(), CRDFNode::getDescendantsWithPredicate(), CCopasiObject::getKey(), CCopasiRootContainer::getKeyFactory(), CAnnotation::getMiriamAnnotation(), CRDFNode::getPath(), CRDFParser::graphFromXml(), loadBiologicalDescriptions(), loadCreators(), loadModifications(), loadReferences(), mCreated, mKey, mpRDFGraph, mTriplet, pdelete, and CRDFTriplet::pObject.

Referenced by CQMiriamWidget::showEvent(), test000092::test_miriam_export_8(), test000092::test_miriam_export_9(), test000092::test_miriam_import_1(), CQMiriamWidget::update(), and CSBMLExporter::updateMIRIAMAnnotation().

400 {
402 
403  mKey = key;
404  CCopasiObject * pCopasiObject = dynamic_cast< CCopasiObject * >(CCopasiRootContainer::getKeyFactory()->get(mKey));
405 
406  if (pCopasiObject != NULL)
407  {
408  const std::string * pMiriamAnnotation = NULL;
409 
410  CAnnotation * pAnnotation = CAnnotation::castObject(pCopasiObject);
411 
412  if (pAnnotation != NULL)
413  {
414  pMiriamAnnotation = &pAnnotation->getMiriamAnnotation();
415  }
416 
417  if (pMiriamAnnotation && *pMiriamAnnotation != "")
418  mpRDFGraph = CRDFParser::graphFromXml(*pMiriamAnnotation);
419  }
420 
421  if (mpRDFGraph == NULL)
422  mpRDFGraph = new CRDFGraph;
423 
424  // We make sure that we always have an about node.
425 
426  if (pCopasiObject != NULL)
427  mTriplet.pObject = mpRDFGraph->createAboutNode(pCopasiObject->getKey());
428  else
430 
431  // Load the created date if set;
433  std::set< CRDFTriplet > Triples =
435 
436  if (Triples.size() > 0)
437  mCreated = *Triples.begin();
438  else
439  mCreated = CRDFTriplet(); // This is an invalid triplet, i.e., !mCreated is true.
440 
441  loadCreators();
442  loadReferences();
445 
446  return;
447 }
CRDFNode * createAboutNode(const std::string &key)
Definition: CRDFGraph.cpp:416
#define pdelete(p)
Definition: copasi.h:215
std::set< CRDFTriplet > getDescendantsWithPredicate(const CRDFPredicate &predicate) const
Definition: CRDFNode.cpp:398
CCopasiObject * get(const std::string &key)
const std::string & getMiriamAnnotation() const
void loadBiologicalDescriptions()
virtual const std::string & getKey() const
static CAnnotation * castObject(CCopasiObject *pObject)
Definition: CAnnotation.cpp:32
CRDFTriplet mTriplet
CRDFTriplet mCreated
CRDFPredicate::Path getPath() const
Definition: CRDFNode.cpp:110
std::string mKey
static CKeyFactory * getKeyFactory()
CRDFGraph * mpRDFGraph
void loadModifications()
CRDFNode * pObject
Definition: CRDFTriplet.h:42
static CRDFGraph * graphFromXml(const std::string &xml)
Definition: CRDFParser.cpp:30
std::vector< ePredicateType > Path
Definition: CRDFPredicate.h:91
void CMIRIAMInfo::loadBiologicalDescriptions ( )

Definition at line 353 of file CModelMIRIAMInfo.cpp.

References CCopasiVector< T >::add(), CRDFPredicate::bqbiol_encodes, CRDFPredicate::bqbiol_hasPart, CRDFPredicate::bqbiol_hasVersion, CRDFPredicate::bqbiol_is, CRDFPredicate::bqbiol_isEncodedBy, CRDFPredicate::bqbiol_isHomologTo, CRDFPredicate::bqbiol_isPartOf, CRDFPredicate::bqbiol_isVersionOf, CRDFPredicate::bqbiol_occursIn, CRDFPredicate::bqmodel_is, CCopasiVector< T >::cleanup(), CRDFPredicate::copasi_encodes, CRDFPredicate::copasi_hasPart, CRDFPredicate::copasi_hasVersion, CRDFPredicate::copasi_is, CRDFPredicate::copasi_isEncodedBy, CRDFPredicate::copasi_isHomologTo, CRDFPredicate::copasi_isPartOf, CRDFPredicate::copasi_isVersionOf, CRDFPredicate::copasi_occursIn, CRDFPredicate::end, CRDFNode::getDescendantsWithPredicate(), CRDFNode::getPath(), mBiologicalDescriptions, mTriplet, and CRDFTriplet::pObject.

Referenced by load().

354 {
356 
357  CRDFPredicate::ePredicateType Predicates[] =
358  {
379  };
380 
382  std::set< CRDFTriplet > Triples;
383 
384  CRDFPredicate::ePredicateType * pPredicate = Predicates;
385  std::set< CRDFTriplet >::iterator it;
386  std::set< CRDFTriplet >::iterator end;
387 
388  for (; *pPredicate != CRDFPredicate::end; ++pPredicate)
389  {
390  Triples = mTriplet.pObject->getDescendantsWithPredicate(*pPredicate);
391  it = Triples.begin();
392  end = Triples.end();
393 
394  for (; it != end; ++it)
396  }
397 }
std::set< CRDFTriplet > getDescendantsWithPredicate(const CRDFPredicate &predicate) const
Definition: CRDFNode.cpp:398
CCopasiVector< CBiologicalDescription > mBiologicalDescriptions
CRDFTriplet mTriplet
CRDFPredicate::Path getPath() const
Definition: CRDFNode.cpp:110
virtual void cleanup()
virtual bool add(const CType &src)
CRDFNode * pObject
Definition: CRDFTriplet.h:42
std::vector< ePredicateType > Path
Definition: CRDFPredicate.h:91
void CMIRIAMInfo::loadCreators ( )

Definition at line 102 of file CModelMIRIAMInfo.cpp.

References CCopasiVector< T >::add(), CCopasiVector< T >::cleanup(), CRDFPredicate::dc_creator, CRDFPredicate::dcterms_creator, CRDFPredicate::end, CRDFNode::getDescendantsWithPredicate(), CRDFNode::getPath(), mCreators, mTriplet, and CRDFTriplet::pObject.

Referenced by load().

103 {
104  mCreators.cleanup();
105 
106  CRDFPredicate::ePredicateType Predicates[] =
107  {
111  };
112 
114  std::set< CRDFTriplet > Triples;
115 
116  CRDFPredicate::ePredicateType * pPredicate = Predicates;
117  std::set< CRDFTriplet >::iterator it;
118  std::set< CRDFTriplet >::iterator end;
119 
120  for (; *pPredicate != CRDFPredicate::end; ++pPredicate)
121  {
122  Triples =
124  it = Triples.begin();
125  end = Triples.end();
126 
127  for (; it != end; ++it)
128  mCreators.add(new CCreator(*it), true);
129  }
130 
131  return;
132 }
std::set< CRDFTriplet > getDescendantsWithPredicate(const CRDFPredicate &predicate) const
Definition: CRDFNode.cpp:398
CCopasiVector< CCreator > mCreators
CRDFTriplet mTriplet
CRDFPredicate::Path getPath() const
Definition: CRDFNode.cpp:110
virtual void cleanup()
virtual bool add(const CType &src)
CRDFNode * pObject
Definition: CRDFTriplet.h:42
std::vector< ePredicateType > Path
Definition: CRDFPredicate.h:91
void CMIRIAMInfo::loadModifications ( )

Definition at line 294 of file CModelMIRIAMInfo.cpp.

References CCopasiVector< T >::add(), CCopasiVector< T >::cleanup(), CRDFPredicate::dcterms_modified, CRDFNode::getDescendantsWithPredicate(), mModifications, mTriplet, and CRDFTriplet::pObject.

Referenced by load().

295 {
297 
298  std::set< CRDFTriplet > Triples =
300  std::set< CRDFTriplet >::iterator it = Triples.begin();
301  std::set< CRDFTriplet >::iterator end = Triples.end();
302 
303  for (; it != end; ++it)
304  mModifications.add(new CModification(*it), true);
305 
306  return;
307 }
std::set< CRDFTriplet > getDescendantsWithPredicate(const CRDFPredicate &predicate) const
Definition: CRDFNode.cpp:398
CRDFTriplet mTriplet
virtual void cleanup()
virtual bool add(const CType &src)
CCopasiVector< CModification > mModifications
CRDFNode * pObject
Definition: CRDFTriplet.h:42
void CMIRIAMInfo::loadReferences ( )

Definition at line 180 of file CModelMIRIAMInfo.cpp.

References CCopasiVector< T >::add(), CRDFPredicate::bqbiol_isDescribedBy, CRDFPredicate::bqmodel_isDescribedBy, CCopasiVector< T >::cleanup(), CRDFPredicate::dcterms_bibliographicCitation, CRDFPredicate::end, CRDFNode::getDescendantsWithPredicate(), CRDFNode::getPath(), mReferences, mTriplet, and CRDFTriplet::pObject.

Referenced by load().

181 {
183 
184  CRDFPredicate::ePredicateType Predicates[] =
185  {
190  };
191 
193  std::set< CRDFTriplet > Triples;
194 
195  CRDFPredicate::ePredicateType * pPredicate = Predicates;
196  std::set< CRDFTriplet >::iterator it;
197  std::set< CRDFTriplet >::iterator end;
198 
199  for (; *pPredicate != CRDFPredicate::end; ++pPredicate)
200  {
201  Triples = mTriplet.pObject->getDescendantsWithPredicate(*pPredicate);
202  it = Triples.begin();
203  end = Triples.end();
204 
205  for (; it != end; ++it)
206  mReferences.add(new CReference(*it), true);
207  }
208 
209  return;
210 }
std::set< CRDFTriplet > getDescendantsWithPredicate(const CRDFPredicate &predicate) const
Definition: CRDFNode.cpp:398
CRDFTriplet mTriplet
CRDFPredicate::Path getPath() const
Definition: CRDFNode.cpp:110
virtual void cleanup()
virtual bool add(const CType &src)
CCopasiVector< CReference > mReferences
CRDFNode * pObject
Definition: CRDFTriplet.h:42
std::vector< ePredicateType > Path
Definition: CRDFPredicate.h:91
bool CMIRIAMInfo::removeBiologicalDescription ( int  position)

Definition at line 336 of file CModelMIRIAMInfo.cpp.

References CBiologicalDescription::getTriplet(), mBiologicalDescriptions, mpRDFGraph, CRDFTriplet::pObject, CRDFTriplet::Predicate, CRDFTriplet::pSubject, CCopasiVector< T >::remove(), and CRDFGraph::removeTriplet().

Referenced by CQBiologicalDescriptionDM::removeRows().

337 {
338  CBiologicalDescription * pBiologicalDescription =
339  mBiologicalDescriptions[position];
340 
341  if (!pBiologicalDescription)
342  return false;
343 
344  const CRDFTriplet & Triplet = pBiologicalDescription->getTriplet();
345 
347  Triplet.Predicate,//CRDFPredicate::getURI(Triplet.Predicate),
348  Triplet.pObject);
349 
350  return mBiologicalDescriptions.remove(pBiologicalDescription);
351 }
void removeTriplet(CRDFNode *pSubject, const CRDFPredicate &predicate, CRDFNode *pObject)
Definition: CRDFGraph.cpp:277
CRDFNode * pSubject
Definition: CRDFTriplet.h:38
CCopasiVector< CBiologicalDescription > mBiologicalDescriptions
CRDFPredicate Predicate
Definition: CRDFTriplet.h:40
virtual void remove(const size_t &index)
CRDFGraph * mpRDFGraph
CRDFNode * pObject
Definition: CRDFTriplet.h:42
const CRDFTriplet & getTriplet() const
bool CMIRIAMInfo::removeCreator ( int  position)

Definition at line 86 of file CModelMIRIAMInfo.cpp.

References CCreator::getTriplet(), CRDFPredicate::getURI(), mCreators, mpRDFGraph, CRDFTriplet::pObject, CRDFTriplet::Predicate, CRDFTriplet::pSubject, CCopasiVector< T >::remove(), and CRDFGraph::removeTriplet().

Referenced by CQCreatorDM::removeRows().

87 {
88  CCreator * pCreator = mCreators[position];
89 
90  if (!pCreator)
91  return false;
92 
93  const CRDFTriplet & Triplet = pCreator->getTriplet();
94 
97  Triplet.pObject);
98 
99  return mCreators.remove(pCreator);
100 }
void removeTriplet(CRDFNode *pSubject, const CRDFPredicate &predicate, CRDFNode *pObject)
Definition: CRDFGraph.cpp:277
CRDFNode * pSubject
Definition: CRDFTriplet.h:38
CCopasiVector< CCreator > mCreators
const CRDFTriplet & getTriplet() const
Definition: CCreator.cpp:65
CRDFPredicate Predicate
Definition: CRDFTriplet.h:40
virtual void remove(const size_t &index)
const std::string & getURI() const
CRDFGraph * mpRDFGraph
CRDFNode * pObject
Definition: CRDFTriplet.h:42
bool CMIRIAMInfo::removeModification ( int  position)

Definition at line 278 of file CModelMIRIAMInfo.cpp.

References CModification::getTriplet(), CRDFPredicate::getURI(), mModifications, mpRDFGraph, CRDFTriplet::pObject, CRDFTriplet::Predicate, CRDFTriplet::pSubject, CCopasiVector< T >::remove(), and CRDFGraph::removeTriplet().

Referenced by CQModifiedDM::removeRows().

279 {
280  CModification * pModified = mModifications[position];
281 
282  if (!pModified)
283  return false;
284 
285  const CRDFTriplet & Triplet = pModified->getTriplet();
286 
289  Triplet.pObject);
290 
291  return mModifications.remove(pModified);
292 }
void removeTriplet(CRDFNode *pSubject, const CRDFPredicate &predicate, CRDFNode *pObject)
Definition: CRDFGraph.cpp:277
CRDFNode * pSubject
Definition: CRDFTriplet.h:38
const CRDFTriplet & getTriplet() const
Definition: CModified.cpp:61
CCopasiVector< CModification > mModifications
CRDFPredicate Predicate
Definition: CRDFTriplet.h:40
virtual void remove(const size_t &index)
const std::string & getURI() const
CRDFGraph * mpRDFGraph
CRDFNode * pObject
Definition: CRDFTriplet.h:42
bool CMIRIAMInfo::removeReference ( int  position)

Definition at line 164 of file CModelMIRIAMInfo.cpp.

References CReference::getTriplet(), CRDFPredicate::getURI(), mpRDFGraph, mReferences, CRDFTriplet::pObject, CRDFTriplet::Predicate, CRDFTriplet::pSubject, CCopasiVector< T >::remove(), and CRDFGraph::removeTriplet().

Referenced by CQReferenceDM::removeRows().

165 {
166  CReference * pReference = mReferences[position];
167 
168  if (!pReference)
169  return false;
170 
171  const CRDFTriplet & Triplet = pReference->getTriplet();
172 
175  Triplet.pObject);
176 
177  return mReferences.remove(pReference);
178 }
void removeTriplet(CRDFNode *pSubject, const CRDFPredicate &predicate, CRDFNode *pObject)
Definition: CRDFGraph.cpp:277
CRDFNode * pSubject
Definition: CRDFTriplet.h:38
CCopasiVector< CReference > mReferences
CRDFPredicate Predicate
Definition: CRDFTriplet.h:40
virtual void remove(const size_t &index)
const std::string & getURI() const
CRDFGraph * mpRDFGraph
const CRDFTriplet & getTriplet() const
Definition: CReference.cpp:88
CRDFNode * pObject
Definition: CRDFTriplet.h:42
bool CMIRIAMInfo::save ( )

Definition at line 449 of file CModelMIRIAMInfo.cpp.

References CAnnotation::castObject(), CRDFGraph::clean(), CKeyFactory::get(), CAnnotation::getKey(), CCopasiRootContainer::getKeyFactory(), mKey, mpRDFGraph, CAnnotation::setMiriamAnnotation(), CRDFGraph::updateNamespaces(), and CRDFWriter::xmlFromGraph().

Referenced by CQMiriamWidget::leave().

450 {
451  CCopasiObject * pCopasiObject = dynamic_cast< CCopasiObject * >(CCopasiRootContainer::getKeyFactory()->get(mKey));
452 
453  if (pCopasiObject && mpRDFGraph)
454  {
455  mpRDFGraph->clean();
457 
458  std::string XML = CRDFWriter::xmlFromGraph(mpRDFGraph);
459 
460  CAnnotation * pAnnotation = CAnnotation::castObject(pCopasiObject);
461 
462  if (pAnnotation == NULL)
463  {
464  return false;
465  }
466 
467  pAnnotation->setMiriamAnnotation(XML, pAnnotation->getKey(), pAnnotation->getKey());
468 
469  return true;
470  }
471 
472  return false;
473 }
void updateNamespaces()
Definition: CRDFGraph.cpp:558
CCopasiObject * get(const std::string &key)
void setMiriamAnnotation(const std::string &miriamAnnotation, const std::string &newId, const std::string &oldId)
static CAnnotation * castObject(CCopasiObject *pObject)
Definition: CAnnotation.cpp:32
std::string mKey
static CKeyFactory * getKeyFactory()
CRDFGraph * mpRDFGraph
void clean()
Definition: CRDFGraph.cpp:511
virtual const std::string & getKey() const
static std::string xmlFromGraph(const CRDFGraph *pGraph)
Definition: CRDFWriter.cpp:26
void CMIRIAMInfo::setCreatedDT ( const std::string &  dt)

Definition at line 220 of file CModelMIRIAMInfo.cpp.

References CRDFGraph::addTriplet(), CRDFObject::BLANK_NODE, CRDFPredicate::dcterms_created, CRDFPredicate::dcterms_W3CDTF, CRDFGraph::generatedNodeId(), CRDFNode::getPath(), CRDFNode::getSubject(), CRDFPredicate::getURI(), mCreated, mpRDFGraph, mTriplet, CRDFTriplet::pObject, CRDFObject::setBlankNodeId(), CRDFNode::setFieldValue(), and CRDFObject::setType().

Referenced by CQMiriamWidget::slotCreatedDTChanged().

221 {
222  std::string Date = dt;
223 
224  if (Date == "0000-00-00T00:00:00")
225  Date = ""; // This causes deletion of the edge
226 
227  if (!mCreated)
228  {
229  const CRDFSubject & Subject = mTriplet.pObject->getSubject();
230  CRDFObject Object;
232  std::string Id = mpRDFGraph->generatedNodeId();
233  Object.setBlankNodeId(Id);
234 
235  mCreated = mpRDFGraph->addTriplet(Subject,
237  Object);
238  // Debugging
239  assert(!mCreated == false);
240  }
241 
243 }
const CRDFSubject & getSubject() const
Definition: CRDFNode.cpp:69
void setType(const eObjectType &type)
Definition: CRDFObject.cpp:82
bool setFieldValue(const CMIRIAMResourceObject &value, const CRDFPredicate::ePredicateType &predicate, const CRDFPredicate::Path &nodePath)
Definition: CRDFNode.cpp:142
CRDFTriplet addTriplet(const CRDFSubject &subject, const CRDFPredicate &predicate, const CRDFObject &object)
Definition: CRDFGraph.cpp:141
CRDFTriplet mTriplet
CRDFTriplet mCreated
CRDFPredicate::Path getPath() const
Definition: CRDFNode.cpp:110
const std::string & getURI() const
CRDFGraph * mpRDFGraph
void setBlankNodeId(const std::string &blankNodeId)
Definition: CRDFObject.cpp:100
std::string generatedNodeId(const std::string &existingId="")
Definition: CRDFGraph.cpp:380
CRDFNode * pObject
Definition: CRDFTriplet.h:42

Member Data Documentation

CCopasiVector<CBiologicalDescription> CMIRIAMInfo::mBiologicalDescriptions
private
CRDFTriplet CMIRIAMInfo::mCreated
private

Definition at line 50 of file CModelMIRIAMInfo.h.

Referenced by getCreatedDT(), load(), and setCreatedDT().

CRDFObject CMIRIAMInfo::mCreatedObj
private

Definition at line 47 of file CModelMIRIAMInfo.h.

CCopasiVector<CCreator> CMIRIAMInfo::mCreators
private

Definition at line 43 of file CModelMIRIAMInfo.h.

Referenced by createCreator(), getCreators(), loadCreators(), and removeCreator().

std::string CMIRIAMInfo::mKey
private

Definition at line 42 of file CModelMIRIAMInfo.h.

Referenced by getKey(), load(), and save().

CCopasiVector<CModification> CMIRIAMInfo::mModifications
private
CRDFGraph* CMIRIAMInfo::mpRDFGraph
private
CCopasiVector<CReference> CMIRIAMInfo::mReferences
private

Definition at line 44 of file CModelMIRIAMInfo.h.

Referenced by createReference(), getReferences(), loadReferences(), and removeReference().

CRDFTriplet CMIRIAMInfo::mTriplet
private

The documentation for this class was generated from the following files: