Date
1 - 5 of 5
Confused about GraphSON edges definition
Laura Morales <lauretas@...>
I'm looking at this example from TinkerPop https://tinkerpop.apache.org/docs/current/dev/io/#graphson
{"id":{"@type":"g:Int32","@value":1},"label":"person","outE":{"created":[{"id":{"@type":"g:Int32","@value":9},"inV":{"@type":"g:Int32","@value":3},"properties":{"weight":{"@type":"g:Double","@value":0.4}}}],"knows":[{"id":{"@type":"g:Int32","@value":7},"inV":{"@type":"g:Int32","@value":2},"properties":{"weight":{"@type":"g:Double","@value":0.5}}},{"id":{"@type":"g:Int32","@value":8},"inV":{"@type":"g:Int32","@value":4},"properties":{"weight":{"@type":"g:Double","@value":1.0}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":0},"value":"marko"}],"age":[{"id":{"@type":"g:Int64","@value":1},"value":{"@type":"g:Int32","@value":29}}]}} {"id":{"@type":"g:Int32","@value":2},"label":"person","inE":{"knows":[{"id":{"@type":"g:Int32","@value":7},"outV":{"@type":"g:Int32","@value":1},"properties":{"weight":{"@type":"g:Double","@value":0.5}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":2},"value":"vadas"}],"age":[{"id":{"@type":"g:Int64","@value":3},"value":{"@type":"g:Int32","@value":27}}]}} {"id":{"@type":"g:Int32","@value":3},"label":"software","inE":{"created":[{"id":{"@type":"g:Int32","@value":9},"outV":{"@type":"g:Int32","@value":1},"properties":{"weight":{"@type":"g:Double","@value":0.4}}},{"id":{"@type":"g:Int32","@value":11},"outV":{"@type":"g:Int32","@value":4},"properties":{"weight":{"@type":"g:Double","@value":0.4}}},{"id":{"@type":"g:Int32","@value":12},"outV":{"@type":"g:Int32","@value":6},"properties":{"weight":{"@type":"g:Double","@value":0.2}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":4},"value":"lop"}],"lang":[{"id":{"@type":"g:Int64","@value":5},"value":"java"}]}} {"id":{"@type":"g:Int32","@value":4},"label":"person","inE":{"knows":[{"id":{"@type":"g:Int32","@value":8},"outV":{"@type":"g:Int32","@value":1},"properties":{"weight":{"@type":"g:Double","@value":1.0}}}]},"outE":{"created":[{"id":{"@type":"g:Int32","@value":10},"inV":{"@type":"g:Int32","@value":5},"properties":{"weight":{"@type":"g:Double","@value":1.0}}},{"id":{"@type":"g:Int32","@value":11},"inV":{"@type":"g:Int32","@value":3},"properties":{"weight":{"@type":"g:Double","@value":0.4}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":6},"value":"josh"}],"age":[{"id":{"@type":"g:Int64","@value":7},"value":{"@type":"g:Int32","@value":32}}]}} {"id":{"@type":"g:Int32","@value":5},"label":"software","inE":{"created":[{"id":{"@type":"g:Int32","@value":10},"outV":{"@type":"g:Int32","@value":4},"properties":{"weight":{"@type":"g:Double","@value":1.0}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":8},"value":"ripple"}],"lang":[{"id":{"@type":"g:Int64","@value":9},"value":"java"}]}} {"id":{"@type":"g:Int32","@value":6},"label":"person","outE":{"created":[{"id":{"@type":"g:Int32","@value":12},"inV":{"@type":"g:Int32","@value":3},"properties":{"weight":{"@type":"g:Double","@value":0.2}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":10},"value":"peter"}],"age":[{"id":{"@type":"g:Int64","@value":11},"value":{"@type":"g:Int32","@value":35}}]}} I don't understand two things, can anyone help me understand them? - why do I need an "outE" *and* "inE" definition for the same edge? Why can't I just define one or the other? If I define both, the edge is created when importing the file, otherwise if I only use "outE" the edge is not created - why is everything given an id? Including edges and properties (for example "properties":{"name":[{"id":{"@type":"g:Int64","@value":0},"value":"marko"}). Removing all the "id" except for nodes IDs seems to work fine |
|
hadoopmarc@...
Hi Laura,
If you want to know, you would better ask on the TinkerPop users list. Note that graphSON is not designed as a human-readable or standardized interchange format, but rather as interchange format between TinkerPop-compatible processes. If you want to create or modify a graphSON file, it is easier to instantiate a TinkerGraph and use the TinkerPop API. Best wishes, Marc |
|
Laura Morales <lauretas@...>
Hi,
I've asked my question over there (here's the thread https://groups.google.com/g/gremlin-users/c/_H3UZyfdvtE) and the possible solution seems to be to use readVertices() instead of read() or readGraph(). But I'm very confused and I'd really appreciate if you guys could help me make sense of it. I haven't used Gremlin, Groovy, and Janus before, so I'm basically relying on the Janus documentation but I cannot find any examples for this. How can I load a GraphSON file using readVertices()? Sent: Thursday, September 02, 2021 at 8:07 AM From: hadoopmarc@... To: janusgraph-users@... Subject: Re: [janusgraph-users] Confused about GraphSON edges definition Hi Laura, If you want to know, you would better ask on the TinkerPop users list. Note that graphSON is not designed as a human-readable or standardized interchange format, but rather as interchange format between TinkerPop-compatible processes. If you want to create or modify a graphSON file, it is easier to instantiate a TinkerGraph and use the TinkerPop API. Best wishes, Marc |
|
hadoopmarc@...
Hi Laura,
https://tinkerpop.apache.org/javadocs/current/full/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.html People do not want to put effort in explaining graphSON because that is not the way to go. As said above, you can just use a TinkerGraph with addV, eddEdge and property() and export the graph to graphSON. Best wishes, Marc |
|
Laura Morales <lauretas@...>
People do not want to put effort in explaining graphSON because that is not the way to goMay I ask why it is not the way to go, and what is the way instead? I thought my problem was fairly easy: have a graph in a file, load the file. But GraphML is lossy, and GraphSON is not the way to go. What is left other than having to write my own groovy scripts and using the tinkerpop api? |
|