summaryrefslogtreecommitdiffstats
path: root/sord
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-18 16:33:11 +0000
committerDavid Robillard <d@drobilla.net>2012-03-18 16:33:11 +0000
commit50733eb0168565dd75f01cbdb9d9eb7a6c7f06ac (patch)
tree673617f815fd19936603b7d0a5e3dde9c3ebab9b /sord
parentbdc71a0f45891d4dd20b4f56e05da056cd56eeab (diff)
downloadsord-50733eb0168565dd75f01cbdb9d9eb7a6c7f06ac.tar.gz
sord-50733eb0168565dd75f01cbdb9d9eb7a6c7f06ac.tar.bz2
sord-50733eb0168565dd75f01cbdb9d9eb7a6c7f06ac.zip
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
Diffstat (limited to 'sord')
-rw-r--r--sord/sord.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/sord/sord.h b/sord/sord.h
index 0d71d99..9bd3f02 100644
--- a/sord/sord.h
+++ b/sord/sord.h
@@ -75,6 +75,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.
*/
typedef struct SordIterImpl SordIter;
@@ -390,6 +399,64 @@ 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
@{
*/