aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/writer.c b/src/writer.c
index 451b3e13..987d2b98 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -135,6 +135,12 @@ supports_abbrev(const SerdWriter* writer)
return writer->syntax == SERD_TURTLE || writer->syntax == SERD_TRIG;
}
+static bool
+supports_uriref(const SerdWriter* writer)
+{
+ return writer->syntax == SERD_TURTLE || writer->syntax == SERD_TRIG;
+}
+
static void
w_err(SerdWriter* writer, SerdStatus st, const char* fmt, ...)
{
@@ -526,6 +532,15 @@ write_uri_node(SerdWriter* const writer,
}
}
+ if (!has_scheme && !supports_uriref(writer) &&
+ !serd_env_get_base_uri(writer->env, NULL)->buf) {
+ w_err(writer,
+ SERD_ERR_BAD_ARG,
+ "syntax does not support URI reference <%s>\n",
+ node->buf);
+ return false;
+ }
+
write_sep(writer, SEP_URI_BEGIN);
if (writer->style & SERD_STYLE_RESOLVED) {
SerdURI in_base_uri;