aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/serd/serd.h57
1 files changed, 51 insertions, 6 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h
index b5c7c4f0..e32e66cc 100644
--- a/include/serd/serd.h
+++ b/include/serd/serd.h
@@ -84,6 +84,9 @@ extern "C" {
/// Global library state
typedef struct SerdWorldImpl SerdWorld;
+/// A subject, predicate, and object, with optional graph context
+typedef struct SerdStatementImpl SerdStatement;
+
/// The origin of a statement in a document
typedef struct SerdCursorImpl SerdCursor;
@@ -841,12 +844,10 @@ typedef SerdStatus (*SerdPrefixFunc)(void* SERD_NULLABLE handle,
Called for every RDF statement in the serialisation.
*/
-typedef SerdStatus (*SerdStatementFunc)(void* SERD_NULLABLE handle,
- SerdStatementFlags flags,
- const SerdNode* SERD_NULLABLE graph,
- const SerdNode* SERD_NONNULL subject,
- const SerdNode* SERD_NONNULL predicate,
- const SerdNode* SERD_NONNULL object);
+typedef SerdStatus (*SerdStatementFunc)(void* SERD_NULLABLE handle,
+ SerdStatementFlags flags,
+ const SerdStatement* SERD_NONNULL
+ statement);
/**
Sink function for anonymous node end markers
@@ -1037,6 +1038,13 @@ serd_sink_write_prefix(const SerdSink* SERD_NONNULL sink,
const SerdNode* SERD_NONNULL name,
const SerdNode* SERD_NONNULL uri);
+/// Write a statement
+SERD_API
+SerdStatus
+serd_sink_write_statement(const SerdSink* SERD_NONNULL sink,
+ SerdStatementFlags flags,
+ const SerdStatement* SERD_NONNULL statement);
+
/// Write a statement from individual nodes
SERD_API
SerdStatus
@@ -1266,6 +1274,43 @@ serd_writer_finish(SerdWriter* SERD_NONNULL writer);
/**
@}
+ @defgroup serd_statement Statement
+ @{
+*/
+
+/// Return the given node in `statement`
+SERD_PURE_API
+const SerdNode* SERD_NULLABLE
+serd_statement_node(const SerdStatement* SERD_NONNULL statement,
+ SerdField field);
+
+/// Return the subject in `statement`
+SERD_PURE_API
+const SerdNode* SERD_NONNULL
+serd_statement_subject(const SerdStatement* SERD_NONNULL statement);
+
+/// Return the predicate in `statement`
+SERD_PURE_API
+const SerdNode* SERD_NONNULL
+serd_statement_predicate(const SerdStatement* SERD_NONNULL statement);
+
+/// Return the object in `statement`
+SERD_PURE_API
+const SerdNode* SERD_NONNULL
+serd_statement_object(const SerdStatement* SERD_NONNULL statement);
+
+/// Return the graph in `statement`
+SERD_PURE_API
+const SerdNode* SERD_NULLABLE
+serd_statement_graph(const SerdStatement* SERD_NONNULL statement);
+
+/// Return the source location where `statement` originated, or NULL
+SERD_PURE_API
+const SerdCursor* SERD_NULLABLE
+serd_statement_cursor(const SerdStatement* SERD_NONNULL statement);
+
+/**
+ @}
@defgroup serd_cursor Cursor
@{
*/