COPASI API  4.16.103
CBiologicalDescription.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 #include "copasi.h"
12 
13 #include "CRDFGraph.h"
14 
15 #include "CModelMIRIAMInfo.h"
16 #include "CReference.h"
17 
18 #include "report/CKeyFactory.h"
20 #include "model/CModel.h"
22 
23 CBiologicalDescription::CBiologicalDescription(const std::string & objectName,
24  const CCopasiContainer * pParent):
25  CCopasiContainer(objectName, pParent, "BiologicalDescription"),
26  mTriplet(),
27  mKey(CCopasiRootContainer::getKeyFactory()->add("BiologicalDescription", this)),
28  mResource(NULL)
29 {}
30 
32  const std::string & objectName,
33  const CCopasiContainer * pParent):
34  CCopasiContainer(objectName, pParent, "BiologicalDescription"),
35  mTriplet(triplet),
36  mKey(CCopasiRootContainer::getKeyFactory()->add("BiologicalDescription", this)),
37  mResource(mTriplet.pObject)
38 {}
39 
41  const CCopasiContainer * pParent):
42  CCopasiContainer(src, pParent),
43  mTriplet(src.mTriplet),
44  mKey(CCopasiRootContainer::getKeyFactory()->add("Creator", this)),
45  mResource(src.mResource)
46 {}
47 
49 {
51 }
52 
53 /**
54  * Retrieve the MIRIAM resource object for this reference
55  */
57 {
58  return mResource;
59 }
60 
62 {return mTriplet;}
63 
64 const std::string & CBiologicalDescription::getKey() const
65 {return mKey;}
66 
69 
71 {return mResource.getDisplayName();}
72 
73 const std::string & CBiologicalDescription::getId() const
74 {return mResource.getId();}
75 
76 void CBiologicalDescription::setPredicate(const std::string & predicate)
77 {
79 
80  if (Predicate == mTriplet.Predicate)
81  return;
82 
83  // Add the edge with the new predicate without any object creation.
85 
86  // Remove the edge with the predicate without destroying any objects.
88 
89  // Set the new predicate
90  mTriplet.Predicate = Predicate;
91 }
92 
93 void CBiologicalDescription::setResource(const std::string & resource)
94 {
95  mResource.setDisplayName(resource);
97 }
98 
99 void CBiologicalDescription::setId(const std::string & id)
100 {
101  mResource.setId(id);
103 }
104 
106 {return mResource.getURI();}
107 
109 {
111  mTriplet.Predicate.getURI() == "") ||
112  !mResource.isValid())
113  {
114  // Remove the edge with the predicate and object.
116  }
117 }
bool remove(const std::string &key)
bool isValid() const
Definition: CConstants.cpp:182
std::string getURI() const
Definition: CConstants.cpp:133
CRDFNode * pSubject
Definition: CRDFTriplet.h:38
static ePredicateType getPredicateFromDisplayName(const std::string &displayName)
virtual const std::string & getKey() const
void setResource(const std::string &resource)
CMIRIAMResourceObject mResource
bool setId(const std::string &id)
Definition: CConstants.cpp:101
bool setDisplayName(const std::string &displayName)
Definition: CConstants.cpp:163
const std::string & getId() const
CRDFObject & getObject()
Definition: CRDFNode.cpp:94
static const std::string & getDisplayName(const CRDFPredicate &predicate)
std::string getDisplayName() const
Definition: CConstants.cpp:173
void setPredicate(const std::string &predicate)
CBiologicalDescription(const std::string &objectName, const CCopasiContainer *pParent=NULL)
CRDFPredicate Predicate
Definition: CRDFTriplet.h:40
std::string getPredicate() const
void removeEdge(const CRDFPredicate &predicate, CRDFNode *pObject)
Definition: CRDFNode.cpp:361
const std::string & getId() const
Definition: CConstants.cpp:116
static CKeyFactory * getKeyFactory()
void setResource(const std::string &resource, const bool &isLocal)
Definition: CRDFObject.cpp:88
const std::string & getURI() const
const CMIRIAMResourceObject & getMIRIAMResourceObject() const
CRDFNode * pObject
Definition: CRDFTriplet.h:42
CRDFTriplet addEdge(const CRDFPredicate &predicate, CRDFNode *pObject)
Definition: CRDFNode.cpp:321
const CRDFTriplet & getTriplet() const
std::string getResource() const
void setId(const std::string &id)