/** @file store.htable.h * * @brief Simple in-memory triple store back end based on hash tables. * * This is the simplest choice to do in-memory manipulation of RDF graphs and * it has some limitations: most notably, it only supports triples without * context (one graph per store) and it is not indexed. This means that it is * optimized for fast writes and sequential lookups (iteration). Lookups on * arbitrary terms are supported but require iterating over all the triples. * This implementation is most convenient for graphs where retrieval is done * via iteration. * * Also, as it may be obvious, this store is not persistent. * * For faster random lookups and persistence, the MDB backend is preferred. If * persistence is not required (e.g. ingesting and manipulating a very large * graph and outputting some results on a file) an ad-hoc MDB store located in * RAM disk can be used, which is much faster. */ #ifndef _LSUP_STORE_HTABLE_H #define _LSUP_STORE_HTABLE_H #include "triple.h" #include "htable.h" typedef struct HTStore LSUP_HTStore; typedef struct HTIterator LSUP_HTIterator; LSUP_HTStore * LSUP_htstore_new(size_t capacity); /** @brief Boolean operation on hash table triples. * * The resulting store is compacted to the minimum size necessary to hold all * results. * * @param op[in] Operation type. See #LSUP_bool_op * * @param s1[in] First store. * * @param s2[in] Second store. * * @return New store resulting from the operation. It must be freed with * #LSUP_htstore_free after use. */ LSUP_HTStore * LSUP_htstore_bool_op( const LSUP_bool_op op, const LSUP_HTStore *s1, const LSUP_HTStore *s2); void LSUP_htstore_free(LSUP_HTStore *ht); LSUP_rc LSUP_htstore_resize(LSUP_HTStore *ht, htsize_t size); LSUP_rc LSUP_htstore_add(LSUP_HTStore *store, const LSUP_SerTriple *sspo); LSUP_rc LSUP_htstore_remove( LSUP_HTStore *store, const LSUP_SerTriple *sspo, size_t *ct); LSUP_HTIterator * LSUP_htstore_lookup( LSUP_HTStore *store, const LSUP_SerTriple *sspo, size_t *ct); htsize_t LSUP_htstore_size(LSUP_HTStore *ht); htsize_t LSUP_htstore_capacity(const LSUP_HTStore *ht); LSUP_rc LSUP_htiter_next(LSUP_HTIterator *it, LSUP_SerTriple *sspo); void LSUP_htiter_free(LSUP_HTIterator *it); #endif // _LSUP_STORE_HTABLE_H