Unable to load GraphSON file

Hi, I'm trying to load a very simple .json graph into JanusGraph from the gremlin console, but I get this error:
gremlin> g.io("/opt/janusgraph/graphson-test1.json").read().iterate();
Label can not be null
gremlin> g.io("/opt/janusgraph/graphson-test1.json").read().iterate();
Label can not be null
although the label is indeed present:
{"vertices":[{"id":"id_test","label":"person","name":"Jack"}],"edges":[]}
{"vertices":[{"id":"id_test","label":"person","name":"Jack"}],"edges":[]}
any idas why? Additional info: I'm using JanusGraph 1.0.0 that is setup to accept custom vertext IDs. All works well, but I'm unable to do bulk loads from .json. Thanks!
5 Replies
Florian Hockmann
Can you please show how you created this JSON document?
rpuga
rpugaOP7mo ago
Basically, I used the G.V() IDE -- @gdotv -- to create a single node in a graph and then exported it to JSON format. Then, I'm trying to import that single node graph into JanusGraph. To my understanding, the JSON format exported by G.V() follows the GraphSON version 1.0 documented here: https://tinkerpop.apache.org/docs/3.7.2/dev/io/#graphson so, I thought that importing it should also work. Here is similar example, taken from the TinkerPop documentation (I copied only the first node from the TinkerGraph GraphSON example and reformatted it to properly close parenthesis, etc.):
{"vertices":[{"id":1,"label":"person","type":"vertex","properties":{"name":[{"id":0,"value":"marko"}]}}]}
{"vertices":[{"id":1,"label":"person","type":"vertex","properties":{"name":[{"id":0,"value":"marko"}]}}]}
I get the same Label can not be null when trying to load this in a G.V() playground as well. So it seems this is not an issue that is unique to JanusGraph. Maybe this is because GraphSON version 1.0 is not supported anymore? Or maybe there is a way to specify that the GraphSON format to use when loading the grpah is v1.0?
gdotv
gdotv7mo ago
I think i see the problem, there's a slight confusion between JSON and GraphSON here - the JSON export from "Export Graph Results" in G.V() is JSON, not GraphSON. I'd recommend trying the GraphML export from G.V() instead, that'll be importable to JG via the IO step (taking this point on board also as I can see how this would look like GraphSON in context)
rpuga
rpugaOP7mo ago
Ah, got it. Given the similarity between the exported JSON and GraphSON v1.0 I though they were the same. Thanks for the clarification, @gdotv. Interestingly, the example GraphSON v1.0 from the TinkerPop documentation also does not work, though I did not think it was deprecated (maybe it's mentioned somewhere in the docs and I missed it...)
Florian Hockmann
Are you getting the same error message for the example from the TinkerPop docs or a different one? Also did you create a schema up-front or load any other data?
Want results from more Discord servers?
Add your server