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. --- tools/console.c | 1 + tools/serd-filter.c | 3 ++- tools/serd-pipe.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/console.c b/tools/console.c index 30c57575..ab36364d 100644 --- a/tools/console.c +++ b/tools/console.c @@ -220,6 +220,7 @@ serd_set_output_option(const SerdStringView name, {"terse", SERD_WRITE_TERSE}, {"lax", SERD_WRITE_LAX}, {"rdf_type", SERD_WRITE_RDF_TYPE}, + {"contextual", SERD_WRITE_CONTEXTUAL}, {NULL, SERD_WRITE_ASCII}, }; diff --git a/tools/serd-filter.c b/tools/serd-filter.c index 147bf51d..ed22373c 100644 --- a/tools/serd-filter.c +++ b/tools/serd-filter.c @@ -194,7 +194,8 @@ print_usage(const char* const name, const bool error) " -I SYNTAX Input syntax (turtle/ntriples/trig/nquads),\n" " or option (lax/variables/relative/global/generated).\n" " -O SYNTAX Output syntax (empty/turtle/ntriples/nquads),\n" - " or option (ascii/expanded/verbatim/terse/lax).\n" + " or option " + "(ascii/contextual/expanded/verbatim/terse/lax).\n" " -V Display version information and exit.\n" " -f PATTERN_FILE Read pattern from PATTERN_FILE instead.\n" " -h Display this help and exit.\n" diff --git a/tools/serd-pipe.c b/tools/serd-pipe.c index 25607d15..879a56b5 100644 --- a/tools/serd-pipe.c +++ b/tools/serd-pipe.c @@ -106,7 +106,7 @@ print_usage(const char* const name, const bool error) " -I SYNTAX Input syntax (turtle/ntriples/trig/nquads),\n" " or option (lax/variables/relative/global/generated).\n" " -O SYNTAX Output syntax (empty/turtle/ntriples/nquads),\n" - " or option (ascii/expanded/verbatim/terse/lax).\n" + " or option (ascii/contextual/expanded/verbatim/terse/lax).\n" " -R ROOT_URI Keep relative URIs within ROOT_URI.\n" " -V Display version information and exit.\n" " -b BYTES I/O block size.\n" -- cgit v1.2.1