summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-09-19 20:20:49 +0000
committerDavid Robillard <d@drobilla.net>2007-09-19 20:20:49 +0000
commit23df76c6037cc0719c6b590dd49941815367e3c8 (patch)
treef61de1f61f4ed053315c02b5e6c926b8d8cbd802
parent047a788d73d39757f9d27b6ffd877595deda4cae (diff)
downloadraul-23df76c6037cc0719c6b590dd49941815367e3c8.tar.gz
raul-23df76c6037cc0719c6b590dd49941815367e3c8.tar.bz2
raul-23df76c6037cc0719c6b590dd49941815367e3c8.zip
Automatically attempt to qualify qnames when used to create RDF resource nodes.
git-svn-id: http://svn.drobilla.net/lad/raul@730 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/RDFNode.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/RDFNode.cpp b/src/RDFNode.cpp
index 4140bcb..be529e7 100644
--- a/src/RDFNode.cpp
+++ b/src/RDFNode.cpp
@@ -16,6 +16,7 @@
*/
#include <string>
+#include <iostream>
#include <raul/RDFWorld.hpp>
#include <raul/RDFNode.hpp>
@@ -27,14 +28,16 @@ namespace RDF {
Node::Node(World& world, Type type, const std::string& s)
{
- if (type == RESOURCE)
- _node = librdf_new_node_from_uri_string(world.world(), (const unsigned char*)s.c_str());
- else if (type == LITERAL)
+ if (type == RESOURCE) {
+ const string uri = world.expand_uri(s);
+ _node = librdf_new_node_from_uri_string(world.world(), (const unsigned char*)uri.c_str());
+ } else if (type == LITERAL) {
_node = librdf_new_node_from_literal(world.world(), (const unsigned char*)s.c_str(), NULL, 0);
- else if (type == BLANK)
+ } else if (type == BLANK) {
_node = librdf_new_node_from_blank_identifier(world.world(), (const unsigned char*)s.c_str());
- else
+ } else {
_node = NULL;
+ }
assert(this->type() == type);
}