I'm running Titan 0.3.2 with Cassandra as a data store. I'm also using rexpro-python for interacting with Titan over RexPro.
Issue & Question:
If I run this Python code:
>>> import rexpro
>>> conn = rexpro.RexProConnection('localhost', 8184, 'graph')
>>> conn.execute('g.addVertex(null, node_dict)', {'node_dict':{'my_dict':{}}})
{'_type': 'vertex', '_id': '2280164', '_properties': {'my_dict': {}}}
>>> conn.execute('g.commit()')
I can look up the resulting node in the Gremlin console:
gremlin> g.v(2280164).map
==>{my_dict={}}
And it looks like the my_dict
map is created properly:
gremlin> g.v(2280164).my_dict.getClass()
==>class java.util.HashMap
However, I'm unable to update my_dict
with a new key & value:
gremlin> g.v(2280164).my_dict['abc'] = 123
==>123
gremlin> g.commit()
==>null
gremlin> g.v(2280164).map
==>{my_dict={}}
If I first reset my_dict
to a new object in the console, my attempt to add key abc
works as expected:
gremlin> g.v(2280164).my_dict = [:]
gremlin> g.v(2280164).my_dict['abc'] = 123
==>123
gremlin> g.v(2280164).map
==>{my_dict={abc=123}}
My question: how can I update my_dict
with a new KV pair on a vertex created via RexPro?
Attempted workarounds/solutions:
This same issue happens when the vertex is created with a non-parameterized version of the python script:
>>> conn.execute('g.addVertex([my_dict:[:]])')
Also, not sure if relevant for this issue, but it looks like the new map created in the console is a LinkedHashMap
(whereas the python/rexpro code created a HashMap
):
gremlin> g.v(2280164).my_dict.getClass()
==>class java.util.LinkedHashMap