|
Volksdata 1.0b7
RDF library
|

Data Structures | |
| struct | VOLK_Store |
| Store structure. More... | |
Macros | |
| #define | BACKEND_TBL |
| #define | VOLK_store_update_ctx(store, ...) |
| #define | VOLK_store_add_init(store, ...) |
| Non-transactional version of VOLK_store_add_init_txn(). | |
| #define | VOLK_store_add_term(store, ...) |
| Non-transactional version of VOLK_store_add_term_txn(). | |
| #define | VOLK_store_lookup(store, ...) |
| Non-transactional version of VOLK_store_lookup_txn(). | |
| #define | VOLK_store_remove(store, ...) |
| Non-transactional version of VOLK_store_remove_txn(). | |
| #define | VOLK_store_ctx_list(store) |
| Non-transactional version of VOLK_store_ctx_list_txn(). | |
Enumerations | |
| enum | VOLK_StoreType { BACKEND_TBL } |
| Store types. All prefixed with VOLK_STORE_. More... | |
Functions | |
| const VOLK_StoreInt * | VOLK_store_int (VOLK_StoreType type) |
| Return store interface for a specific type. | |
| const char * | VOLK_store_type_label (VOLK_StoreType type) |
| Return the store type label. | |
| VOLK_Store * | VOLK_store_new (const VOLK_StoreType store_type, const char *store_id, size_t size, bool clear) |
| Create a new store. | |
| void | VOLK_store_free (VOLK_Store *store) |
| Free a store created with VOLK_store_new(). | |
| size_t | VOLK_store_size (const VOLK_Store *store) |
| Store size in triples. | |
| VOLK_StoreFeature | VOLK_store_features (const VOLK_Store *store) |
| Feature flags belonging to the store interface. | |
| char * | VOLK_store_id (const VOLK_Store *store) |
| Store identifier. | |
| VOLK_rc | VOLK_store_begin (VOLK_Store *store, int flags, void **txn) |
| Begin a transaction. | |
| VOLK_rc | VOLK_store_commit (VOLK_Store *store, void *txn) |
| Commit a transaction. | |
| void | VOLK_store_abort (VOLK_Store *store, void *txn) |
| Abort (roll back) a transaction. | |
| VOLK_rc | VOLK_store_update_ctx_txn (VOLK_Store *store, void *txn, const VOLK_Buffer *old_c, const VOLK_Buffer *new_c) |
| Update the context of triples in a context-aware store. | |
| void * | VOLK_store_add_init_txn (VOLK_Store *store, void *txn, const VOLK_Buffer *sc) |
| Initialize bulk triple load. | |
| VOLK_rc | VOLK_store_add_iter (VOLK_Store *store, void *it, const VOLK_BufferTriple *sspo) |
| Add one triple into the store. | |
| void | VOLK_store_add_abort (VOLK_Store *store, void *it) |
| Abort an add loop and free iterator. | |
| VOLK_rc | VOLK_store_add_done (VOLK_Store *store, void *it) |
| Finalize an add loop and free iterator. | |
| VOLK_rc | VOLK_store_add_term_txn (VOLK_Store *store, void *txn, VOLK_Buffer *sterm) |
| Add a single term to the store. | |
| void * | VOLK_store_lookup_txn (const VOLK_Store *store, void *txn, const VOLK_Buffer *ss, const VOLK_Buffer *sp, const VOLK_Buffer *so, const VOLK_Buffer *sc, size_t *ct) |
| Look up triples by pattern matching. | |
| VOLK_rc | VOLK_store_iter_next (VOLK_Store *store, void *it, VOLK_BufferTriple *sspo, VOLK_Buffer **ctx) |
| Yield the matching triples and advance the iterator. | |
| void | VOLK_store_iter_free (VOLK_Store *store, void *it) |
| Free an iterator allocated by a lookup. | |
| void * | VOLK_store_iter_txn (const VOLK_Store *store, void *it) |
| Get iterator active transaction handle. | |
| VOLK_rc | VOLK_store_remove_txn (VOLK_Store *store, void *txn, const VOLK_Buffer *ss, const VOLK_Buffer *sp, const VOLK_Buffer *so, const VOLK_Buffer *sc, size_t *ct) |
| Delete triples by pattern matching. | |
| VOLK_Buffer ** | VOLK_store_ctx_list_txn (VOLK_Store *store, void *txn) |
| get index of all graph (context) URIs in a store. | |
| #define BACKEND_TBL |
| #define VOLK_store_update_ctx | ( | store, | |
| ... ) |
| #define VOLK_store_add_init | ( | store, | |
| ... ) |
Non-transactional version of VOLK_store_add_init_txn().
| #define VOLK_store_add_term | ( | store, | |
| ... ) |
Non-transactional version of VOLK_store_add_term_txn().
| #define VOLK_store_lookup | ( | store, | |
| ... ) |
Non-transactional version of VOLK_store_lookup_txn().
| #define VOLK_store_remove | ( | store, | |
| ... ) |
Non-transactional version of VOLK_store_remove_txn().
| #define VOLK_store_ctx_list | ( | store | ) |
Non-transactional version of VOLK_store_ctx_list_txn().
| enum VOLK_StoreType |
| const VOLK_StoreInt * VOLK_store_int | ( | VOLK_StoreType | type | ) |
| const char * VOLK_store_type_label | ( | VOLK_StoreType | type | ) |
| VOLK_Store * VOLK_store_new | ( | const VOLK_StoreType | store_type, |
| const char * | store_id, | ||
| size_t | size, | ||
| bool | clear ) |
Create a new store.
| [in] | store_type | Type of store. One of the values of VOLK_StoreType. |
| [in] | store_id | Identifier for the store. This may be interpreted differently by each store implementation. For the MDB store, this is the file path where the store is located. It is ignored by volatile stores (with VOLK_STORE_PERM feature flag set to false). If a store does not exist for the given identifier, a new one is initialized. If this parameter is NULL, the default store for the selected type is used. |
| [in] | size | Initial size of the store. Only used for optimization purposes. It may be ignored by some implementations and it is always safe to set to 0. |
| [in] | clear | Flag that is passed to the init_fn function of the store interface, if present, to clear an existing store with the same ID. |
| void VOLK_store_free | ( | VOLK_Store * | store | ) |
Free a store created with VOLK_store_new().
| [in] | store | Store handle. |
| size_t VOLK_store_size | ( | const VOLK_Store * | store | ) |
| VOLK_StoreFeature VOLK_store_features | ( | const VOLK_Store * | store | ) |
| char * VOLK_store_id | ( | const VOLK_Store * | store | ) |
| VOLK_rc VOLK_store_begin | ( | VOLK_Store * | store, |
| int | flags, | ||
| void ** | txn ) |
Begin a transaction.
If the store supports it, begin a transaction. Only one transaction may be opened at a time.
The transaction must be either committed with VOLK_store_commit() or rolled back with VOLK_store_abort().
| [in] | store | Store handle. |
| [in] | flags | Flags passed to the back end store. Consult the relevant store implementation for details. |
| [out] | txn | Address to be populated with the new transaction handle. |
| VOLK_rc VOLK_store_commit | ( | VOLK_Store * | store, |
| void * | txn ) |
Commit a transaction.
If the store supports it, commit an open transaction. In case of error, the transaction is left open and it is advisable to roll it back with VOLK_store_abort().
| [in] | store | Store handle. |
| [in] | txn | transaction handle to commit. |
| void VOLK_store_abort | ( | VOLK_Store * | store, |
| void * | txn ) |
| VOLK_rc VOLK_store_update_ctx_txn | ( | VOLK_Store * | store, |
| void * | txn, | ||
| const VOLK_Buffer * | old_c, | ||
| const VOLK_Buffer * | new_c ) |
Update the context of triples in a context-aware store.
When a context URI is updated, all relationships of triples to that context must be updated to reflect the new context.
| [in] | store | Store handle. |
| [in] | txn | Transaction handle. If NULL, a new transaction is opened. This is ignored by non-transactional back ends. |
| [in] | old_c | Old context handle. |
| [in] | new_c | New context handle. |
| void * VOLK_store_add_init_txn | ( | VOLK_Store * | store, |
| void * | txn, | ||
| const VOLK_Buffer * | sc ) |
Initialize bulk triple load.
This is the first step of a bulk load. It is best used when the data at hand need to be pre-processed, which can be done in the same loop as the next step to keep memory usage low.
| [in] | store | The store to add to. |
| [in] | txn | Transaction handle. If NULL, a new transaction is opened. This is ignored by non-transactional back ends. |
| [in] | sc | Context as a serialized term. If this is NULL, and the default context is not NULL, triples will be added to the default context for the store, If the default context for the store is NULL, regardless of the value of sc, triples will be added with no context. Only meaningful for stores with the VOLK_STORE_CTX feature. |
| VOLK_rc VOLK_store_add_iter | ( | VOLK_Store * | store, |
| void * | it, | ||
| const VOLK_BufferTriple * | sspo ) |
Add one triple into the store.
This must be called after store_add_init_fn_t, using the iterator yielded by that function. It may be called multiple times and must be followed by store_add_done_fn_t or store_add_abort_fn_t (if supported).
| [in] | store | Store handle. |
| [in] | it | Iterator obtained by VOLK_store_add_init(). |
| [in] | sspo | Serialized triple to be added. |
| void VOLK_store_add_abort | ( | VOLK_Store * | store, |
| void * | it ) |
Abort an add loop and free iterator.
Usually called on an irrecoverable error from store_add_iter_fn_t. None of the successful inserts in the same loop is retained.
| [in] | store | Store handle. |
| [in] | it | Iterator obtained by store_add_init_fn_t. |
| VOLK_rc VOLK_store_add_done | ( | VOLK_Store * | store, |
| void * | it ) |
Finalize an add loop and free iterator.
This must be called after store_add_iter_fn_t.
| [in] | store | Store handle. |
| [in] | it | Iterator obtained by VOLK_store_add_init(). |
| VOLK_rc VOLK_store_add_term_txn | ( | VOLK_Store * | store, |
| void * | txn, | ||
| VOLK_Buffer * | sterm ) |
| void * VOLK_store_lookup_txn | ( | const VOLK_Store * | store, |
| void * | txn, | ||
| const VOLK_Buffer * | ss, | ||
| const VOLK_Buffer * | sp, | ||
| const VOLK_Buffer * | so, | ||
| const VOLK_Buffer * | sc, | ||
| size_t * | ct ) |
Look up triples by pattern matching.
This function may return a count of matches and/or an iterator of results as serialized triples.
For stores with VOLK_STORE_TXN, this opens a read-only transaction. The transaction handle is held in the iterator structure and is closed when the iterator is freed with iter_free_fn_t().
Any and all of the terms may be NULL, which indicates an unbound query term. Stores witout context support will always ignore sc.
| [in] | store | The store to be queried. |
| [in] | txn | Transaction handle. If NULL, a new transaction is opened. This is ignored by non-transactional back ends. |
| [in] | ss | Serialized s term. |
| [in] | sp | Serialized p term. |
| [in] | so | Serialized o term. |
| [in] | sc | Serialized context to limit search to. It may be NULL, in which case search is done in all contexts. Note that triples inserted without context are assigned the default context for the store. |
| [out] | ct | If not NULL, this will be populated with the number of entries found. In some implementations, it is very inexpensive to set for lookups without context, much less so for 1-bound and 2-bound context lookups, in which cases it should be set only if needed. |
| VOLK_rc VOLK_store_iter_next | ( | VOLK_Store * | store, |
| void * | it, | ||
| VOLK_BufferTriple * | sspo, | ||
| VOLK_Buffer ** | ctx ) |
Yield the matching triples and advance the iterator.
| [in] | store | Store handle. |
| [in] | it | Opaque iterator handle obtained with store_lookup_fn_t. |
| [out] | sspo | VOLK_BufferTriple to be populated with three serialized terms if found. It may be NULL, in which case it is not populated. |
| [out] | ctx | If not NULL, it is populated with a NULL-terminated array of VOLK_Buffer structs, one for each context associated with the matching triple. These contexts are the same regardless of the context filter used in the lookup. The array is freed with a simple free(). This parameter is ignored by implementations without the VOLK_STORE_CTX feature. |
To iterate over the context array, use this loop:
size_t i = 0;
while (ctx[i].addr)
do_something(ctx + (i++));
| void VOLK_store_iter_free | ( | VOLK_Store * | store, |
| void * | it ) |
| void * VOLK_store_iter_txn | ( | const VOLK_Store * | store, |
| void * | it ) |
Get iterator active transaction handle.
This function is used to get an active transaction during an iteration loop in order to perform an action using the store state within that loop. Some stores (e.g. MDB) only support one R/W open transaction per thread, so this is also the only way to perform anything else than iterating or committing while a loop is open.
| [in] | store | Store handle. |
| [in] | it | Iterator handle to get the transaction from. |
| VOLK_rc VOLK_store_remove_txn | ( | VOLK_Store * | store, |
| void * | txn, | ||
| const VOLK_Buffer * | ss, | ||
| const VOLK_Buffer * | sp, | ||
| const VOLK_Buffer * | so, | ||
| const VOLK_Buffer * | sc, | ||
| size_t * | ct ) |
Delete triples by pattern matching.
| [in] | store | The store to be queried. |
| [in] | txn | Transaction handle. If NULL, a new transaction is opened. This is ignored by non-transactional back ends. |
| [in] | ss | Serialized s term. |
| [in] | sp | Serialized p term. |
| [in] | so | Serialized o term. |
| [in] | sc | Serialized context to limit search to. It may be NULL, in which case search is done in all contexts. Note that triples inserted without context are assigned the default context for the store. |
| [out] | ct | If not NULL, this will be populated with the number of triples actually deleted. |
| VOLK_Buffer ** VOLK_store_ctx_list_txn | ( | VOLK_Store * | store, |
| void * | txn ) |
get index of all graph (context) URIs in a store.
Only applicable to stores with the VOLK_STORE_CTX feature flag.
| [in] | store | Store handle. |
| [in] | txn | Transaction handle. If NULL, a new transaction is opened. This is ignored by non-transactional back ends. |