aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/serd-pipe.c44
1 files changed, 4 insertions, 40 deletions
diff --git a/tools/serd-pipe.c b/tools/serd-pipe.c
index 16abbd2c..66600006 100644
--- a/tools/serd-pipe.c
+++ b/tools/serd-pipe.c
@@ -44,10 +44,8 @@ print_usage(const char* const name, const bool error)
" -O SYNTAX Output syntax (empty/turtle/ntriples/nquads),\n"
" or flag (ascii/expanded/verbatim/terse/lax).\n"
" -b BYTES I/O block size.\n"
- " -c PREFIX Chop PREFIX from matching blank node IDs.\n"
" -h Display this help and exit.\n"
" -k BYTES Parser stack size.\n"
- " -p PREFIX Add PREFIX to blank node IDs.\n"
" -q Suppress all output except data.\n"
" -r ROOT_URI Keep relative URIs within ROOT_URI.\n"
" -s STRING Parse STRING as input.\n"
@@ -76,7 +74,6 @@ read_file(SerdWorld* const world,
const SerdSink* const sink,
const size_t stack_size,
const char* const filename,
- const char* const add_prefix,
const size_t block_size)
{
SerdInputStream in = serd_open_tool_input(filename);
@@ -91,9 +88,7 @@ read_file(SerdWorld* const world,
serd_world_set_limits(world, limits);
SerdReader* reader = serd_reader_new(world, syntax, flags, env, sink);
- serd_reader_add_blank_prefix(reader, add_prefix);
-
- SerdStatus st = serd_reader_start(reader, &in, NULL, block_size);
+ SerdStatus st = serd_reader_start(reader, &in, NULL, block_size);
st = st ? st : serd_reader_read_document(reader);
@@ -119,8 +114,6 @@ main(int argc, char** argv)
size_t block_size = 4096U;
size_t stack_size = 1048576U;
const char* input_string = NULL;
- const char* add_prefix = "";
- const char* chop_prefix = NULL;
const char* root_uri = NULL;
const char* out_filename = NULL;
int a = 1;
@@ -192,13 +185,6 @@ main(int argc, char** argv)
}
block_size = (size_t)size;
break;
- } else if (opt == 'c') {
- if (argv[a][o + 1] || ++a == argc) {
- return missing_arg(prog, 'c');
- }
-
- chop_prefix = argv[a];
- break;
} else if (opt == 'k') {
if (argv[a][o + 1] || ++a == argc) {
return missing_arg(prog, 'k');
@@ -212,13 +198,6 @@ main(int argc, char** argv)
}
stack_size = (size_t)size;
break;
- } else if (opt == 'p') {
- if (argv[a][o + 1] || ++a == argc) {
- return missing_arg(prog, 'p');
- }
-
- add_prefix = argv[a];
- break;
} else if (opt == 'r') {
if (argv[a][o + 1] || ++a == argc) {
return missing_arg(prog, 'r');
@@ -313,10 +292,7 @@ main(int argc, char** argv)
serd_writer_set_root_uri(writer, serd_string(root_uri));
}
- serd_writer_chop_blank_prefix(writer, chop_prefix);
-
- SerdStatus st = SERD_SUCCESS;
- SerdNode* input_name = NULL;
+ SerdStatus st = SERD_SUCCESS;
if (input_string) {
const char* position = input_string;
SerdInputStream string_in = serd_open_input_string(&position);
@@ -324,8 +300,6 @@ main(int argc, char** argv)
SerdReader* const reader = serd_reader_new(
world, input_syntax ? input_syntax : SERD_TRIG, reader_flags, env, sink);
- serd_reader_add_blank_prefix(reader, add_prefix);
-
if (!(st = serd_reader_start(reader, &string_in, NULL, 1U))) {
st = serd_reader_read_document(reader);
}
@@ -334,11 +308,8 @@ main(int argc, char** argv)
serd_close_input(&string_in);
}
- size_t prefix_len = 0;
- char* prefix = NULL;
- if (n_inputs > 1) {
- prefix_len = 8 + strlen(add_prefix);
- prefix = (char*)calloc(1, prefix_len);
+ if (n_inputs == 1) {
+ reader_flags |= SERD_READ_GLOBAL;
}
for (int i = 0; !st && i < n_inputs; ++i) {
@@ -349,10 +320,6 @@ main(int argc, char** argv)
}
}
- if (n_inputs > 1) {
- snprintf(prefix, prefix_len, "f%d%s", i, add_prefix);
- }
-
if ((st = read_file(world,
serd_choose_syntax(world, input_syntax, inputs[i]),
reader_flags,
@@ -360,16 +327,13 @@ main(int argc, char** argv)
sink,
stack_size,
inputs[i],
- n_inputs > 1 ? prefix : add_prefix,
block_size))) {
break;
}
}
- free(prefix);
serd_sink_free(canon);
serd_writer_free(writer);
- serd_node_free(NULL, input_name);
serd_env_free(env);
serd_node_free(NULL, base);
serd_world_free(world);