owlcpp  v0.3.3~
C++ library for working with OWL ontologies
 All Classes Namespaces Files Functions Macros Pages
triple.hpp
Go to the documentation of this file.
1 
6 #ifndef TRIPLE_HPP_
7 #define TRIPLE_HPP_
8 #include <iosfwd>
9 #include "owlcpp/doc_id.hpp"
10 #include "owlcpp/node_id.hpp"
11 
12 namespace owlcpp{
13 
16 struct Triple {
17  static Triple make(
18  const Node_id subj, const Node_id pred,
19  const Node_id obj, const Doc_id doc
20  ) {
21  Triple t;
22  t.subj_ = subj;
23  t.pred_ = pred;
24  t.obj_ = obj;
25  t.doc_ = doc;
26  return t;
27  }
28 
29  Node_id subj_, pred_, obj_;
30  Doc_id doc_;
31 
32  bool operator==(Triple const& t) const {
33  return subj_==t.subj_ && pred_==t.pred_ && obj_==t.obj_ && doc_==t.doc_;
34  }
35 
36  bool operator!=(Triple const& t) const {return !(*this == t);}
37 };
38 
41 template<class ChT, class Tr> inline std::basic_ostream<ChT,Tr>& operator<<(
42  std::basic_ostream<ChT,Tr>& os,
43  Triple const& t
44 ) {
45  return os << t.subj_ << ',' << t.pred_ << ',' << t.obj_ << ',' << t.doc_;
46 }
47 
48 
49 }//namespace owlcpp
50 #endif /* TRIPLE_HPP_ */