diff options
author | David Robillard <d@drobilla.net> | 2011-12-12 01:07:34 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-12-12 01:07:34 +0000 |
commit | 00547a842e11b79ed3a044d91959c0878c20a6c4 (patch) | |
tree | e61b795750d32a29ed60cd9249f7da58a23ccfc2 /src/serdi.c | |
parent | 3979c76b27aaa035b3f9bddc4956ab69c410fc25 (diff) | |
download | serd-00547a842e11b79ed3a044d91959c0878c20a6c4.tar.gz serd-00547a842e11b79ed3a044d91959c0878c20a6c4.tar.bz2 serd-00547a842e11b79ed3a044d91959c0878c20a6c4.zip |
Add serdi -f option to avoid qualifying URIs.
Rename serdi -B option to -b.
Only resolve URIs against base if input is Turtle.
git-svn-id: http://svn.drobilla.net/serd/trunk@246 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/serdi.c')
-rw-r--r-- | src/serdi.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/serdi.c b/src/serdi.c index dca821bb..93d40bf9 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -44,7 +44,8 @@ print_usage(const char* name, bool error) fprintf(os, "Usage: %s [OPTION]... INPUT [BASE_URI]\n", name); fprintf(os, "Read and write RDF syntax.\n"); fprintf(os, "Use - for INPUT to read from standard input.\n\n"); - fprintf(os, " -B Fast bulk output for large serialisations.\n"); + fprintf(os, " -b Fast bulk output for large serialisations.\n"); + fprintf(os, " -f Keep full URIs in input (don't qualify).\n"); fprintf(os, " -h Display this help and exit\n"); fprintf(os, " -i SYNTAX Input syntax (`turtle' or `ntriples')\n"); fprintf(os, " -o SYNTAX Output syntax (`turtle' or `ntriples')\n"); @@ -88,6 +89,7 @@ main(int argc, char** argv) SerdSyntax output_syntax = SERD_NTRIPLES; bool from_file = true; bool bulk_write = false; + bool full_uris = false; const uint8_t* in_name = NULL; const uint8_t* add_prefix = NULL; const uint8_t* chop_prefix = NULL; @@ -97,8 +99,10 @@ main(int argc, char** argv) in_name = (const uint8_t*)"(stdin)"; in_fd = stdin; break; - } else if (argv[a][1] == 'B') { + } else if (argv[a][1] == 'b') { bulk_write = true; + } else if (argv[a][1] == 'f') { + full_uris = true; } else if (argv[a][1] == 'h') { return print_usage(argv[0], false); } else if (argv[a][1] == 'v') { @@ -194,11 +198,18 @@ main(int argc, char** argv) FILE* out_fd = stdout; SerdEnv* env = serd_env_new(&base_uri_node); - SerdStyle output_style = SERD_STYLE_RESOLVED; + SerdStyle output_style = 0; if (output_syntax == SERD_NTRIPLES) { output_style |= SERD_STYLE_ASCII; } else { - output_style |= SERD_STYLE_ABBREVIATED|SERD_STYLE_CURIED; + output_style |= SERD_STYLE_ABBREVIATED; + if (!full_uris) { + output_style |= SERD_STYLE_CURIED; + } + } + + if (input_syntax != SERD_NTRIPLES) { // Base URI may change (@base) + output_style |= SERD_STYLE_RESOLVED; } SerdSink sink = file_sink; |