COPASI API  4.16.103
CQRDFTreeViewItem.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/MIRIAMUI/CQRDFTreeViewItem.cpp,v $
3 // $Revision: 1.1 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2009/08/13 01:40:02 $
7 // End CVS Header
8 
9 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
11 // and The University of Manchester.
12 // All rights reserved.
13 
14 #include "UI/qtUtilities.h"
15 
16 #include "CQRDFTreeViewItem.h"
17 #include "CQRDFTreeView.h"
18 #include "MIRIAM/CRDFGraph.h"
19 #include "MIRIAM/CRDFObject.h"
20 #include "MIRIAM/CRDFLiteral.h"
21 
22 #define COL_SUBJECT 0
23 #define COL_PREDICATE 1
24 #define COL_OBJECT 2
25 
27  QTreeWidgetItem(pParent, pAfter),
28  mTriplet()
29 {
30  assert(pParent != NULL);
31  setExpanded(true);
32 }
33 
35  QTreeWidgetItem(pParent, pAfter),
36  mTriplet()
37 {
38  assert(pParent != NULL);
39  setExpanded(true);
40 }
41 
43 {}
44 
46 {
47  mTriplet = triplet;
48 
49  // Set the predicate
51 
52  const CRDFObject & Object = mTriplet.pObject->getObject();
53 
54  switch (Object.getType())
55  {
57  {
58  const CRDFLiteral & Literal = Object.getLiteral();
59 
60  switch (Literal.getType())
61  {
62  case CRDFLiteral::PLAIN:
63  case CRDFLiteral::TYPED:
64  setText(COL_OBJECT, FROM_UTF8(Literal.getLexicalData()));
65  break;
66  }
67  }
68  break;
69 
71  setText(COL_OBJECT, FROM_UTF8(Object.getResource()));
72  break;
73 
75 
76  if (mTriplet. Predicate.getURI() != "http://www.w3.org/1999/02/22-rdf-syntax-ns#subject")
77  setText(COL_SUBJECT, FROM_UTF8(Object.getBlankNodeID()));
78  else
79  setText(COL_OBJECT, FROM_UTF8(Object.getBlankNodeID()));
80 
81  break;
82  }
83 }
CQRDFTreeViewItem(QTreeWidget *pParent, CQRDFTreeViewItem *pAfter=NULL)
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
#define COL_OBJECT
const eObjectType & getType() const
Definition: CRDFObject.cpp:85
const std::string & getBlankNodeID() const
Definition: CRDFObject.cpp:103
#define COL_PREDICATE
#define COL_SUBJECT
CRDFObject & getObject()
Definition: CRDFNode.cpp:94
const eLiteralType & getType() const
Definition: CRDFLiteral.cpp:42
CRDFPredicate Predicate
Definition: CRDFTriplet.h:40
void setTriplet(const CRDFTriplet &triplet)
const std::string & getURI() const
const std::string & getLexicalData() const
Definition: CRDFLiteral.cpp:60
CRDFNode * pObject
Definition: CRDFTriplet.h:42
const std::string & getResource() const
Definition: CRDFObject.cpp:94
CRDFLiteral & getLiteral()
Definition: CRDFObject.cpp:112