dosubot[bot] commented on issue #2410:
URL: 
https://github.com/apache/incubator-hugegraph/issues/2410#issuecomment-1907077657

   _🤖_
   <!-- Answer -->
   I apologize for the confusion, you're correct. Currently, the `name` of each 
EdgeLabel should be unique in the incubator-hugegraph repository. This means 
that you can't create duplicate EdgeLabels with the same name for different 
VertexLabels. 
   
   This is evident from the constructor of the EdgeLabel class:
   
   ```java
   public EdgeLabel(final HugeGraph graph, Id id, String name) {
       super(graph, id, name);
       this.frequency = Frequency.DEFAULT;
       this.sortKeys = new ArrayList<>();
   }
   ```
   Here, `name` is passed as a parameter to the constructor and is passed to 
the superclass constructor (`super(graph, id, name);`), where it is likely 
stored as an attribute of the EdgeLabel. The `name` attribute of each EdgeLabel 
is used to identify the edge label. It is a unique identifier for each edge 
label in the graph database. This attribute is set when an EdgeLabel object is 
created and it cannot be changed afterwards.
   
   Also, in the test case `testRemoveEdgeLabel`, an EdgeLabel named "look" is 
created and then removed. After removal, when trying to get the EdgeLabel 
"look" again, a `NotFoundException` is thrown, indicating that the EdgeLabel no 
longer exists. If the system allowed EdgeLabels with the same `name` attribute, 
this exception would not be thrown as another EdgeLabel with the same name 
could exist. 
   
   Here is the relevant code snippet:
   
   ```java
   @Test
   public void testRemoveEdgeLabel() {
       super.initPropertyKeys();
       SchemaManager schema = graph().schema();
   
       schema.vertexLabel("person")
             .properties("name", "age", "city")
             .primaryKeys("name")
             .create();
   
       schema.vertexLabel("book")
             .properties("name", "contribution")
             .primaryKeys("name")
             .create();
   
       schema.edgeLabel("look").link("person", "book")
             .properties("time", "city")
             .create();
   
       Assert.assertNotNull(schema.getEdgeLabel("look"));
   
       schema.edgeLabel("look").remove();
   
       Assert.assertThrows(NotFoundException.class, () -> {
           schema.getEdgeLabel("look");
       });
   }
   ```
   In this test case, an EdgeLabel named "look" is created, confirmed to exist, 
and then removed. After removal, an attempt to get the EdgeLabel "look" results 
in a `NotFoundException`, indicating that no EdgeLabel with the name "look" 
exists. This suggests that EdgeLabels must have unique names.
   
   I hope this clarifies the issue. If you have any further questions, feel 
free to ask.
   
   Sources:
   - 
[hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/EdgeLabel.java](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/EdgeLabel.java)
   - 
[hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeLabelCoreTest.java](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeLabelCoreTest.java)
   
   ## Sources
   - 
[hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeLabelCoreTest.java](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeLabelCoreTest.java)
   - 
[hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/EdgeLabel.java](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/EdgeLabel.java)
   
   ---
   
   This response is meant to be useful and save you time. It is **not meant to 
be a precise solution**, but rather a starting point for your own research.
   
   Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is 
irrelevant.
   
   If you want to continue the conversation, start your reply with @dosu-bot.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to