Discussion Forum

Clean without Stop?

Hi,
Is it possible to clean a specific keyspace without stop the whole engine? Because on process of ontology+data development I need to reload the keyspace many times…
Thanks,
Ely

Yes! Specific keyspaces can be cleaned without having to stop and start the engine. There are two ways to do this:

1 Using the Java API:

graknGraph.admin().delete();

2 Using the Graql Shell and typing clean while inside the shell connected to a specific keyspace

@felix I could not find the clean command in the documentation for the graql shell. Could you double check this and add it if it is missing? This could just be reading ineptitude on my part.

Hi @filipe
Ok, it works! But I’m not able to put ‘clean;’ in the first line of ontology text file (to automate the process - every time I load the ontology, automatically the previous one on keyspace would be cleaned).
Thanks,
Ely

Ah yes. So clean is not actually a graql command. It is a shell command. Furthermore, the command:

./graql.sh -f yourAmazingFile.gql

results in the file yourAmazingFile.gql just getting passed straight to the Grakn Server for processing and the server only interprets valid graql commands, which clean is currently not one of them.

TL/DR: It’s a funny limitation we have right now that we should be able to work around. @felix your thoughts on this one?

hi @filipe
ok, it’s working at graql.sh. But a few seconds after ‘confirm’ I receive
>>> Websocket closed, code: 1011, reason: NullPointerException
and I must restart the graqh.sh if I need to clean keyspace again. Is it correct? If so, it is possible to define the timeout of connection?
Thanks,
Ely

For the moment it is “correct” or at least a limitation. Cleaning the graph actually closes the connection. This is done so that the graph can be cleaned more quickly. I actually think clean is a bit misleading, you are actually deleting the graph entirely.

The exception you getting is unfriendly though. We will look into that and try to cleanup this process.

hi @filipe
Thanks for explanation. Maybe there is a shortcut command(s) to delete all entities, roles, relations, etc, without ‘clean’ the keyspace.
Ely

1 Like

just coming to grakn and trying to set up a graph. Making lots of mistakes and want a quick way to “reset” every time.

one workaround I thought of is to create a new keyspace everytime my sh file runs… then go back and clean them up later. But it’s a hack!

now every time i have to do this:

is there a way to delete a whole schema from workbase?

From workbase, I think at this time there is no such functionality! Feel free to add a feature request in github: github.com/graknlabs/workbase 's issues :slight_smile: