8 #include "boost/assert.hpp"
9 #include "boost/range.hpp"
10 #include "boost/range/algorithm/max_element.hpp"
11 #include "boost/utility.hpp"
12 #include "boost/concept/assert.hpp"
18 #include "owlcpp/rdf/detail/map_id_object.hpp"
20 #include "owlcpp/terms/detail/max_standard_id.hpp"
28 typedef detail::Map_id_object<Ns_iri, Ns_id> map_ns_t;
29 typedef detail::Map_id_object<Node_iri, Node_id> map_node_t;
31 template<
class Inserter>
explicit Map_std(Inserter
const& ins);
47 template<
class T>
static Map_std const&
get(T
const& t) {
48 BOOST_CONCEPT_ASSERT((boost::UnaryFunction<T, void, Map_std&>));
53 void insert(
const Ns_id nsid,
Ns_iri const& nsiri, std::string
const& pref) {
54 BOOST_ASSERT(nsid < detail::min_ns_id());
55 map_ns_.insert(nsid, nsiri);
56 map_pref_.
set(nsid, pref);
59 void insert(
const Node_id nid, Node_iri
const& node) {
60 BOOST_ASSERT(nid < detail::min_node_id());
61 BOOST_ASSERT(find(node.ns_id()));
62 map_node_.insert(nid, node);
72 return nsid < detail::min_ns_id();
76 return nid < detail::min_node_id();
79 Ns_id
const* find(Ns_iri
const& iri)
const {
return map_ns_.find(iri);}
80 Ns_id
const* find_prefix(std::string
const& pref)
const {
return map_pref_.find(pref);}
81 Ns_iri
const& operator[](
const Ns_id nsid)
const {
return map_ns_[nsid];}
82 Ns_iri
const& at(
const Ns_id nsid)
const {
return map_ns_.at(nsid);}
83 Ns_iri
const* find(
const Ns_id nsid)
const {
return map_ns_.find(nsid);}
84 std::string prefix(
const Ns_id nsid)
const {
return map_pref_.prefix(nsid);}
86 Node_iri
const& operator[](
const Node_id nid)
const {
return map_node_[nid];}
87 Node_iri
const& at(
const Node_id nid)
const {
return map_node_.at(nid);}
88 Node_iri
const* find(
const Node_id nid)
const {
return map_node_.find(nid);}
89 Node_id
const* find(Node_iri
const& node)
const {
return map_node_.find(node);}
91 Node_id
const* find(
const Ns_id ns, std::string
const& val)
const {
92 if( is_blank(ns) || ns >= detail::min_ns_id() )
return 0;
93 return map_node_.find(Node_iri(ns, val));
98 Map_ns_prefix map_pref_;
109 template<
class NsTag>
void operator()(NsTag
const&)
const {
110 map_->insert(NsTag::id(),
Ns_iri(NsTag::iri()), NsTag::prefix());
121 template<
class NodeTag>
void operator()(NodeTag
const&)
const {
122 typedef typename NodeTag::ns_type ns_type;
123 map_->insert(ns_type::id(),
Ns_iri(ns_type::iri()), ns_type::prefix());
124 map_->insert(NodeTag::id(),
Node_iri(ns_type::id(), NodeTag::fragment()));
131 template<
class Inserter> Map_std::Map_std(Inserter
const& ins)
135 ns_ins(terms::empty());
136 ns_ins(terms::blank());
138 node_ins(terms::empty_());