6 #ifndef PRINT_NODE_HPP_
7 #define PRINT_NODE_HPP_
20 OWLCPP_RDF_DECL std::string to_string(Node
const&);
24 inline std::string to_string(
Node_iri const& node) {
25 return to_string(node.ns_id()) +
':' + node.fragment();
30 OWLCPP_RDF_DECL std::string to_string(Node_blank
const& node);
34 OWLCPP_RDF_DECL std::string to_string(Node_bool
const& node);
38 OWLCPP_RDF_DECL std::string to_string(Node_int
const& node);
42 OWLCPP_RDF_DECL std::string to_string(Node_unsigned
const& node);
46 OWLCPP_RDF_DECL std::string to_string(Node_double
const& node);
50 OWLCPP_RDF_DECL std::string to_string(Node_string
const& node);
54 OWLCPP_RDF_DECL std::string
to_string_full(Node
const&, Triple_store
const&);
58 OWLCPP_RDF_DECL std::string
to_string_full(
const Node_id, Triple_store
const&);
62 template<
class Store>
inline std::string
64 if( node.fragment().empty() )
return store[node.ns_id()].str();
65 return store[node.ns_id()].str() +
'#' + node.fragment();
70 OWLCPP_RDF_DECL std::string
to_string_pref(Node
const&, Triple_store
const&);
74 OWLCPP_RDF_DECL std::string
to_string_pref(
const Node_id, Triple_store
const&);
78 template<
class Store>
inline std::string
80 const Ns_id nsid = node.ns_id();
81 const std::string pref = store.prefix(nsid);
82 if( pref.empty() )
return to_string(node);
83 return pref +
':' + node.fragment();
88 OWLCPP_RDF_DECL std::string to_string(Node
const&, Triple_store
const&);
92 OWLCPP_RDF_DECL std::string to_string(
const Node_id, Triple_store
const&);
96 template<
class Store>
inline std::string
97 to_string(
Node_iri const& node, Store
const& store) {
98 const Ns_id nsid = node.ns_id();
99 const std::string pref = store.prefix(nsid);
100 if( pref.empty() )
return to_string_full<Store>(node, store);
101 return pref +
':' + node.fragment();
106 template<
class Ch,
class Tr>
inline std::basic_ostream<Ch,Tr>&
107 operator<<(std::basic_ostream<Ch,Tr>& os, Node
const& node) {
108 return os << to_string(node);