5.10.2 Sink

typedef struct SerdSinkImpl SerdSink

An interface that receives a stream of RDF data.

typedef void (*SerdFreeFunc)(void *ptr)

Function to free an opaque handle.

SerdSink *serd_sink_new(const SerdWorld *world, void *handle, SerdEventFunc event_func, SerdFreeFunc free_handle)

Create a new sink.

Parameters
  • world – The world the new sink will be a part of.

  • handle – Opaque handle that will be passed to sink functions.

  • event_func – Function that will be called for every event.

  • free_handle – Free function to call on handle in serd_sink_free().

void serd_sink_free(SerdSink *sink)

Free sink

SerdStatus serd_sink_write_event(const SerdSink *sink, const SerdEvent *event)

Send an event to the sink.

SerdStatus serd_sink_write_base(const SerdSink *sink, const SerdNode *uri)

Set the base URI.

SerdStatus serd_sink_write_prefix(const SerdSink *sink, const SerdNode *name, const SerdNode *uri)

Set a namespace prefix.

SerdStatus serd_sink_write_statement(const SerdSink *sink, SerdStatementFlags flags, const SerdStatement *statement)

Write a statement.

SerdStatus serd_sink_write(const SerdSink *sink, SerdStatementFlags flags, const SerdNode *subject, const SerdNode *predicate, const SerdNode *object, const SerdNode *graph)

Write a statement from individual nodes.

SerdStatus serd_sink_write_end(const SerdSink *sink, const SerdNode *node)

Mark the end of an anonymous node.