From 90a703bad8e7df5c0b154c17dfb201dc708f6069 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 9 Mar 2012 23:51:52 +0000 Subject: Add sord_new_relative_uri(). git-svn-id: http://svn.drobilla.net/sord/trunk@204 3d64ff67-21c5-427c-a301-fe4f08042e5a --- sord/sord.h | 11 ++++++++++- sord/sordmm.hpp | 11 +++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'sord') diff --git a/sord/sord.h b/sord/sord.h index 7d3412e..0d71d99 100644 --- a/sord/sord.h +++ b/sord/sord.h @@ -161,7 +161,16 @@ sord_world_free(SordWorld* world); */ SORD_API SordNode* -sord_new_uri(SordWorld* world, const uint8_t* str); +sord_new_uri(SordWorld* world, const uint8_t* uri); + +/** + Get a URI node from a relative URI string. +*/ +SORD_API +SordNode* +sord_new_relative_uri(SordWorld* world, + const uint8_t* str, + const uint8_t* base_uri); /** Get a blank node from a string. diff --git a/sord/sordmm.hpp b/sord/sordmm.hpp index 5f71f09..8a08c83 100644 --- a/sord/sordmm.hpp +++ b/sord/sordmm.hpp @@ -221,6 +221,11 @@ class URI : public Node { public: inline URI(World& world, const std::string& s) : Node(world, Node::URI, s) {} + inline URI(World& world, const std::string& s, const std::string& base) + : Node(world, sord_new_relative_uri(world.world(), + (const uint8_t*)s.c_str(), + (const uint8_t*)base.c_str())) + {} }; class Curie : public Node { @@ -406,13 +411,15 @@ public: const std::string& uri, SerdSyntax syntax = SERD_TURTLE, SerdStyle style = (SerdStyle)(SERD_STYLE_ABBREVIATED - |SERD_STYLE_CURIED)); + |SERD_STYLE_CURIED + |SERD_STYLE_RESOLVED)); inline std::string write_to_string( const std::string& base_uri, SerdSyntax syntax = SERD_TURTLE, SerdStyle style = (SerdStyle)(SERD_STYLE_ABBREVIATED - |SERD_STYLE_CURIED)); + |SERD_STYLE_CURIED + |SERD_STYLE_RESOLVED)); inline void add_statement(const Node& subject, const Node& predicate, -- cgit v1.2.1