From 1159aea45d9bc4ade2e82856be403d58e050f32d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 27 Jul 2021 19:01:45 -0400 Subject: Add statement filtering --- include/serd/serd.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'include/serd') diff --git a/include/serd/serd.h b/include/serd/serd.h index fad9d070..5edb4b2f 100644 --- a/include/serd/serd.h +++ b/include/serd/serd.h @@ -1964,6 +1964,41 @@ serd_canon_new(const SerdWorld* SERD_NULLABLE world, const SerdSink* SERD_NONNULL target, SerdCanonFlags flags); +/** + @} + @defgroup serd_filter Filter + @{ +*/ + +/** + Return a new sink that filters out statements that do not match a pattern. + + The returned sink acts like `target` in all respects, except that some + statements may be dropped. + + @param target The target sink to pass the filtered data to. + + @param subject The optional subject of the filter pattern. + + @param predicate The optional predicate of the filter pattern. + + @param object The optional object of the filter pattern. + + @param graph The optional graph of the filter pattern. + + @param inclusive If true, then only statements that match the pattern are + passed through. Otherwise, only statements that do *not* match the pattern + are passed through. +*/ +SERD_API +SerdSink* SERD_ALLOCATED +serd_filter_new(const SerdSink* SERD_NONNULL target, + const SerdNode* SERD_NULLABLE subject, + const SerdNode* SERD_NULLABLE predicate, + const SerdNode* SERD_NULLABLE object, + const SerdNode* SERD_NULLABLE graph, + bool inclusive); + /** @} @defgroup serd_env Environment -- cgit v1.2.1