6 #ifndef MAP_DOC_CRTPB_HPP_
7 #define MAP_DOC_CRTPB_HPP_
8 #include "boost/assert.hpp"
10 #include "owlcpp/detail/map_traits.hpp"
20 typedef detail::Map_traits<Super> traits;
21 typedef typename traits::map_node_type map_node_t;
22 typedef typename traits::map_doc_type map_doc_type;
23 typedef typename traits::doc_type doc_type;
25 map_doc_type
const& _map_doc()
const {
26 return static_cast<Super const&
>(*this).map_doc_;
29 map_doc_type& _map_doc() {
30 return static_cast<Super&
>(*this).map_doc_;
34 typedef typename map_doc_type::iri_range doc_iri_range;
35 typedef typename map_doc_type::version_range doc_version_range;
37 doc_type
const& operator[](
const Doc_id did)
const {
38 return _map_doc()[did];
41 doc_type
const& at(
const Doc_id did)
const {
42 return _map_doc().at(did);
45 doc_type
const* find(
const Doc_id did)
const {
46 return _map_doc().find(did);
73 std::string
const& path =
"",
74 const Node_id vers_id = terms::empty_::id()
76 BOOST_CONCEPT_ASSERT((Iri_node_store<Super>));
78 static_cast<Super const&>(*this).find(iri_id) &&
79 "invalid ontology IRI ID"
83 static_cast<Super const&>(*this).find(vers_id) &&
84 "invalid version IRI ID"
87 return _map_doc().insert(iri_id, path, vers_id);
91 std::string
const& iri,
92 std::string
const& path =
"",
93 std::string
const& vers =
""
95 BOOST_CONCEPT_ASSERT((Ns_iri_node_store<Super>));
96 const Node_id iri_id =
static_cast<Super&
>(*this).insert_node_iri(iri);
97 const Node_id vers_id =
static_cast<Super&
>(*this).insert_node_iri(vers);
101 doc_iri_range find_doc_iri(std::string
const& iri)
const {
102 BOOST_CONCEPT_ASSERT((Ns_iri_node_store<Super>));
103 Super
const& super =
static_cast<Super const&
>(*this);
104 Node_id
const*
const nid = super.find_node_iri(iri);
105 typedef typename doc_iri_range::iterator::base_iterator iter_t;
109 _map_doc().find_iri(*nid) :
110 doc_iri_range(iter_t(0,0), iter_t(0,0));
113 doc_version_range find_doc_version(std::string
const& version)
const {
114 BOOST_CONCEPT_ASSERT((Ns_iri_node_store<Super>));
115 Super
const& super =
static_cast<Super const&
>(*this);
116 Node_id
const*
const nid = super.find_node_iri(version);
117 typedef typename doc_version_range::iterator::base_iterator iter_t;
121 _map_doc().find_version(*nid) :
122 doc_version_range(iter_t(0,0), iter_t(0,0));