Fabian Gärtner created TINKERPOP-2087:
-----------------------------------------

             Summary: It is not possible to add more then one edge property at 
the same time
                 Key: TINKERPOP-2087
                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2087
             Project: TinkerPop
          Issue Type: Bug
          Components: process
    Affects Versions: 3.3.4
         Environment: Java with maven
            Reporter: Fabian Gärtner


In java doing a property step on a edge with more then one key-value pair 
creates an error

Minimal error example:
{code:java}
public static void main( String[] args ) throws Exception {
    TinkerGraph g = TinkerGraph.open();
    g.traversal().addV("v").as("a")
            .addV("v").addE("e").to("a")
            .property("key","val", "key2","val2")
            .iterate();
}
{code}
The resulting error is
{code:java}
org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerEdge cannot be cast to 
org.apache.tinkerpop.gremlin.structure.Vertex
{code}
 

In 
org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AddPropertyStep 
in line 122 and 124 the element where the property should be added is casted in 
a Vertex.

It looks like that the reason for this ist that the functionality to add more 
than one property in one step is given in the interface 
org.apache.tinkerpop.gremlin.structure.Vertex. It would be more consistent if 
this functionality is given in the interface 
org.apache.tinkerpop.gremlin.structure.Element.

 

A simple workaround is to do two property steps:
{code:java}
public static void main( String[] args ) throws Exception {
    TinkerGraph g = TinkerGraph.open();
    g.traversal().addV("v").as("a")
            .addV("v").addE("e").to("a")
            .property("key","val")
            .property("key2","val2")
            .iterate();
}{code}
 However, at least a more meaningful error message is needed to prevent 
confusion.

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to