COPASI API  4.16.103
CRDFTriplet.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/MIRIAM/CRDFTriplet.cpp,v $
3 // $Revision: 1.4 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2010/07/16 19:00:07 $
7 // End CVS Header
8 
9 // Copyright (C) 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
16 // and The University of Manchester.
17 // All rights reserved.
18 
19 #include "copasi.h"
20 
21 #include "CRDFGraph.h"
22 #include "CRDFSubject.h"
23 
25  const CRDFPredicate & predicate,
26  CRDFNode * pObject):
27  pSubject(pSubject),
28  Predicate(predicate),
29  pObject(pObject)
30 {}
31 
33 {}
34 
35 CRDFTriplet::operator bool() const
36 {return (pSubject != NULL && pObject != NULL);}
37 
38 bool CRDFTriplet::operator == (const CRDFTriplet & rhs) const
39 {
40  return (pSubject == rhs.pSubject &&
41  pObject == rhs.pObject &&
42  Predicate == rhs.Predicate);
43 }
44 
45 bool CRDFTriplet::operator < (const CRDFTriplet & rhs) const
46 {
47  if (Predicate != rhs.Predicate)
48  return Predicate < rhs.Predicate;
49 
50  if (pSubject != rhs.pSubject)
51  return pSubject < rhs.pSubject;
52 
53  return pObject < rhs.pObject;
54 }
55 
56 std::ostream & operator << (std::ostream & os, const CRDFTriplet & triplet)
57 {
58  if (triplet)
59  {
60  os << triplet.pSubject->getSubject() << ", ";
61  os << triplet.Predicate.getURI() << ", ";
62  os << triplet.pObject->getObject() << std::endl;
63  }
64  else
65  os << "Invalid Triplet" << std::endl;
66 
67  return os;
68 }
bool operator<(const CRDFTriplet &rhs) const
Definition: CRDFTriplet.cpp:45
CRDFNode * pSubject
Definition: CRDFTriplet.h:38
const CRDFSubject & getSubject() const
Definition: CRDFNode.cpp:69
CRDFTriplet(CRDFNode *pSubject=NULL, const CRDFPredicate &predicate=CRDFPredicate::end, CRDFNode *pObject=NULL)
Definition: CRDFTriplet.cpp:24
CRDFObject & getObject()
Definition: CRDFNode.cpp:94
CRDFPredicate Predicate
Definition: CRDFTriplet.h:40
bool operator==(const CRDFTriplet &rhs) const
Definition: CRDFTriplet.cpp:38
const std::string & getURI() const
CRDFNode * pObject
Definition: CRDFTriplet.h:42
std::ostream & operator<<(std::ostream &os, const CRDFTriplet &triplet)
Definition: CRDFTriplet.cpp:56