Hello list,
I am trying to write a stored procedure which deletes a set of graphs
matching a query. This is what I have so far:
create procedure nrl_drop_graphs(IN QUERY_BASE STRING)
{
DECLARE query STRING;
query := query_base + ' LIMIT 1000';
declare cnt integer;
cnt := 0;
while(1)
{
declare it cursor for sparql query;
open it;
declare v any;
while(1)
{
WHENEVER NOT FOUND goto done;
FETCH it INTO g;
vector_concat(v, g);
}
done: ;
close it;
if(length(v)=0) return;
for(any g in v)
{
cnt := cnt + 1;
sparql drop graph g;
}
}
}
The idea is to get all the graphs in batches of 1000 and drop them one
by one since that is not possible with SPARUL (at least not in 6.1.4).
It fails at the "declare cursor" since it is not happy with the
"sparql". This is the first time I try my luck with stored procedures so
the code may contains lots of stupidities. :P
Thanks for your help.
Cheers,
Sebastian