From fedfa21db3957ea425ef9282566ffcd5804a0e76 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 14 Feb 2007 03:28:12 +0000 Subject: Serialization work on Machina. git-svn-id: http://svn.drobilla.net/lad/raul@306 a436a847-0d15-0410-975c-d299462d15a1 --- src/RDFWriter.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/RDFWriter.cpp') diff --git a/src/RDFWriter.cpp b/src/RDFWriter.cpp index b23f51a..625d1fc 100644 --- a/src/RDFWriter.cpp +++ b/src/RDFWriter.cpp @@ -15,6 +15,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "raul/RDFWriter.h" #include "raul/AtomRaptor.h" @@ -30,7 +31,8 @@ static const char* const RDF_LANG = "turtle"; RDFWriter::RDFWriter() : _serializer(NULL) , _string_output(NULL) -{ + , _next_blank_id(0) +{ add_prefix("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); //add_prefix("rdfs", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); } @@ -40,6 +42,9 @@ void RDFWriter::add_prefix(const string& prefix, const string& uri) { _prefixes[prefix] = uri; + if (_serializer) + raptor_serialize_set_namespace(_serializer, + raptor_new_uri(U(uri.c_str())), U(prefix.c_str())); } @@ -68,6 +73,14 @@ RDFWriter::expand_uri(const string& uri) } +RdfId +RDFWriter::blank_id() +{ + std::ostringstream ss; + ss << "n" << _next_blank_id++; + return RdfId(RdfId::ANONYMOUS, ss.str()); +} + /** Begin a serialization to a file. * -- cgit v1.2.1