From 1fb84760a8230637a806e8e83410fc7fb6d446d2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 4 Sep 2021 15:03:11 -0400 Subject: Add "contextual" output option This is mainly for developer or power-user cases, where one wants to look at some data for investigation or debugging. In such cases, it's common for the set of prefixes to be implicitly known (because they are baked in to the application, for example), so printing them just produces a large amount of redundant noise. That said, it can also be useful programmatically, because it allows several snippets to be written independently and ultimately concatenated (with a header to define the prefixes) without redundancy. --- include/serd/serd.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include/serd/serd.h') diff --git a/include/serd/serd.h b/include/serd/serd.h index 6324c06e..9eb84a6a 100644 --- a/include/serd/serd.h +++ b/include/serd/serd.h @@ -2589,7 +2589,16 @@ typedef enum { This disables the special "a" syntax in Turtle and TriG. */ - SERD_WRITE_RDF_TYPE = 1u << 5u + SERD_WRITE_RDF_TYPE = 1u << 5u, + + /** + Suppress writing directives that describe the context. + + This writes data as usual, but suppresses writing `prefix` directives in + Turtle and TriG. The resulting output is a fragment of a document with + implicit context, so it will only be readable in a suitable enviromnent. + */ + SERD_WRITE_CONTEXTUAL = 1u << 6u } SerdWriterFlag; /// Bitwise OR of SerdWriterFlag values -- cgit v1.2.1