While creating a new schema I am able to create same edge name for different scenarios (ex: Person-HAS_LOC>- City, Customer-HAS_LOC>City) but once I publish the scheme why is there a restriction for creating a new edge with same existing edge name
@Aravind It should work. What error to you get? Also, I’ve included some examples below. If you look at the Has_Pet edge it’s added to Person->Dog & Person → Bird.
ALTER EDGE .. ADD PAIR
ALTER EDGE ... ADD PAIR
adds one or more edge pairs, which refer to the FROM
and TO
vertex types of an edge type. To add an edge pair, put the vertex type names in parentheses after keywords FROM
and TO
.
Syntax
ALTER EDGE Edge_Type ADD PAIR
"(" FROM Vertex_Type, TO Vertex_Type (| FROM Vertex_Type, TO Vertex_Type)* ")”
Example
In the example below, the first statement in the schema change job will add an edge pair (FROM Person, TO Company
) to the edge type Visit
. The second example adds two edge pairs to the edge type Has_Pet
; the edge type can now connect both Person
and Dog
vertices, as well as Person
and Bird
vertices.
CREATE SCHEMA_CHANGE JOB job_2 FOR GRAPH Example_Graph {
ALTER EDGE Visit ADD PAIR (FROM Person, TO Company);
ALTER EDGE Has_Pet ADD PAIR (FROM Person, TO Dog | FROM Person, TO Bird);
}
Does this example help with your question?