1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #ifndef _LSUP_GRAPH_H
- #define _LSUP_GRAPH_H
- #include "keyset.h"
- #include "index.h"
- #include "triple.h"
- typedef enum LSUP_store_type {
- LSUP_STORE_MEM,
- LSUP_STORE_MDB
- } LSUP_store_type;
- typedef struct LSUP_Graph {
- LSUP_store_type store_type;
- LSUP_Keyset *keys;
- LSUP_Term *uri;
- LSUP_Index *idx;
- } LSUP_Graph;
- typedef void (*lookup_callback_fn_t)(
- LSUP_Graph gr, const LSUP_TripleKey* spok_p, void* ctx
- );
- int
- LSUP_graph_init(
- LSUP_Graph *gr, size_t capacity, char *uri_str,
- LSUP_store_type store_type);
- LSUP_Graph *
- LSUP_graph_new(size_t capacity, char *uri_str, LSUP_store_type store_type);
- bool
- LSUP_graph_contains(const LSUP_Graph *gr, const LSUP_Triple *t);
- /**
- * Add triples to a graph.
- */
- int
- LSUP_graph_add(LSUP_Graph *gr, LSUP_Triple data[], size_t data_size);
- void
- LSUP_graph_free(LSUP_Graph *gr);
- /** Extern inline functions. */
- inline size_t
- LSUP_graph_capacity(LSUP_Graph *gr) { return gr->keys->capacity; }
- inline size_t
- LSUP_graph_size(LSUP_Graph *gr) { return gr->keys->free_i; }
- #endif
|