diff options
Diffstat (limited to 'src/RDFWriter.cpp')
-rw-r--r-- | src/RDFWriter.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
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 <sstream> #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. * |