owlcpp  v0.3.3~
C++ library for working with OWL ontologies
 All Classes Namespaces Files Functions Macros Pages
catalog.hpp
Go to the documentation of this file.
1 
6 #ifndef CATALOG_HPP_
7 #define CATALOG_HPP_
8 #include <limits>
9 #include "boost/filesystem/path.hpp"
10 
11 #include "owlcpp/io/config.hpp"
12 #include "owlcpp/io/exception.hpp"
13 #include "owlcpp/io/detail/map_traits.hpp"
14 #include "owlcpp/rdf/map_std.hpp"
17 #include "owlcpp/rdf/nodes_std.hpp"
18 #include "owlcpp/rdf/map_doc.hpp"
19 #include "owlcpp/rdf/map_ns.hpp"
23 
24 namespace owlcpp{
25 
30 class OWLCPP_IO_DECL Catalog :
31 public Map_doc_crtpb<Catalog>,
32 public Map_std_ns_crtpb<Catalog>,
33 public Map_std_node_crtpb<Catalog>,
34 public Crtpb_ns_node_iri<Catalog>
35 {
36  friend class Map_std_ns_crtpb<Catalog>;
37  friend class Map_std_node_crtpb<Catalog>;
38  friend class Map_doc_crtpb<Catalog>;
39 
40  typedef detail::Map_traits<Catalog> traits;
41  typedef traits::map_std_type map_std_type;
42  typedef traits::map_ns_type map_ns_type;
43  typedef traits::map_node_type map_node_type;
44 
45 public:
46  typedef traits::map_doc_type map_doc_type;
47  typedef map_doc_type::iterator iterator;
48  typedef map_doc_type::const_iterator const_iterator;
49  struct Err : public Input_err {};
50 
51  //bring in overloaded methods
58 
61 
64 
68 
69  Catalog() : map_std_(map_std_type::get(Nodes_none())) {}
70 
71  std::size_t size() const {return map_doc_.size();}
72  const_iterator begin() const {return map_doc_.begin();}
73  const_iterator end() const {return map_doc_.end();}
74 
75  map_ns_type const& map_ns() const {return map_ns_;}
76  map_node_type const& map_node() const {return map_node_;}
77  map_doc_type const& map_doc() const {return map_doc_;}
78 
79  Node_id ontology_iri_id(const Doc_id did) const {
80  return map_doc_[did].ontology_iri;
81  }
82 
83  Node_id version_iri_id(const Doc_id did) const {
84  return map_doc_[did].version_iri;
85  }
86 
87  std::string path(const Doc_id did) const {return map_doc_[did].path;}
88  std::string ontology_iri_str(const Doc_id) const;
89  std::string version_iri_str(const Doc_id) const;
90 
91 private:
92  map_std_type const& map_std_;
93  map_ns_type map_ns_;
94  map_node_type map_node_;
95  map_doc_type map_doc_;
96 };
97 
116 OWLCPP_IO_DECL std::size_t add(
117  Catalog& cat,
118  boost::filesystem::path const& path,
119  const bool recurse = false,
120  const std::size_t search_depth = std::numeric_limits<std::size_t>::max()
121 );
122 
123 
124 
125 }//namespace owlcpp
126 #endif /* CATALOG_HPP_ */