6 #ifndef RDF_LIST_ITERATOR_HPP_
7 #define RDF_LIST_ITERATOR_HPP_
8 #include "boost/iterator/iterator_facade.hpp"
20 :
public boost::iterator_facade<
23 boost::forward_traversal_tag
30 : ts_(0), nid_(terms::rdf_nil::id())
38 Triple_store
const* ts_;
41 friend class boost::iterator_core_access;
44 const Triple_store::result_b<1,1,0,0>::type r = ts_->
find_triple(
46 terms::rdf_rest::id(),
50 if( ! r ) BOOST_THROW_EXCEPTION(
52 << Err::msg_t(
"rdf:rest triple not found")
53 << Err::str1_t(to_string(nid_, *ts_))
55 Triple
const& t = r.front();
56 if( boost::distance(r) != 1U ) BOOST_THROW_EXCEPTION(
58 << Err::msg_t(
"multiple rdf:rest triples")
59 << Err::str1_t(to_string(nid_, *ts_))
64 Node_id
const& dereference()
const {
65 const Triple_store::result_b<1,1,0,0>::type r = ts_->
find_triple(
67 terms::rdf_first::id(),
71 if( ! r ) BOOST_THROW_EXCEPTION(
73 << Err::msg_t(
"rdf:first triple not found")
74 << Err::str1_t(to_string(nid_, *ts_))
76 Triple
const& t = r.front();
77 if( boost::distance(r) != 1U ) BOOST_THROW_EXCEPTION(
79 << Err::msg_t(
"multiple rdf:first triples")
80 << Err::str1_t(to_string(nid_, *ts_))
85 bool equal(Rdf_list_iter_s
const& i)
const {
return nid_ == i.nid_;}