I want to have a Java class to bind to this relationship:
Vertex - Relationship - Vertex (a:Clause)-[r:HasClause]-(b:Clause)
The problem is that the edge of class "HasClause" should have a property called "alias" on the same class - I don't know how I should annotate the class to do that automatically:
@JsonDeserialize(as = Clause.class)
public interface IClause extends VertexFrame {
@Property("nodeClass")
public String getNodeClass();
@Property("nodeClass")
public void setNodeClass(String str);
/* that would be a property on the Vertex not on the Edge
@Property("alias")
public void setAlias(String id);
@Property("alias")
public String getAlias();
*/
@Adjacency(label = "HasClause", direction = Direction.OUT)
public Iterable<IClause> getClauses();
@Adjacency(label = "HasClause", direction = Direction.OUT)
public void setClauses(Iterable<IClause> clauses);
}
Thanks
I don't know if there's a way you can do this using the
@Adjacency
annotation (I can't see any way).One way you could do this, is by using a
@JavaHandlerClass
. This basically allows you to customise the implementation of your Frame's methods. In the following example, we'll join twoVertex
's, and add a custom property 'alias' to theEdge
.Just to make things easier, I'll use the same classes from your other question - Why simple set and then get on Dynamic Proxy does not persist? (using TinkerPop Frames JavaHandler)
IVert
Vert
Main method (Groovy)