This is an automated email from the ASF dual-hosted git repository.

yangjiaqi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git


The following commit(s) were added to refs/heads/master by this push:
     new 7b16f4c0f fix(server): serialize source and target label for 
non-father edge label (#2682)
7b16f4c0f is described below

commit 7b16f4c0f4bf6892881656c48ba0cc13b83c563e
Author: V_Galaxy <[email protected]>
AuthorDate: Thu Oct 24 23:30:41 2024 +0800

    fix(server): serialize source and target label for non-father edge label 
(#2682)
    
    * fix up and  UT
---
 .../src/main/java/org/apache/hugegraph/io/GraphSONSchemaSerializer.java | 2 ++
 .../src/main/java/org/apache/hugegraph/unit/util/JsonUtilTest.java      | 2 ++
 2 files changed, 4 insertions(+)

diff --git 
a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/GraphSONSchemaSerializer.java
 
b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/GraphSONSchemaSerializer.java
index 31d197c09..db8d874e8 100644
--- 
a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/GraphSONSchemaSerializer.java
+++ 
b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/io/GraphSONSchemaSerializer.java
@@ -83,6 +83,8 @@ public class GraphSONSchemaSerializer {
         }
 
         if (!edgeLabel.isFather()) {
+            map.put(HugeKeys.SOURCE_LABEL, edgeLabel.sourceLabelName());
+            map.put(HugeKeys.TARGET_LABEL, edgeLabel.targetLabelName());
             map.put(HugeKeys.LINKS,
                     graph.mapPairId2Name(edgeLabel.links()));
             map.put(HugeKeys.FREQUENCY, edgeLabel.frequency());
diff --git 
a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/JsonUtilTest.java
 
b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/JsonUtilTest.java
index 6c5159d37..c76d536ff 100644
--- 
a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/JsonUtilTest.java
+++ 
b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/util/JsonUtilTest.java
@@ -177,6 +177,8 @@ public class JsonUtilTest extends BaseUnitTest {
         String json = JsonUtil.toJson(el);
         Assert.assertEquals("{\"id\":1,\"name\":\"knows\"," +
                             "\"edgelabel_type\":\"NORMAL\"," +
+                            "\"source_label\":\"person\"," +
+                            "\"target_label\":\"person\"," +
                             "\"links\":[{\"name\":\"name\"}]," +
                             "\"frequency\":\"SINGLE\",\"sort_keys\":[]," +
                             "\"nullable_keys\":[],\"index_labels\":[]," +

Reply via email to