For any one as clueless as me this is what I have done:
1) Download Groovy 2) Create a text file. For example...
import com.thinkaurelius.titan.core.*
import com.thinkaurelius.titan.core.titan.*
TitanGraph graph = TitanFactory.open("/Users/Ian/titan/conf/titan-cassandra-es.properties");
m = graph.getManagementSystem()
m.commit()
graph.shutdown()
You can see I have some class references to the API and I've connected to the database using the config file that was installed with the Titan distribution I downloaded from the website.
You need the graph.shutdown()
else the console blocks. Although the documentation makes it sound like this shuts down the entire database. But it only seems to close the connection.
3) From the command line...
bin/groovy -cp "../titan/lib/*" "../webstormprojects/myproject/titan.groovy"
The class path is set to the lib
folder in my Titan instillation folder. The *
includes all the packages.
And now hopefully I'm all set to add some indexes. Be aware that the Titan API has been through some significant changes so some of the online info is out of date. This is quite helpful.
Here is the latest documentation.