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

#include <CRDFObject.h>

Collaboration diagram for CRDFObject:
Collaboration graph
[legend]

Public Types

enum  eObjectType { RESOURCE = 0, BLANK_NODE, LITERAL }
 

Public Member Functions

void clearData ()
 
 CRDFObject ()
 
 CRDFObject (const CRDFObject &src)
 
const std::string & getBlankNodeID () const
 
CRDFLiteralgetLiteral ()
 
const CRDFLiteralgetLiteral () const
 
const std::string & getResource () const
 
const eObjectTypegetType () const
 
const bool & isLocal () const
 
CRDFObjectoperator= (const CRDFObject &rhs)
 
void setBlankNodeId (const std::string &blankNodeId)
 
void setLiteral (const CRDFLiteral &literal)
 
void setResource (const std::string &resource, const bool &isLocal)
 
void setType (const eObjectType &type)
 
virtual ~CRDFObject ()
 

Private Member Functions

bool operator== (const CRDFObject &rhs) const
 

Private Attributes

std::string mBlankNodeId
 
bool mIsLocalResource
 
CRDFLiteralmpLiteral
 
std::string mResource
 
eObjectType mType
 

Detailed Description

Definition at line 25 of file CRDFObject.h.

Member Enumeration Documentation

The three different types possible for objects

Enumerator
RESOURCE 
BLANK_NODE 
LITERAL 

Definition at line 32 of file CRDFObject.h.

Constructor & Destructor Documentation

CRDFObject::CRDFObject ( )

Default Constructor

Definition at line 23 of file CRDFObject.cpp.

23  :
24  mType(RESOURCE),
25  mResource(""),
26  mBlankNodeId(""),
27  mIsLocalResource(false),
28  mpLiteral(NULL)
29 {}
CRDFLiteral * mpLiteral
Definition: CRDFObject.h:149
bool mIsLocalResource
Definition: CRDFObject.h:144
eObjectType mType
Definition: CRDFObject.h:129
std::string mBlankNodeId
Definition: CRDFObject.h:139
std::string mResource
Definition: CRDFObject.h:134
CRDFObject::CRDFObject ( const CRDFObject src)

Copy Constructor

Parameters
constCRDFObject & src

Definition at line 31 of file CRDFObject.cpp.

31  :
32  mType(src.mType),
33  mResource(src.mResource),
36  mpLiteral(src.mpLiteral == NULL ? NULL : new CRDFLiteral(*src.mpLiteral))
37 {}
CRDFLiteral * mpLiteral
Definition: CRDFObject.h:149
bool mIsLocalResource
Definition: CRDFObject.h:144
eObjectType mType
Definition: CRDFObject.h:129
std::string mBlankNodeId
Definition: CRDFObject.h:139
std::string mResource
Definition: CRDFObject.h:134
CRDFObject::~CRDFObject ( )
virtual

Destructor

Definition at line 52 of file CRDFObject.cpp.

References mpLiteral, and pdelete.

#define pdelete(p)
Definition: copasi.h:215
CRDFLiteral * mpLiteral
Definition: CRDFObject.h:149

Member Function Documentation

void CRDFObject::clearData ( )

Reset all Data

Definition at line 128 of file CRDFObject.cpp.

References mBlankNodeId, mIsLocalResource, mpLiteral, mResource, mType, and RESOURCE.

129 {
130  mType = RESOURCE;
131  mResource = "";
132  mBlankNodeId = "";
133  mIsLocalResource = false;
134  mpLiteral = NULL;
135 }
CRDFLiteral * mpLiteral
Definition: CRDFObject.h:149
bool mIsLocalResource
Definition: CRDFObject.h:144
eObjectType mType
Definition: CRDFObject.h:129
std::string mBlankNodeId
Definition: CRDFObject.h:139
std::string mResource
Definition: CRDFObject.h:134
const std::string & CRDFObject::getBlankNodeID ( ) const

Retrieve the ID of the blank node of the object

Returns
const std::string & blankNodeId

Definition at line 103 of file CRDFObject.cpp.

References mBlankNodeId.

Referenced by CRDFGraph::destroyUnreferencedNode(), CRDFNode::getFieldValue(), CRDFNode::setObject(), CQRDFTreeViewItem::setTriplet(), and CRDFWriter::write().

104  {return mBlankNodeId;}
std::string mBlankNodeId
Definition: CRDFObject.h:139
CRDFLiteral & CRDFObject::getLiteral ( )

Retrieve the literal of the object

Returns
CRDFLiteral & literal

Definition at line 112 of file CRDFObject.cpp.

References mpLiteral.

Referenced by CRDFNode::getFieldValue(), CRDFNode::setFieldValue(), CQRDFTreeViewItem::setTriplet(), and CRDFWriter::write().

113 {
114  if (mpLiteral == NULL)
115  mpLiteral = new CRDFLiteral;
116 
117  return *mpLiteral;
118 }
CRDFLiteral * mpLiteral
Definition: CRDFObject.h:149
const CRDFLiteral & CRDFObject::getLiteral ( ) const

Retrieve the literal of the object

Returns
const CRDFLiteral & literal

Definition at line 120 of file CRDFObject.cpp.

References mpLiteral.

121  {
122  if (mpLiteral == NULL)
123  mpLiteral = new CRDFLiteral;
124 
125  return *mpLiteral;
126  }
CRDFLiteral * mpLiteral
Definition: CRDFObject.h:149
const std::string & CRDFObject::getResource ( ) const

Retrieve the resource of the object

Returns
const std::string & resource

Definition at line 94 of file CRDFObject.cpp.

References mResource.

Referenced by CMIRIAMResourceObject::CMIRIAMResourceObject(), CRDFGraph::destroyUnreferencedNode(), CRDFNode::getFieldValue(), CMIRIAMResourceObject::setNode(), CQRDFTreeViewItem::setTriplet(), and CRDFWriter::write().

95  {return mResource;}
std::string mResource
Definition: CRDFObject.h:134
const CRDFObject::eObjectType & CRDFObject::getType ( ) const

Retrieve the type of the object

Returns
const eObjectType & type

Definition at line 85 of file CRDFObject.cpp.

References mType.

Referenced by CRDFGraph::destroyUnreferencedNode(), CRDFNode::getFieldValue(), CRDFNode::setFieldValue(), CRDFNode::setObject(), CQRDFTreeViewItem::setTriplet(), and CRDFWriter::write().

86  {return mType;}
eObjectType mType
Definition: CRDFObject.h:129
const bool & CRDFObject::isLocal ( ) const

Check whehter the resource is local

Returns
const bool & isLocal

Definition at line 97 of file CRDFObject.cpp.

References mIsLocalResource.

Referenced by CRDFGraph::destroyUnreferencedNode(), and setResource().

98  {return mIsLocalResource;}
bool mIsLocalResource
Definition: CRDFObject.h:144
CRDFObject & CRDFObject::operator= ( const CRDFObject rhs)

Definition at line 39 of file CRDFObject.cpp.

References mBlankNodeId, mIsLocalResource, mpLiteral, mResource, and mType.

40 {
41  if (this != &rhs)
42  {
43  mType = rhs.mType;
44  mResource = rhs.mResource;
47  mpLiteral = (rhs.mpLiteral == NULL ? NULL : new CRDFLiteral(*rhs.mpLiteral));
48  }
49  return *this;
50 }
CRDFLiteral * mpLiteral
Definition: CRDFObject.h:149
bool mIsLocalResource
Definition: CRDFObject.h:144
eObjectType mType
Definition: CRDFObject.h:129
std::string mBlankNodeId
Definition: CRDFObject.h:139
std::string mResource
Definition: CRDFObject.h:134
bool CRDFObject::operator== ( const CRDFObject rhs) const
private

Definition at line 55 of file CRDFObject.cpp.

References BLANK_NODE, LITERAL, mBlankNodeId, mIsLocalResource, mpLiteral, mResource, mType, and RESOURCE.

56  {
57  if (mType == rhs.mType)
58  {
59  switch (mType)
60  {
62  if (mBlankNodeId == rhs.mBlankNodeId)
63  return true;
64  break;
65 
68  return true;
69  break;
70 
72  if (mpLiteral != NULL && rhs.mpLiteral != NULL)
73  return false; // TODO (*mpLiteral == *rhs.mpLiteral);
74  else if (mpLiteral == NULL && rhs.mpLiteral == NULL)
75  return true;
76  break;
77  }
78  }
79  return false;
80  }
CRDFLiteral * mpLiteral
Definition: CRDFObject.h:149
bool mIsLocalResource
Definition: CRDFObject.h:144
eObjectType mType
Definition: CRDFObject.h:129
std::string mBlankNodeId
Definition: CRDFObject.h:139
std::string mResource
Definition: CRDFObject.h:134
void CRDFObject::setBlankNodeId ( const std::string &  blankNodeId)

Set the ID of the blank node of the object

Parameters
conststd::string & blankNodeId

Definition at line 100 of file CRDFObject.cpp.

References mBlankNodeId.

Referenced by CRDFGraphConverter::convert(), CMIRIAMInfo::createCreator(), CMIRIAMInfo::createModification(), CMIRIAMInfo::createReference(), CMIRIAMInfo::setCreatedDT(), CRDFNode::setSubject(), and CRDFParser::TripleHandler().

101 {mBlankNodeId = blankNodeId;}
std::string mBlankNodeId
Definition: CRDFObject.h:139
void CRDFObject::setLiteral ( const CRDFLiteral literal)

Set the literal of the object

Parameters
conststd::string & lexicalData

Definition at line 106 of file CRDFObject.cpp.

References mpLiteral, and pdelete.

Referenced by CRDFParser::TripleHandler().

107 {
109  mpLiteral = new CRDFLiteral(literal);
110 }
#define pdelete(p)
Definition: copasi.h:215
CRDFLiteral * mpLiteral
Definition: CRDFObject.h:149
void CRDFObject::setResource ( const std::string &  resource,
const bool &  isLocal 
)

Set the resource of the object

Parameters
conststd::string & resource
constbool & isLocal

Definition at line 88 of file CRDFObject.cpp.

References isLocal(), mIsLocalResource, and mResource.

Referenced by CRDFNode::addEdge(), CRDFGraphConverter::convert(), CMIRIAMInfo::createBiologicalDescription(), CRDFNode::setFieldValue(), CBiologicalDescription::setId(), CReference::setId(), CBiologicalDescription::setResource(), CReference::setResource(), and CRDFParser::TripleHandler().

89 {
90  mResource = resource;
92 }
const bool & isLocal() const
Definition: CRDFObject.cpp:97
bool mIsLocalResource
Definition: CRDFObject.h:144
std::string mResource
Definition: CRDFObject.h:134
void CRDFObject::setType ( const eObjectType type)

Member Data Documentation

std::string CRDFObject::mBlankNodeId
private

The Id of the blank node for type BLANK_NODE

Definition at line 139 of file CRDFObject.h.

Referenced by clearData(), getBlankNodeID(), operator=(), operator==(), and setBlankNodeId().

bool CRDFObject::mIsLocalResource
private

Stores whether the reources is resolve locally or remotely.

Definition at line 144 of file CRDFObject.h.

Referenced by clearData(), isLocal(), operator=(), operator==(), and setResource().

CRDFLiteral* CRDFObject::mpLiteral
mutableprivate

The pointer to the literal for type LITERAL

Definition at line 149 of file CRDFObject.h.

Referenced by clearData(), getLiteral(), operator=(), operator==(), setLiteral(), and ~CRDFObject().

std::string CRDFObject::mResource
private

The URI of the resource of type RESOURCE

Definition at line 134 of file CRDFObject.h.

Referenced by clearData(), getResource(), operator=(), operator==(), and setResource().

eObjectType CRDFObject::mType
private

The type of the object

Definition at line 129 of file CRDFObject.h.

Referenced by clearData(), getType(), operator=(), operator==(), and setType().


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