How to delete graph in Titan with Cassandra storage backend?

前端 未结 4 1178
醉话见心
醉话见心 2021-02-14 19:24

I use Titan 0.4.0 All, running Rexster in shared VM mode on Ubuntu 12.04.

How could I properly delete a graph in Titan which is using the Cassandra storage backend?

4条回答
  •  野性不改
    2021-02-14 19:47

    You can clear all the edges/vertices with:

    g.V.remove()
    

    but as you have found that won't clear the types/indices previously created. The most cleanly option would be to just delete the Cassandra data directory.

    If you are executing the delete via a unit test you might try to do this as part of your test setup:

    this.config = new BaseConfiguration(){{
        addProperty("storage.backend", "berkeleyje")
        addProperty("storage.directory", "/tmp/titan-schema-test")
    }}
    GraphDatabaseConfiguration graphconfig = new GraphDatabaseConfiguration(config)
    graphconfig.getBackend().clearStorage()
    g = (StandardTitanGraph) TitanFactory.open(config)
    

    Be sure to call g.shutdown() in your test teardown method.

提交回复
热议问题