I am using TitanGraphDB + Cassandra.I am starting Titan as follows
cd titan-cassandra-0.3.1
bin/titan.sh config/titan-server-rexster.xml config/titan-server-cassandra.properties
I have a Rexster shell that I can use to communicate to Titan+Cassandra above.
cd rexster-console-2.3.0
bin/rexster-console.sh
I want to program the Titan Graph DB from my python program.I am using bulbs package for that.
from bulbs.titan import Graph
I want to replace my create() call with get_or_create()
I saw the following example on the web.
james = g.vertices.create(name="James")
written as shown below.
james = g.vertices.get_or_create('name',"James",{'name':'james')
Now my vertex create function is as follows.
self.g.vertices.create({ 'desc':desc,
'port_id':port_id,
'state':state,
'port_state':port_state,
'number':number,
'type':'port'} )
If I want to rewrite the above function call (create()
) which takes multiple key-value pairs using get_or_create()
I first need to create a key.Or does it check all the attributes by default.
I am a beginner in python and I don't realy get the significance of
get_or_create('name',"James",{'name':'james')
why are function attributes specified like this.?
The function definition for get_or_create() is here
Any help will be appreciated.