|
@@ -126,7 +126,6 @@ static int l_graph_contains (lua_State *L)
|
|
|
static int l_graph_add (lua_State *L)
|
|
|
{
|
|
|
LSUP_Graph *gr = check_graph (L);
|
|
|
- LOG_DEBUG ("Triples type: %s", lua_typename (L, lua_type (L, 2)));
|
|
|
int rc;
|
|
|
LSUP_rc lsup_rc= LSUP_NOACTION;
|
|
|
size_t i = 0, ct = 0;
|
|
@@ -154,6 +153,27 @@ static int l_graph_add (lua_State *L)
|
|
|
}
|
|
|
|
|
|
|
|
|
+static int l_graph_remove (lua_State *L)
|
|
|
+{
|
|
|
+ LSUP_Graph *gr = check_graph (L);
|
|
|
+ const LSUP_Term *s, *p, *o;
|
|
|
+ if lua_isnoneornil (L, 2) s = NULL;
|
|
|
+ else s = *(LSUP_Term **)luaL_checkudata (L, 2, "LSUP.Term");
|
|
|
+ if lua_isnoneornil (L, 3) p = NULL;
|
|
|
+ else p = *(LSUP_Term **)luaL_checkudata (L, 3, "LSUP.Term");
|
|
|
+ if lua_isnoneornil (L, 4) o = NULL;
|
|
|
+ else o = *(LSUP_Term **)luaL_checkudata (L, 4, "LSUP.Term");
|
|
|
+
|
|
|
+ size_t ct;
|
|
|
+ LSUP_rc rc = LSUP_graph_remove (gr, s, p, o, &ct);
|
|
|
+
|
|
|
+ LUA_PCHECK (rc, "Error removing triples from graph.");
|
|
|
+ lua_pushinteger (L, ct);
|
|
|
+
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
static int graph_iter_next (lua_State *L)
|
|
|
{
|
|
|
LSUP_GraphIterator **it_p = lua_touserdata (L, lua_upvalueindex (1));
|
|
@@ -327,10 +347,12 @@ static const luaL_Reg graph_lib_meth [] = {
|
|
|
|
|
|
{"copy", l_graph_copy},
|
|
|
{"copy_contents", l_graph_copy_contents},
|
|
|
- {"contains", l_graph_contains},
|
|
|
|
|
|
{"add", l_graph_add},
|
|
|
+ {"remove", l_graph_remove},
|
|
|
+
|
|
|
{"lookup", l_graph_lookup},
|
|
|
+ {"contains", l_graph_contains},
|
|
|
{"connections", l_graph_connections},
|
|
|
{"term_set", l_graph_term_set},
|
|
|
{"unique_terms", l_graph_unique_terms},
|