From 385a612b3bab9c5b177d7a400b72cb7fe3e3a299 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 9 Aug 2021 18:28:35 -0400 Subject: Preserve anonymous graph syntax in TriG --- src/n3.c | 1 + src/writer.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/n3.c b/src/n3.c index 7e913d8b..6d4210b4 100644 --- a/src/n3.c +++ b/src/n3.c @@ -1198,6 +1198,7 @@ read_block(SerdReader* const reader, ReadContext* const ctx) } ctx->graph = token; + (*ctx->flags) |= (s_type == '[' ? SERD_EMPTY_G : 0u); return read_wrappedGraph(reader, ctx); } diff --git a/src/writer.c b/src/writer.c index 968d1a9f..5f178a6f 100644 --- a/src/writer.c +++ b/src/writer.c @@ -884,7 +884,8 @@ write_blank(SerdWriter* const writer, return write_sep(writer, flags, SEP_LIST_BEGIN); } - if (field == SERD_SUBJECT && (flags & SERD_EMPTY_S)) { + if ((field == SERD_SUBJECT && (flags & SERD_EMPTY_S)) || + (field == SERD_GRAPH && (flags & SERD_EMPTY_G))) { writer->last_sep = SEP_NONE; // Treat "[]" like a node return esink("[]", 2, writer); } -- cgit v1.2.1