Edge propert doesn't support SET cardinality ?

1,016 views
Skip to first unread message

Ankur Goel

unread,
Sep 13, 2017, 4:02:57 AM9/13/17
to JanusGraph users
Hi,

I am using embedded (cassandra + ES) janusgraph instance. and using below code to create vertex and edge:

                ManagementSystem mgmt = (ManagementSystem) graph.openManagement();

PropertyKey nameProperty = mgmt.makePropertyKey("names").dataType(String.class).cardinality(Cardinality.SET).make();

PropertyKey yoyoProperty = mgmt.makePropertyKey("yoyo").dataType(String.class).cardinality(Cardinality.SET).make();

mgmt.buildIndex("searchName", Vertex.class).addKey(nameProperty, Mapping.STRING.asParameter()).buildMixedIndex("search");

mgmt.buildIndex("searchYoyo", Vertex.class).addKey(yoyoProperty, Mapping.STRING.asParameter()).buildMixedIndex("search");

EdgeLabel directEdgeLabel = mgmt.makeEdgeLabel("edgeL").make();

mgmt.commit();

// Insert a vertex

Vertex person1 = graph.addVertex();

person1.property("names", "p1");

person1.property("names", "p2");

Vertex person2 = graph.addVertex();

person2.property("names", "p5");

person2.property("names", "p6");

Edge edge = person1.addEdge("edgeL", person2);

edge.property("yoyo", "wow");

edge.property("yoyo", "hello");

graph.tx().commit();



Gremlin Output:


gremlin> g.E().valueMap()

==>{yoyo=hello}

gremlin> g.V().valueMap()

==>{names=[p1, p2]}

==>{names=[p5, p6]}


Looks edge property is not supporting SET cardinality.


Please suggest.


~AnkurG


Robert Dale

unread,
Sep 13, 2017, 4:35:44 AM9/13/17
to Ankur Goel, JanusGraph users
That is correct.  This is because TinkerPop only supports Property (key/value) on edges.  Vertexes have VertexProperty - http://tinkerpop.apache.org/docs/current/reference/#vertex-properties


Note, that property keys used on edges and properties have cardinality SINGLE. Attaching multiple values for a single key on an edge or property is not supported.

You could create multiple edges instead.


--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/99ad8c01-a936-417c-a0e8-17304dba7d0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Robert Dale

Suny

unread,
Oct 5, 2017, 3:51:44 PM10/5/17
to JanusGraph users
Hi,

Is there a specific reason why it is not implemented on edges ?

Thanks

Ankur Goel

unread,
Oct 6, 2017, 6:22:27 AM10/6/17
to JanusGraph users
Yes this feature is required, in absence it leads to multiple edge creation for  a multi value property.

~

Robert Dale

unread,
Oct 6, 2017, 8:27:26 AM10/6/17
to JanusGraph users

You can start by creating a feature request with TinkerPop - http://tinkerpop.apache.org/

tschu...@gmail.com

unread,
Oct 12, 2017, 2:57:29 PM10/12/17
to JanusGraph users
Not sure if this is the best approach, but in the past, I've concatenated values for some edge properties with ";" and then break the string up at query time.

Tim


On Friday, October 6, 2017 at 6:22:27 AM UTC-4, Ankur Goel wrote:

Suny

unread,
Oct 12, 2017, 2:59:50 PM10/12/17
to JanusGraph users
This is the approach i am using too. But i am bit worried about how long the string can be ?

inft...@gmail.com

unread,
Nov 12, 2018, 12:06:55 PM11/12/18
to JanusGraph users

In the docs, the edge property "place" for the Graph of Gods appears to be a list? Where is my understanding going wrong?

gog_edge_list.png



On Wednesday, September 13, 2017 at 4:35:44 AM UTC-4, Robert Dale wrote:

inft...@gmail.com

unread,
Nov 12, 2018, 12:20:00 PM11/12/18
to JanusGraph users
Never mind, it's not a list but rather a Geoshape final PropertyKey place = management.makePropertyKey("place").dataType(Geoshape.class).make();

Apologies for the noise.

Kushal Agrawal

unread,
Nov 18, 2019, 10:51:44 AM11/18/19
to JanusGraph users
Hi,
I understand that this feature is not supported, but can someone explain to me the philosophy behind the decision of allowing only SINGLE cardinality for edge properties?

Florian Hockmann

unread,
Nov 20, 2019, 4:58:21 AM11/20/19
to JanusGraph users
JanusGraph implements the TinkerPop data model and you already got an answer to your question from Stephen Mallette for TinkerPop in the gremlin-users group.

sweaty...@gmail.com

unread,
Nov 20, 2019, 5:04:54 AM11/20/19
to JanusGraph users
Indeed, I did. There was a new post moderation phase I wasn't aware of, and so I didn't understand why my post was not showing up there at the time of my posting here.
Reply all
Reply to author
Forward
0 new messages