diff options
author | David Robillard <d@drobilla.net> | 2018-05-12 13:28:47 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-11-25 22:12:48 +0100 |
commit | c9fe9fdb61e15b64d03a8da062648ecd3f86d700 (patch) | |
tree | 4c2f6a751aed6a8abe03ef0b65bcbf675bf6bda8 /src/statement.c | |
parent | 06f860fd95ba9f97e36416ad8fa3cdadba4f6259 (diff) | |
download | serd-c9fe9fdb61e15b64d03a8da062648ecd3f86d700.tar.gz serd-c9fe9fdb61e15b64d03a8da062648ecd3f86d700.tar.bz2 serd-c9fe9fdb61e15b64d03a8da062648ecd3f86d700.zip |
WIP: Add model
Diffstat (limited to 'src/statement.c')
-rw-r--r-- | src/statement.c | 32 |
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]); +} |