aboutsummaryrefslogtreecommitdiffstats
path: root/src/statement.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-05-12 13:28:47 +0200
committerDavid Robillard <d@drobilla.net>2018-12-31 12:15:40 -0500
commit0342270f81dc9c676a92422c4e73484fb44f6da8 (patch)
tree384eff3b328eb2c287e4078a789adffbd1cdd765 /src/statement.c
parent5307a8cf2a29a84fed72373f08f8f9cb20215f20 (diff)
downloadserd-0342270f81dc9c676a92422c4e73484fb44f6da8.tar.gz
serd-0342270f81dc9c676a92422c4e73484fb44f6da8.tar.bz2
serd-0342270f81dc9c676a92422c4e73484fb44f6da8.zip
WIP: Add model
Diffstat (limited to 'src/statement.c')
-rw-r--r--src/statement.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/statement.c b/src/statement.c
index 24440a38..347cfe78 100644
--- a/src/statement.c
+++ b/src/statement.c
@@ -51,3 +51,35 @@ serd_statement_get_cursor(const SerdStatement* statement)
{
return statement->cursor;
}
+
+bool
+serd_statement_equals(const SerdStatement* a, const SerdStatement* b)
+{
+ return (serd_node_equals(a->nodes[0], b->nodes[0]) &&
+ serd_node_equals(a->nodes[1], b->nodes[1]) &&
+ serd_node_equals(a->nodes[2], b->nodes[2]) &&
+ serd_node_equals(a->nodes[3], b->nodes[3]));
+}
+
+bool
+serd_statement_matches(const SerdStatement* statement,
+ const SerdNode* subject,
+ const SerdNode* predicate,
+ const SerdNode* object,
+ const SerdNode* graph)
+
+{
+ return (serd_node_pattern_match(statement->nodes[0], subject) &&
+ serd_node_pattern_match(statement->nodes[1], predicate) &&
+ serd_node_pattern_match(statement->nodes[2], object) &&
+ serd_node_pattern_match(statement->nodes[3], graph));
+}
+
+bool
+serd_statement_matches_quad(const SerdStatement* statement, const SerdQuad quad)
+{
+ return serd_node_pattern_match(statement->nodes[0], quad[0]) &&
+ serd_node_pattern_match(statement->nodes[1], quad[1]) &&
+ serd_node_pattern_match(statement->nodes[2], quad[2]) &&
+ serd_node_pattern_match(statement->nodes[3], quad[3]);
+}