Statement

SerdStatement *serd_statement_new(const SerdNode *s, const SerdNode *p, const SerdNode *o, const SerdNode *g, const SerdCursor *cursor)

Create a new statement.

Note that, to minimise model overhead, statements do not own their nodes, so they must have a longer lifetime than the statement for it to be valid. For statements in models, this is the lifetime of the model. For user-created statements, the simplest way to handle this is to use SerdNodes.

Parameters
  • s – The subject

  • p – The predicate (“key”)

  • o – The object (“value”)

  • g – The graph (“context”)

  • cursor – Optional cursor at the origin of this statement

Returns

A new statement that must be freed with serd_statement_free()

SerdStatement *serd_statement_copy(const SerdStatement *statement)

Return a copy of statement

void serd_statement_free(SerdStatement *statement)

Free statement

const SerdNode *serd_statement_node(const SerdStatement *statement, SerdField field)

Return the given node in statement

const SerdNode *serd_statement_subject(const SerdStatement *statement)

Return the subject in statement

const SerdNode *serd_statement_predicate(const SerdStatement *statement)

Return the predicate in statement

const SerdNode *serd_statement_object(const SerdStatement *statement)

Return the object in statement

const SerdNode *serd_statement_graph(const SerdStatement *statement)

Return the graph in statement

const SerdCursor *serd_statement_cursor(const SerdStatement *statement)

Return the source location where statement originated, or NULL.

bool serd_statement_equals(const SerdStatement *a, const SerdStatement *b)

Return true iff a is equal to b, ignoring statement cursor metadata.

Only returns true if nodes are equivalent, does not perform wildcard matching.

bool serd_statement_matches(const SerdStatement *statement, const SerdNode *subject, const SerdNode *predicate, const SerdNode *object, const SerdNode *graph)

Return true iff statement matches the given pattern.

Nodes match if they are equivalent, or if one of them is NULL. The statement matches if every node matches.