Question

I am newbie to Titan graph database.

I am trying to process local data, and insert them into titan db.

I am looking for the program language or script language that can do fast way to process local data and update/insert titan db.

bulbs, is python interface, using REST API to update titan db. but I see sometimes the program hang over there.

Can I use shell script to process the file, and call gremlin script to update titan db?

Thanks a lot for advice.

Was it helpful?

Solution

If the graph schema is not too complex and the data in a single file, the easiest way is to simply use a Gremlin script. Check out this simple recipe to load an edge list:

http://gremlindocs.com/#recipes/reading-from-a-file

If you have a large amount of data, consider using the BatchGraph wrapper for easier programming, auto-commit and better performance:

https://github.com/tinkerpop/blueprints/wiki/Batch-Implementation

Once you have your script, you could run it in the Gremlin REPL or execute it from shell script with gremlin.sh:

https://github.com/tinkerpop/gremlin/wiki/Using-Gremlin-through-Groovy#gremlin-and-groovy-shell

Note that your question is about Titan, but I've responded generically with Blueprints in mind (so you will see TinkerGraph examples in many of these links), but since Titan is Blueprints compatible the code should work just as well for Titan.

OTHER TIPS

I know this is an old question, but gremlin-migrate is an npm package that runs gremlin scripts in the order in which they were intended. I'd use it not really for one-off data loads, but more for continuously ensuring your DB schema etc is correct and up-to-date. Good to include in your CI/CD pipeline :-).

Disclosure: I'm the author of the tool, which I created after reading this and not finding a gremlin based migration tool in npm.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top