owlcpp  v0.3.3~
C++ library for working with OWL ontologies
 All Classes Namespaces Files Functions Macros Pages
store_concepts.hpp
Go to the documentation of this file.
1 
6 #ifndef STORE_CONCEPTS_HPP_
7 #define STORE_CONCEPTS_HPP_
8 #include <string>
9 #include "boost/concept/assert.hpp"
10 #include "owlcpp/rdf/detail/map_traits.hpp"
11 #include "boost/concept/detail/concept_def.hpp"
12 
13 namespace owlcpp{
14 class Ns_iri;
15 
19 BOOST_concept(Ns_store, (T)) {
20 public:
21  typedef detail::Map_traits<T> traits;
22  typedef typename traits::map_ns_type map_ns_type;
23  typedef typename traits::ns_id_type ns_id_type;
24 
25  BOOST_CONCEPT_USAGE(Ns_store) {
26  ns_iri_ = t_[nsid_];
27  ns_iri_ = t_.at(nsid_);
28  ns_iri_ = *t_.find(nsid_);
29  pref_ = t_.prefix(nsid_);
30 
31  map_ns_type const& map_ns = t_.map_ns();
32  boost::ignore_unused_variable_warning(map_ns);
33 
34  nsid_ = t_.insert(ns_iri_);
35 
36  ns_id_type const* nsid = t_.find(ns_iri_);
37  nsid = t_.find_prefix(pref_);
38  boost::ignore_unused_variable_warning(nsid);
39  }
40 
41 private:
42  T t_;
43  Ns_iri ns_iri_;
44  std::string pref_;
45  ns_id_type nsid_;
46 };
47 
51 BOOST_concept(Iri_node_store, (T)) {
52 public:
53  typedef detail::Map_traits<T> traits;
54  typedef typename traits::map_node_type map_node_type;
55  typedef typename traits::node_id_type node_id_type;
56  typedef typename traits::ns_id_type ns_id_type;
57  typedef typename traits::node_type node_type;
58 
59  BOOST_CONCEPT_USAGE(Iri_node_store) {
60  node_type const* node = t_.find(nid_);
61  boost::ignore_unused_variable_warning(node);
62 
63  map_node_type const& map_node = t_.map_node();
64  boost::ignore_unused_variable_warning(map_node);
65 
66  nid_ = t_.insert_node_iri(nsid_, str_);
67 
68  node_id_type const* nid = t_.find_node_iri(nsid_, str_);
69  boost::ignore_unused_variable_warning(nid);
70  }
71 
72 private:
73  T t_;
74  std::string str_;
75  node_id_type nid_;
76  ns_id_type nsid_;
77 };
78 
82 BOOST_concept(Doc_store, (T)) {
83 public:
84  typedef detail::Map_traits<T> traits;
85  typedef typename traits::map_doc_type map_doc_type;
86  typedef typename traits::doc_id_type doc_id_type;
87  typedef typename traits::node_id_type node_id_type;
88  typedef typename traits::doc_type doc_type;
89 
90  BOOST_CONCEPT_USAGE(Doc_store) {
91  doc_type const* doc = t_.find(did_);
92  boost::ignore_unused_variable_warning(doc);
93 
94  map_doc_type const& map_doc = t_.map_doc();
95  boost::ignore_unused_variable_warning(map_doc);
96 
97  std::pair<doc_id_type,bool> p = t_.insert_doc(nid_, str_, nid_);
98  p = t_.insert_doc(nid_, str_);
99  p = t_.insert_doc(nid_);
100  p = t_.insert_doc(str_, str_, str_);
101  p = t_.insert_doc(str_, str_);
102  p = t_.insert_doc(str_);
103  }
104 
105 private:
106  T t_;
107  std::string str_;
108  node_id_type nid_;
109  doc_id_type did_;
110 };
111 
115 BOOST_concept(Node_store, (T)) : Iri_node_store<T> {
116 public:
117  typedef detail::Map_traits<T> traits;
118  typedef typename traits::map_node_type map_node_type;
119  typedef typename traits::node_id_type node_id_type;
120  typedef typename traits::ns_id_type ns_id_type;
121  typedef typename traits::doc_id_type doc_id_type;
122 
123  BOOST_CONCEPT_USAGE(Node_store) {
124  const std::string str;
125  node_id_type nid = t_.insert_literal(str, str, str);
126  nid = t_.insert_literal(str, str);
127 
128  const Node_id nid_dt;
129  nid = t_.insert_literal(str, nid_dt, str);
130  nid = t_.insert_literal(str, nid_dt);
131 
132  node_id_type const* nidp = t_.find_literal(str, str, str);
133  nidp = t_.find_literal(str, str);
134  boost::ignore_unused_variable_warning(nidp);
135 
136  const unsigned n = 0;
137  doc_id_type did;
138  nid = t_.insert_blank(n, did);
139  nidp = t_.find_blank(n, did);
140  }
141 
142 private:
143  T t_;
144 };
145 
149 BOOST_concept(Ns_iri_node_store, (T)) : Iri_node_store<T>, Ns_store<T> {
150 public:
151  typedef detail::Map_traits<T> traits;
152  typedef typename traits::map_node_type map_node_type;
153  typedef typename traits::node_id_type node_id_type;
154 
155  BOOST_CONCEPT_USAGE(Ns_iri_node_store) {
156 
157  nid_ = t_.insert_node_iri(str_);
158 
159  node_id_type const* nid = t_.find_node_iri(str_);
160  boost::ignore_unused_variable_warning(nid);
161  }
162 
163 private:
164  T t_;
165  std::string str_;
166  node_id_type nid_;
167 };
168 
169 }//namespace owlcpp
170 #endif /* STORE_CONCEPTS_HPP_ */