Re: Edge propert doesn't support SET cardinality ?


Suny <sahithiy...@...>
 

Hi,

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

Thanks


On Wednesday, September 13, 2017 at 4:35:44 AM UTC-4, Robert Dale wrote:
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.


On Wed, Sep 13, 2017 at 04:02 Ankur Goel <an...@...> wrote:
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


--
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

Join janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.