12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #ifndef _LSUP_GRAPH_H
- #define _LSUP_GRAPH_H
- #include "structures/keyset.h"
- #include "structures/index.h"
- #include "model/rdf/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;
- const 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, const LSUP_Term *uri,
- LSUP_store_type store_type);
- LSUP_Graph *
- LSUP_graph_new(
- size_t capacity, const LSUP_Term *uri,
- 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
|