Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkRdfTriple.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "mitkRdfTriple.h"
18 
19 #include <ostream>
20 
21 namespace mitk {
23  {
24  }
25 
26  RdfTriple::RdfTriple(RdfNode subject, RdfNode predicate, RdfNode object)
27  : m_Subject(subject), m_Predicate(predicate), m_Object(object)
28  {
29  }
30 
31  RdfTriple::RdfTriple(RdfNode subject, RdfNode property, std::string value)
32  : m_Subject(subject), m_Predicate(property), m_Object(RdfNode(value))
33  {
34  }
35 
37  {
38  }
39 
41  {
42  m_Subject = subject;
43  }
44 
46  {
47  m_Predicate = predicate;
48  }
49 
51  {
52  m_Object = object;
53  }
54 
55  void RdfTriple::SetTripleObject(std::string text)
56  {
57  mitk::RdfNode object = mitk::RdfNode(text);
58  m_Object = object;
59  }
60 
62  {
63  return m_Subject;
64  }
65 
67  {
68  return m_Predicate;
69  }
70 
72  {
73  return m_Object;
74  }
75 
76  bool RdfTriple::operator==(const RdfTriple &u) const
77  {
78  if (this->m_Subject != u.m_Subject) return false;
79  if (this->m_Predicate != m_Predicate) return false;
80  if (this->m_Object != u.m_Object) return false;
81  return true;
82  }
83 
84  bool RdfTriple::operator!=(const RdfTriple &u) const
85  {
86  return !operator==(u);
87  }
88 
89  // Define outstream of a Triple
90  std::ostream & operator<<(std::ostream &out, const RdfTriple &t)
91  {
92  return out << "( " << t.GetTripleSubject() << " " << t.GetTriplePredicate() << " " << t.GetTripleObject() << " )";
93  }
94 } // end of namespace mitk
bool operator==(const RdfTriple &u) const
MITKCORE_EXPORT std::ostream & operator<<(std::ostream &o, DataNode::Pointer &dtn)
RdfNode GetTripleSubject() const
void SetTriplePredicate(RdfNode predicate)
bool operator!=(const RdfTriple &u) const
DataCollection - Class to facilitate loading/accessing structured data.
void SetTripleObject(RdfNode object)
void SetTripleSubject(RdfNode subject)
RdfNode GetTripleObject() const
RdfNode GetTriplePredicate() const
virtual ~RdfTriple()