diff options
| author | krasimir <krasimir@chalmers.se> | 2015-08-31 07:15:20 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2015-08-31 07:15:20 +0000 |
| commit | 9a58afe1214ae084a89e0a4683ca4bf174225065 (patch) | |
| tree | ef568d779bd9054b7cdb462ebf678e292842492f /src/runtime/c/sg/sg.h | |
| parent | 5bfaf10de597af504e6d2784309e533b09a6451c (diff) | |
still partial implementation for complex queries in libsg, and added sg.h which I had forgotten to include in darcs
Diffstat (limited to 'src/runtime/c/sg/sg.h')
| -rw-r--r-- | src/runtime/c/sg/sg.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/runtime/c/sg/sg.h b/src/runtime/c/sg/sg.h new file mode 100644 index 000000000..a859bbec2 --- /dev/null +++ b/src/runtime/c/sg/sg.h @@ -0,0 +1,57 @@ +#ifndef SG_SG_H_ +#define SG_SG_H_ + +typedef long long int SgId; + +#include <gu/exn.h> +#include <pgf/pgf.h> + +typedef struct SgSG SgSG; + +SgSG* +sg_open(const char *filename, GuExn* err); + +void +sg_close(SgSG *sg, GuExn* err); + +SgId +sg_insert_expr(SgSG *sg, PgfExpr expr, GuExn* err); + +PgfExpr +sg_select_expr(SgSG *sg, SgId key, GuPool* out_pool, GuExn* err); + + +typedef SgId SgTriple[3]; + +SgId +sg_insert_triple(SgSG *sg, SgTriple triple, GuExn* err); + +bool +sg_select_triple(SgSG *sg, SgId key, SgTriple triple, GuExn* err); + +typedef struct SgTripleResult SgTripleResult; + +SgTripleResult* +sg_query_triple(SgSG *sg, SgTriple triple, GuExn* err); + +bool +sg_triple_result_fetch(SgTripleResult* tres, SgId* pKey, SgTriple triple, GuExn* err); + +void +sg_triple_result_close(SgTripleResult* tres, GuExn* err); + +typedef int SgPattern[3]; + +typedef struct { + SgId* sel; + SgId* vars; + size_t n_patterns; + SgPattern patterns[]; +} SgQuery; + +typedef struct SgQueryResult SgQueryResult; + +SgQueryResult* +sg_query(SgSG *sg, SgQuery* query, GuExn* err); + +#endif |
