Fails to save edges into janusgraph
I'm attempting to use Goblin against a janusgraph backed, and I've run into an issue. It appears the Goblin can't handle the RelationIdentifier ids of the JanusGraph Edges. RelationIdentifier is a complex type that contains the id within it. I was able to partially work around the issue by setting the get_hashable_id function, but queries fail on session.py:444.
props = await self._g.E(elem.id).valueMap(True).next()
I found I could work around the issue with the following.
if isinstance(elem.id, dict):
props = await self._g.E(elem.id['@value']['relationId']).valueMap(True).next()
else:
props = await self._g.E(elem.id).valueMap(True).next()
I was able to reproduce the problem with a simple script.
import asyncio
import goblin
from goblin import Goblin, Vertex, Edge
from goblin.session import Session
import time
loop = asyncio.get_event_loop()
app = loop.run_until_complete(Goblin.open(loop, hosts=['localhost']))
class Knows(goblin.Edge):
pass
class Person(goblin.Vertex):
pass
async def do_the_thing():
p1 = Person()
p2 = Person()
e1 = Knows(p1, p2)
session: Session = await app.session()
session.add(p1, p2, e1)
await session.flush()
loop.run_until_complete(do_the_thing())