Date
1 - 5 of 5
graphml properties of properties
hadoopmarc@...
Hi Laura,
Using TinkerGraph I exported a graph to graphSON in the way shown above. I reloaded it as follows:
Best wishes, Marc
Using TinkerGraph I exported a graph to graphSON in the way shown above. I reloaded it as follows:
gremlin> graph = TinkerGraph.open();So, the metaproperty added s read from graphSON. Do you mean to say that you cannot do the same with JanusGraph? I did not check myself.
==>tinkergraph[vertices:0 edges:0]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
gremlin> g.io('data/metatest.json').read().iterate()
gremlin> g.V().elementMap()
==>[id:1,label:person,name:marko,age:29]
==>[id:2,label:person,name:vadas,age:27]
==>[id:3,label:software,name:lop,lang:java]
==>[id:4,label:person,name:josh,age:32]
==>[id:5,label:software,name:ripple,lang:java]
==>[id:6,label:person,name:peter,age:35]
==>[id:13,label:person,name:turing]
gremlin> g.V(1).properties('name').elementMap()
==>[id:0,key:name,value:marko,metatest:hi]
gremlin>
Best wishes, Marc
Laura Morales <lauretas@...>
FWIW I've tried exporting the graph in the example to JSON (GraphSON) and the metaproperty *is* preserved, however when I import the same graph from the json file the metaproperty is not created.
toggle quoted message
Show quoted text
Sent: Thursday, August 26, 2021 at 6:36 AM
From: "Laura Morales" <lauretas@...>
To: janusgraph-users@...
Cc: janusgraph-users@...
Subject: Re: [janusgraph-users] graphml properties of properties
Thank you for this example.
After running this, I can see that the property "metatest" has been ignored and is missing completely from the GraphML output. Another issue that I have with GraphML is that it cannot apparently represent all the key types that are supported by Janus. For example it does not define any attribute for "date" and "time", and it does not allow to specify "int32" or "int64"; it only defines basic primitives such as string, int, double.
What serialization format should I use to best match Janus? One that allows metaproperties and also all the various types (date, int32, char, etc.). I also need it to be human readable because I'm editing my graph file manually, and then I load this file into Janus. GraphML is not that bad, I can use it... it's just too limited given that it does not support the features mentioned above. Is there any better alternative? Or should I roll my own?
Sent: Wednesday, August 25, 2021 at 5:05 PM
From: hadoopmarc@...
To: janusgraph-users@...
Subject: Re: [janusgraph-users] graphml properties of properties
Hi Laura,
No. As the TinkerPop docs say: "graphML is a lossy format".
You can try for yourself with:gremlin> graph = TinkerFactory.createModern()
==>tinkergraph[vertices:6 edges:6]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V(1).properties('name').elementMap()
==>[id:0,key:name,value:marko]
gremlin> g.V(1).properties('name').property('metatest', 'hi')
==>vp[name->marko]
gremlin> g.V(1).properties('name').elementMap()
==>[id:0,key:name,value:marko,metatest:hi]
gremlin> g.addV('person').property('name', 'turing')
==>v[13]
gremlin> g.io('data/metatest.xml').write().iterate()
gremlin>Best wishes, Marc
Laura Morales <lauretas@...>
Thank you for this example.
After running this, I can see that the property "metatest" has been ignored and is missing completely from the GraphML output. Another issue that I have with GraphML is that it cannot apparently represent all the key types that are supported by Janus. For example it does not define any attribute for "date" and "time", and it does not allow to specify "int32" or "int64"; it only defines basic primitives such as string, int, double.
What serialization format should I use to best match Janus? One that allows metaproperties and also all the various types (date, int32, char, etc.). I also need it to be human readable because I'm editing my graph file manually, and then I load this file into Janus. GraphML is not that bad, I can use it... it's just too limited given that it does not support the features mentioned above. Is there any better alternative? Or should I roll my own?
Sent: Wednesday, August 25, 2021 at 5:05 PM
From: hadoopmarc@...
To: janusgraph-users@...
Subject: Re: [janusgraph-users] graphml properties of properties
Hi Laura,
No. As the TinkerPop docs say: "graphML is a lossy format".
You can try for yourself with:gremlin> graph = TinkerFactory.createModern()
==>tinkergraph[vertices:6 edges:6]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V(1).properties('name').elementMap()
==>[id:0,key:name,value:marko]
gremlin> g.V(1).properties('name').property('metatest', 'hi')
==>vp[name->marko]
gremlin> g.V(1).properties('name').elementMap()
==>[id:0,key:name,value:marko,metatest:hi]
gremlin> g.addV('person').property('name', 'turing')
==>v[13]
gremlin> g.io('data/metatest.xml').write().iterate()
gremlin>Best wishes, Marc
After running this, I can see that the property "metatest" has been ignored and is missing completely from the GraphML output. Another issue that I have with GraphML is that it cannot apparently represent all the key types that are supported by Janus. For example it does not define any attribute for "date" and "time", and it does not allow to specify "int32" or "int64"; it only defines basic primitives such as string, int, double.
What serialization format should I use to best match Janus? One that allows metaproperties and also all the various types (date, int32, char, etc.). I also need it to be human readable because I'm editing my graph file manually, and then I load this file into Janus. GraphML is not that bad, I can use it... it's just too limited given that it does not support the features mentioned above. Is there any better alternative? Or should I roll my own?
Sent: Wednesday, August 25, 2021 at 5:05 PM
From: hadoopmarc@...
To: janusgraph-users@...
Subject: Re: [janusgraph-users] graphml properties of properties
Hi Laura,
No. As the TinkerPop docs say: "graphML is a lossy format".
You can try for yourself with:gremlin> graph = TinkerFactory.createModern()
==>tinkergraph[vertices:6 edges:6]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V(1).properties('name').elementMap()
==>[id:0,key:name,value:marko]
gremlin> g.V(1).properties('name').property('metatest', 'hi')
==>vp[name->marko]
gremlin> g.V(1).properties('name').elementMap()
==>[id:0,key:name,value:marko,metatest:hi]
gremlin> g.addV('person').property('name', 'turing')
==>v[13]
gremlin> g.io('data/metatest.xml').write().iterate()
gremlin>Best wishes, Marc
hadoopmarc@...
Hi Laura,
No. As the TinkerPop docs say: "graphML is a lossy format".
You can try for yourself with:
No. As the TinkerPop docs say: "graphML is a lossy format".
You can try for yourself with:
gremlin> graph = TinkerFactory.createModern()Best wishes, Marc
==>tinkergraph[vertices:6 edges:6]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V(1).properties('name').elementMap()
==>[id:0,key:name,value:marko]
gremlin> g.V(1).properties('name').property('metatest', 'hi')
==>vp[name->marko]
gremlin> g.V(1).properties('name').elementMap()
==>[id:0,key:name,value:marko,metatest:hi]
gremlin> g.addV('person').property('name', 'turing')
==>v[13]
gremlin> g.io('data/metatest.xml').write().iterate()
gremlin>
Laura Morales <lauretas@...>
Janus supports "properties of properties", ie. properties defined on other properties. How is this represented with graphml? Should I use nested elements like this
<node>
<data key="foo">
bar
<data key="xxx">yyy</data>
</data>
</node>
or should I use attributes like this?
<node>
<data key="foo" xxx="yyy">bar</data>
</node>
<node>
<data key="foo">
bar
<data key="xxx">yyy</data>
</data>
</node>
or should I use attributes like this?
<node>
<data key="foo" xxx="yyy">bar</data>
</node>