Comments (2)
I am seeing the same thing. Traced it to theid
of the created edge still being in the java format:
{'@type': 'janusgraph:RelationIdentifier', '@value': {'value': '20b4-4ha8-glx-2wbk', '@class': 'java.util.HashMap'}}
This is specific to the Janus backend; it is returning a serialized dictionary for the id
property instead of passing back the long
relationId
defined in the edge (https://github.com/JanusGraph/janusgraph/blob/master/janusgraph-core/src/main/java/org/janusgraph/graphdb/relations/RelationIdentifier.java). The way around this is to generate your own function for get_hashable_id
and pass it into the open
method for the goblin
app. For example:
def get_hashable_id(val):
#Use the value "as-is" by default.
result = val
if isinstance(val, dict) and "@type" in val and "@value" in val:
if val["@type"] == "janusgraph:RelationIdentifier":
result = val["@value"]["value"]
return result
Then:
import goblin
import asyncio
loop = asyncio.get_event_loop()
app = loop.run_until_complete(goblin.Goblin.open(loop,
get_hashable_id=get_hashable_id))
S = loop.run_until_complete(app.session())
class A(goblin.Vertex):
name = goblin.Property(goblin.String)
class B(goblin.Vertex):
age = goblin.Property(goblin.Integer)
class C(goblin.Edge):
pass
a = A()
a.name = "Conrad"
b = B()
b.age = 30
c = C(a, b)
S.add(a)
S.add(b)
S.add(c)
loop.run_until_complete(S.flush())
This example code works for me in the latest version.
from goblin.
It works for me too. Thanks for figuring it out!
from goblin.
Related Issues (20)
- Reference instance to test goblin against HOT 3
- How to change version of Goblin OGM Serializer for Janusgraph (TinkerPop 3.2.6) HOT 3
- TypeError: unhashable type: 'dict' when creating an Edge HOT 10
- goblin does not work with aiohttp>=3.0.0 HOT 5
- Question about using a multi-value/set VertexProperty HOT 6
- Vertex property gets changed from Gremlin Console but not from Python/Goblin script HOT 2
- goblin not working with aiohttp (server) HOT 2
- Mocking JanusGraph Connection for unit tests
- Add method to easily remove Vertex HOT 1
- The project appears idle, can I take over? HOT 10
- Problem with Edge data type HOT 5
- App/Cluster configuration using URL HOT 3
- Schema generator HOT 3
- Belated License change HOT 5
- Question: Extent to which OO modeling is supported in Goblin HOT 7
- How to use mixed index in goblin? HOT 4
- AttributeError: AsyncGraphTraversal.last_traverser HOT 1
- [Proposal] - OGM distinct from driver HOT 7
- Ability to set vertex or edge ID HOT 5
- Unexpected results when updating property HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goblin.