aboutsummaryrefslogtreecommitdiffstats
path: root/src/statement.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-07-10 22:01:30 -0400
committerDavid Robillard <d@drobilla.net>2022-01-14 19:37:51 -0500
commit07b716c38625dd954be279e3476164b5bb1d6293 (patch)
tree3b2d75ab74dad40c7d54d2dbee2fcad3d54f6935 /src/statement.c
parent94eeeadeb5be3d9c9266bed5d3c32c6ff29695b4 (diff)
downloadserd-07b716c38625dd954be279e3476164b5bb1d6293.tar.gz
serd-07b716c38625dd954be279e3476164b5bb1d6293.tar.bz2
serd-07b716c38625dd954be279e3476164b5bb1d6293.zip
Add serd_statement_matches()
Diffstat (limited to 'src/statement.c')
-rw-r--r--src/statement.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/statement.c b/src/statement.c
index f3034566..d6571c6c 100644
--- a/src/statement.c
+++ b/src/statement.c
@@ -17,6 +17,7 @@
#include "statement.h"
#include "caret.h"
+#include "node.h"
#include <assert.h>
#include <stdbool.h>
@@ -132,3 +133,16 @@ serd_statement_equals(const SerdStatement* const a,
serd_node_equals(a->nodes[2], b->nodes[2]) &&
serd_node_equals(a->nodes[3], b->nodes[3])));
}
+
+bool
+serd_statement_matches(const SerdStatement* const statement,
+ const SerdNode* const subject,
+ const SerdNode* const predicate,
+ const SerdNode* const object,
+ const SerdNode* const 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));
+}