Clean without Stop?


#1

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


#2

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.


#3

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


#4

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?


#5

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


#6

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.


#7

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