From 50733eb0168565dd75f01cbdb9d9eb7a6c7f06ac Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 18 Mar 2012 16:33:11 +0000 Subject: Add SordInserter for writing to a model via Serd sink functions. git-svn-id: http://svn.drobilla.net/sord/trunk@209 3d64ff67-21c5-427c-a301-fe4f08042e5a --- sord/sord.h | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'sord/sord.h') diff --git a/sord/sord.h b/sord/sord.h index 0d71d99..9bd3f02 100644 --- a/sord/sord.h +++ b/sord/sord.h @@ -74,6 +74,15 @@ typedef struct SordWorldImpl SordWorld; */ typedef struct SordModelImpl SordModel; +/** + Model Inserter. + + An inserter is used for writing statements to a model using the Serd sink + interface. This makes it simple to write to a model directly using a + SerdReader, or any other code that writes statements to a SerdStatementSink. +*/ +typedef struct SordInserterImpl SordInserter; + /** Model Iterator. */ @@ -388,6 +397,64 @@ SORD_API void sord_remove(SordModel* model, const SordQuad quad); +/** + @} + @name Inserter + @{ +*/ + +/** + Create an inserter for writing statements to a model. +*/ +SORD_API +SordInserter* +sord_inserter_new(SordModel* model, + SerdEnv* env); + +/** + Free an inserter. +*/ +SORD_API +void +sord_inserter_free(SordInserter* inserter); + +/** + Set the current base URI for writing to the model. + + Note this function can be safely casted to SerdBaseSink. +*/ +SORD_API +SerdStatus +sord_inserter_set_base_uri(SordInserter* inserter, + const SerdNode* uri); + +/** + Set a namespace prefix for writing to the model. + + Note this function can be safely casted to SerdPrefixSink. +*/ +SORD_API +SerdStatus +sord_inserter_set_prefix(SordInserter* inserter, + const SerdNode* name, + const SerdNode* uri); + +/** + Write a statement to the model. + + Note this function can be safely casted to SerdStatementSink. +*/ +SORD_API +SerdStatus +sord_inserter_write_statement(SordInserter* inserter, + SerdStatementFlags flags, + const SerdNode* graph, + const SerdNode* subject, + const SerdNode* predicate, + const SerdNode* object, + const SerdNode* object_datatype, + const SerdNode* object_lang); + /** @} @name Iteration -- cgit v1.2.1