18 #ifndef RAUL_ATOM_RDF_HPP
19 #define RAUL_ATOM_RDF_HPP
25 #include CONFIG_H_PATH
27 #include <redlandmm/Node.hpp>
28 #include <redlandmm/World.hpp>
30 #define CUC(x) ((const unsigned char*)(x))
44 if (node.type() == Redland::Node::RESOURCE)
45 return Atom(node.to_c_string());
46 else if (node.is_float())
47 return Atom(node.to_float());
48 else if (node.is_int())
49 return Atom(node.to_int());
50 else if (node.is_bool())
51 return Atom(node.to_bool());
53 return Atom(node.to_c_string());
63 std::ostringstream os;
65 librdf_uri* type = NULL;
66 librdf_node* node = NULL;
68 switch (atom.
type()) {
70 os << atom.get_int32();
73 type = librdf_new_uri(world.world(), CUC(
"http://www.w3.org/2001/XMLSchema#integer"));
77 os << atom.get_float();
79 if (str.find(
".") == std::string::npos)
82 type = librdf_new_uri(world.world(), CUC(
"http://www.w3.org/2001/XMLSchema#decimal"));
90 type = librdf_new_uri(world.world(), CUC(
"http://www.w3.org/2001/XMLSchema#boolean"));
93 str = atom.get_string();
103 node = librdf_new_node_from_typed_literal(world.world(), CUC(str.c_str()), NULL, type);
105 return Redland::Node(world, node);
112 #endif // RAUL_ATOM_RDF_HPP
An OSC atom (fundamental data types OSC messages are composed of).
Definition: Atom.hpp:39
Redland::Node atom_to_node(Redland::World &world, const Atom &atom)
Convert a Raul::Atom to a Redland::Node Note that not all Atoms are serialisable, the returned node s...
Definition: AtomRDF.hpp:61
Type type() const
Type of this atom.
Definition: Atom.hpp:161
Atom node_to_atom(const Redland::Node &node)
Convert a Redland::Node to a Raul::Atom.
Definition: AtomRDF.hpp:42