diff options
author | David Robillard <d@drobilla.net> | 2018-12-26 20:04:27 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-27 13:13:58 +0100 |
commit | 847e4c265ac82709058abc352169432fc2b6a43a (patch) | |
tree | 959637100894b720210b2d74af5df6a98ab518c3 | |
parent | e2746ac58445ed1a774b545efab4a457bb6b5ac1 (diff) | |
download | serd-847e4c265ac82709058abc352169432fc2b6a43a.tar.gz serd-847e4c265ac82709058abc352169432fc2b6a43a.tar.bz2 serd-847e4c265ac82709058abc352169432fc2b6a43a.zip |
Remove serd_reader_set_default_graph()
-rw-r--r-- | serd/serd.h | 12 | ||||
-rw-r--r-- | src/reader.c | 17 | ||||
-rw-r--r-- | src/reader.h | 1 | ||||
-rw-r--r-- | tests/serd_test.c | 11 |
4 files changed, 3 insertions, 38 deletions
diff --git a/serd/serd.h b/serd/serd.h index 4f17babe..ee15ce9a 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -1110,18 +1110,6 @@ serd_reader_add_blank_prefix(SerdReader* reader, const char* prefix); /** - Set the URI of the default graph. - - If this is set, the reader will emit quads with the graph set to the given - node for any statements that are not in a named graph (which is currently - all of them since Serd currently does not support any graph syntaxes). -*/ -SERD_API -void -serd_reader_set_default_graph(SerdReader* reader, - const SerdNode* graph); - -/** Prepare to read from the file at a local file `uri`. */ SERD_API diff --git a/src/reader.c b/src/reader.c index 52aa3794..b35f257a 100644 --- a/src/reader.c +++ b/src/reader.c @@ -111,17 +111,12 @@ push_node(SerdReader* reader, SerdType type, const char* str, size_t n_bytes) SerdStatus emit_statement(SerdReader* reader, ReadContext ctx, SerdNode* o) { - SerdNode* graph = ctx.graph; - if (!graph && reader->default_graph) { - graph = reader->default_graph; - } - /* Zero the pad of the object node on the top of the stack. Lower nodes (subject and predicate) were already zeroed by subsequent pushes. */ serd_node_zero_pad(o); const SerdStatement statement = { - { ctx.subject, ctx.predicate, o, graph }, + { ctx.subject, ctx.predicate, o, ctx.graph }, &reader->source.cur }; @@ -165,7 +160,6 @@ serd_reader_new(SerdWorld* world, me->world = world; me->sink = sink; - me->default_graph = NULL; me->stack = serd_stack_new(stack_size); me->syntax = syntax; me->next_id = 1; @@ -192,7 +186,6 @@ serd_reader_free(SerdReader* reader) } serd_reader_finish(reader); - serd_node_free(reader->default_graph); #ifdef SERD_STACK_CHECK free(reader->allocs); @@ -216,14 +209,6 @@ serd_reader_add_blank_prefix(SerdReader* reader, } } -void -serd_reader_set_default_graph(SerdReader* reader, - const SerdNode* graph) -{ - serd_node_free(reader->default_graph); - reader->default_graph = serd_node_copy(graph); -} - static SerdStatus skip_bom(SerdReader* me) { diff --git a/src/reader.h b/src/reader.h index aacc2ec8..f19038f8 100644 --- a/src/reader.h +++ b/src/reader.h @@ -57,7 +57,6 @@ struct SerdReaderImpl { SerdNode* rdf_first; SerdNode* rdf_rest; SerdNode* rdf_nil; - SerdNode* default_graph; SerdByteSource source; SerdStack stack; SerdSyntax syntax; diff --git a/tests/serd_test.c b/tests/serd_test.c index 4ff4c8f4..fa13c1b2 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -51,8 +51,7 @@ test_strtod(double dbl, double max_delta) } typedef struct { - int n_statements; - const SerdNode* graph; + int n_statements; } ReaderTest; static SerdStatus @@ -65,7 +64,6 @@ test_sink(void* handle, ReaderTest* rt = (ReaderTest*)handle; ++rt->n_statements; - rt->graph = serd_statement_graph(statement); return SERD_SUCCESS; } @@ -700,18 +698,15 @@ test_reader(const char* path) { SerdWorld* world = serd_world_new(); - ReaderTest rt = { 0, NULL }; + ReaderTest rt = { 0 }; SerdSink* sink = serd_sink_new(&rt); serd_sink_set_statement_func(sink, test_sink); SerdReader* reader = serd_reader_new(world, SERD_TURTLE, sink, 4096); assert(reader); - SerdNode* g = serd_new_uri("http://example.org/"); - serd_reader_set_default_graph(reader, g); serd_reader_add_blank_prefix(reader, "tmp"); serd_reader_add_blank_prefix(reader, NULL); - serd_node_free(g); assert(serd_reader_start_file(reader, "http://notafile", false)); assert(serd_reader_start_file(reader, "file://invalid", false)); @@ -720,8 +715,6 @@ test_reader(const char* path) assert(!serd_reader_start_file(reader, path, true)); assert(!serd_reader_read_document(reader)); assert(rt.n_statements == 13); - assert(rt.graph && serd_node_string(rt.graph) && - !strcmp(serd_node_string(rt.graph), "http://example.org/")); serd_reader_finish(reader); // A read of a big page hits EOF then fails to read chunks immediately |