lzyxx77 opened a new issue, #2306:
URL: https://github.com/apache/incubator-hugegraph/issues/2306

   ### Problem Type (问题类型)
   
   gremlin (结果不合预期)
   
   ### Before submit
   
   - [X] 我已经确认现有的 [Issues](https://github.com/apache/hugegraph/issues) 与 
[FAQ](https://hugegraph.apache.org/docs/guides/faq/) 中没有相同 / 重复问题 (I have 
confirmed and searched that there are no similar problems in the historical 
issue and documents)
   
   ### Environment (环境信息)
   
   - Server Version: 1.0.0 (Apache Release Version)
   - Backend: RocksDB 1 nodes
   - OS: 4 CPUs, 32 G RAM, Ubuntu 22.04
   - Data Size: 327588 vertices, 1477965 edges <!-- (like 1000W 点, 9000W 边) -->
   
   
   ### Your Question (问题描述)
   
   我准备用gremlin语句实现如下查询:
   
![QQ截图20230906131111](https://github.com/apache/incubator-hugegraph/assets/94185075/1bc2ed46-ab78-4a54-b5fb-15e307419d36)
   
   
   
   ### Vertex/Edge example (问题点 / 边数据举例)
   
   ```javascript
   查询语句如下:
   result = g.V().has("Person","id",$personId)
             .repeat(both("Person_knows_Person"))
             .emit().times(1)
             .as("FriendNode")
             .in("Post_hasCreator_Person").limit(2).as("PostNode")
             .in("Forum_containerOf_Post").as("ForumNode")
             .project('forumInfo','postId')
                       .by(select('ForumNode').valueMap('id','title'))
                       .by(select('PostNode').values('id'))
                       .groupCount().by(select("forumInfo"))
                       .unfold()
                       .project("forum.id","forum.title","postCount")
                       .by(select(keys).select("id").unfold())
                       .by(select(keys).select("title").unfold())
                       .by(values)
                       .as("result")
                       .select("result")
                       .select("forum.title","postCount")
                       .limit(1)
   result
   但是结果返回:
   groovy.lang.MissingPropertyException: No such property: values for class: 
Script504
        at 
org.apache.hugegraph.exception.ServerException.fromResponse(ServerException.java:45)
        at 
org.apache.hugegraph.client.RestClient.checkStatus(RestClient.java:91)
        at 
org.apache.hugegraph.rest.AbstractRestClient.post(AbstractRestClient.java:232)
        at 
org.apache.hugegraph.rest.AbstractRestClient.post(AbstractRestClient.java:206)
        at org.apache.hugegraph.api.gremlin.GremlinAPI.post(GremlinAPI.java:39)
        at 
org.apache.hugegraph.driver.GremlinManager.execute(GremlinManager.java:49)
        at 
org.apache.hugegraph.api.gremlin.GremlinRequest$Builder.execute(GremlinRequest.java:54)
        at 
org.apache.snb.impls.workloads.hugegraph.gremlin.operationhandlers.HugegraphListOperationHandler.executeOperation(HugegraphListOperationHandler.java:108)
        at 
org.apache.snb.impls.workloads.hugegraph.gremlin.operationhandlers.HugegraphListOperationHandler.executeOperation(HugegraphListOperationHandler.java:39)
        at 
org.ldbcouncil.snb.driver.validation.ValidationParamsGenerator.doNext(ValidationParamsGenerator.java:101)
        at 
org.ldbcouncil.snb.driver.validation.ValidationParamsGenerator.doNext(ValidationParamsGenerator.java:31)
        at 
org.ldbcouncil.snb.driver.generator.Generator.hasNext(Generator.java:26)
        at 
org.ldbcouncil.snb.driver.validation.ValidationParamsToCsvRows.hasNext(ValidationParamsToCsvRows.java:36)
        at 
org.ldbcouncil.snb.driver.client.CreateValidationParamsMode.startExecutionAndAwaitCompletion(CreateValidationParamsMode.java:163)
        at org.ldbcouncil.snb.driver.Client.main(Client.java:65)
   Caused by: [groovy.lang.MissingPropertyException]
   ```
   
   
   ### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
   
   ```javascript
   schema结构:
   schema.propertyKey("creationDate").asLong().ifNotExist().create();
   schema.propertyKey("id").asLong().ifNotExist().create();
   schema.propertyKey("locationIP").asText().ifNotExist().create();
   schema.propertyKey("browserUsed").asText().ifNotExist().create();
   schema.propertyKey("content").asText().ifNotExist().create();
   schema.propertyKey("length").asInt().ifNotExist().create();
   //schema.propertyKey("CreatorPersonId").asLong().ifNotExist().create();
   //schema.propertyKey("LocationCountryId").asLong().ifNotExist().create();
   //schema.propertyKey("ParentPostId").asLong().ifNotExist().create();
   //schema.propertyKey("ParentCommentId").asLong().ifNotExist().create();
   // Forum
   schema.propertyKey("title").asText().ifNotExist().create();
   //schema.propertyKey("ModeratorPersonId").asLong().ifNotExist().create();
   // Person
   schema.propertyKey("firstName").asText().ifNotExist().create();
   schema.propertyKey("lastName").asText().ifNotExist().create();
   schema.propertyKey("gender").asText().ifNotExist().create();
   schema.propertyKey("birthday").asLong().ifNotExist().create();
   schema.propertyKey("language").asText().ifNotExist().create();
   schema.propertyKey("LocationCityId").asLong().ifNotExist().create();
   schema.propertyKey("email").asText().ifNotExist().create();
   schema.propertyKey("classYear").asInt().ifNotExist().create();
   schema.propertyKey("workFrom").asInt().ifNotExist().create();
   // Post
   schema.propertyKey("imageFile").asText().ifNotExist().create();
   //schema.propertyKey("ContainerForumId").asLong().ifNotExist().create();
   //Organisation
   schema.propertyKey("type").asText().ifNotExist().create();
   schema.propertyKey("name").asText().ifNotExist().create();
   schema.propertyKey("url").asText().ifNotExist().create();
   //Place
   //schema.propertyKey("PartOfPlaceId").asInt().ifNotExist().create();
   //Tag
   //schema.propertyKey("TypeTagClassId").asInt().ifNotExist().create();
   //TagClass
   //schema.propertyKey("SubclassOfTagClassId").asInt().ifNotExist().create();
   //edge_properties
   schema.propertyKey("joinDate").asLong().ifNotExist().create();
   schema.propertyKey("classYear").asInt().ifNotExist().create();
   schema.propertyKey("workFrom").asInt().ifNotExist().create();
   
   
   
   // vertex
   
   schema.vertexLabel("Comment")
           .properties("id", "creationDate", "locationIP", "browserUsed", 
"content", "length")
           .nullableKeys("creationDate", "locationIP", "browserUsed", 
"content", "length")
           .primaryKeys("id")
           .ifNotExist()
           .create();
   
   schema.vertexLabel("Forum")
           .properties("id", "title", "creationDate")
           .nullableKeys("title", "creationDate")
           .primaryKeys("id")
           .ifNotExist()
           .create();
   
   schema.vertexLabel("Person")
           .properties("id", "firstName", "lastName", "gender", "birthday", 
"creationDate", "locationIP",
                   "browserUsed", "language", "email")
           .nullableKeys("firstName", "lastName", "gender", "birthday", 
"creationDate", "locationIP",
                   "browserUsed", "language", "email")
           .primaryKeys("id")
           .ifNotExist()
           .create();
   
   schema.vertexLabel("Post")
           .properties("id", "imageFile", "creationDate", "locationIP", 
"browserUsed", "language", "content", "length")
           .nullableKeys("imageFile", "creationDate", "locationIP", 
"browserUsed", "language", "content", "length")
           .primaryKeys("id")
           .ifNotExist()
           .create();
   
   schema.vertexLabel("Organisation")
           .properties("id", "type", "name", "url")
           .nullableKeys("type", "name", "url")
           .primaryKeys("id")
           .ifNotExist()
           .create();
   
   schema.vertexLabel("Place")
           .properties("id", "name", "url", "type")
           .nullableKeys("name", "url", "type")
           .primaryKeys("id")
           .ifNotExist()
           .create();
   
   schema.vertexLabel("Tag")
           .properties("id", "name", "url")
           .nullableKeys("name", "url")
           .primaryKeys("id")
           .ifNotExist()
           .create();
   
   schema.vertexLabel("TagClass")
           .properties("id", "name", "url")
           .nullableKeys( "name", "url")
           .primaryKeys("id")
           .ifNotExist()
           .create();
   
   // edge
   schema.edgeLabel("Comment_hasCreator_Person")
           .sourceLabel("Comment")
           .targetLabel("Tag")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Comment_hasTag_Tag")
           .sourceLabel("Comment")
           .targetLabel("Tag")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Comment_isLocatedIn_Country")
           .sourceLabel("Comment")
           .targetLabel("Place")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Comment_replyOf_Comment")
           .sourceLabel("Comment")
           .targetLabel("Comment")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Comment_replyOf_Post")
           .sourceLabel("Comment")
           .targetLabel("Post")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Forum_containerOf_Post")
           .sourceLabel("Forum")
           .targetLabel("Post")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Forum_hasMember_Person")
           .sourceLabel("Forum")
           .targetLabel("Person")
           .properties("joinDate")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Forum_hasModerator_Person")
           .sourceLabel("Forum")
           .targetLabel("Person")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Forum_hasTag_Tag")
           .sourceLabel("Forum")
           .targetLabel("Tag")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Person_hasInterest_Tag")
           .sourceLabel("Person")
           .targetLabel("Tag")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Person_isLocatedIn_City")
           .sourceLabel("Person")
           .targetLabel("Place")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Person_knows_Person")
           .sourceLabel("Person")
           .targetLabel("Person")
           .properties("creationDate")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Person_likes_Comment")
           .sourceLabel("Person")
           .targetLabel("Comment")
           .properties("creationDate")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Person_likes_Post")
           .sourceLabel("Person")
           .targetLabel("Post")
           .properties("creationDate")
           .ifNotExist()
           .create();
   
   
   schema.edgeLabel("Person_studyAt_University")
           .sourceLabel("Person")
           .targetLabel("Organisation")
           .properties("classYear")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Person_workAt_Company")
           .sourceLabel("Person")
           .targetLabel("Organisation")
           .properties("workFrom")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Post_hasCreator_Person")
           .sourceLabel("Post")
           .targetLabel("Person")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Post_hasTag_Tag")
           .sourceLabel("Post")
           .targetLabel("Tag")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Post_isLocatedIn_Country")
           .sourceLabel("Post")
           .targetLabel("Place")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Company_isLocatedIn_Country")
           .sourceLabel("Organisation")
           .targetLabel("Place")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("City_isPartOf_Country")
           .sourceLabel("Place")
           .targetLabel("Place")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("Tag_hasType_TagClass")
           .sourceLabel("Tag")
           .targetLabel("TagClass")
           .ifNotExist()
           .create();
   
   schema.edgeLabel("TagClass_isSubclassOf_TagClass")
           .sourceLabel("TagClass")
           .targetLabel("TagClass")
           .ifNotExist()
           .create();
   ```
   


-- 
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]

Reply via email to