1

We are trying to update neo4j database with our own graphhml file. For that we need to clear the neo4j database. When we try using g.clear() it gives an error. The trace is as follows :

gremlin> g.clear() No signature of method: groovy.lang.MissingMethodException.clear() is applicable for argument types: () values: [] Possible solutions: sleep(long), sleep(long, groovy.lang.Closure), every(), grep(), collect(), use([Ljava.lang.Object;)

What could be the problem ?

2 Answers 2

1

Graph.clear() was removed when Blueprints went to version 2.0.0.

Try using remove():

gremlin> g = new Neo4jGraph("/tmp/neo4j")
==>neo4jgraph[EmbeddedGraphDatabase [\tmp\neo4j]]
gremlin> g.addVertex()
==>v[1]
gremlin> g.commit()
==>null
gremlin> g.V
==>v[1]
gremlin> g.V.remove()
==>null
gremlin> g.V
==>v[1]
gremlin> g.commit()
==>null
gremlin> g.V
gremlin>
1

Graph.clear() is either removed or sometimes disabled even though it should be available, another method apart from stephen's answer is:

g.V.sideEffect{g.removeVertex(it)}.iterate();

a commit is necessary if you are not submitting your commands via REST

or see: Gremlin remove all Vertex

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.