humblemat810 opened a new issue, #218:
URL: https://github.com/apache/incubator-hugegraph-ai/issues/218

   ### Bug Type (问题类型)
   
   others (please comment below)
   
   ### Before submit
   
   - [x] I had searched in the 
[issues](https://github.com/apache/incubator-hugegraph-ai/issues) and found no 
similar issues.
   
   ### Environment (环境信息)
   
    
   Such beginner overwhelming/frustrating experience will definitely drive 
interested parties away from the project. Especially the readme is the first 
impression of a user/developer to an open source project.
   
   - Server Version: 42f9a7638ba0d3d75744c69690938c4ca1074e56
   - hugegraph-python version  1.5.0
   
   the ID of newly inserted vertex is hardcoded
   
   when g.addVertex("Person", {"name": "Al Pacino", "birthDate": "1940-04-25"}) 
returns a vertex data object in which the id can be used to add edge instead of 
hardcoding the id here: g.addEdge("ActedIn", "12:Al Pacino", "13:The 
Godfather", {})
   
   it should be
   ```v_al_pacino = g.addVertex("Person", {"name": "Al Pacino", "birthDate": 
"1940-04-25"})
   v_godfather_ = g.addVertex("Movie", {"name": "The Godfather"})
   g.addEdge("ActedIn", vertex_al_pacino.id, v_godfather.id, {})
   ```
   
   hardcoded version from readme.md
   ```
   from pyhugegraph.client import PyHugeClient
   
   # Initialize the client
   # For HugeGraph API version ≥ v3: (Or enable graphspace function)  
   # - The 'graphspace' parameter becomes relevant if graphspaces are 
enabled.(default name is 'DEFAULT')
   # - Otherwise, the graphspace parameter is optional and can be ignored. 
   client = PyHugeClient("127.0.0.1", "8080", user="admin", pwd="admin", 
graph="hugegraph", graphspace="DEFAULT")
   
   """"
   Note:
   Could refer to the official REST-API doc of your HugeGraph version for 
accurate details.
   If some API is not as expected, please submit a issue or contact us.
   """
   schema = client.schema()
   schema.propertyKey("name").asText().ifNotExist().create()
   schema.propertyKey("birthDate").asText().ifNotExist().create()
   schema.vertexLabel("Person").properties("name", 
"birthDate").usePrimaryKeyId().primaryKeys("name").ifNotExist().create()
   
schema.vertexLabel("Movie").properties("name").usePrimaryKeyId().primaryKeys("name").ifNotExist().create()
   
schema.edgeLabel("ActedIn").sourceLabel("Person").targetLabel("Movie").ifNotExist().create()
   
   print(schema.getVertexLabels())
   print(schema.getEdgeLabels())
   print(schema.getRelations())
   
   # Init Graph
   g = client.graph()
   g.addVertex("Person", {"name": "Al Pacino", "birthDate": "1940-04-25"})
   g.addVertex("Person", {"name": "Robert De Niro", "birthDate": "1943-08-17"})
   g.addVertex("Movie", {"name": "The Godfather"})
   g.addVertex("Movie", {"name": "The Godfather Part II"})
   g.addVertex("Movie", {"name": "The Godfather Coda The Death of Michael 
Corleone"})
   
   g.addEdge("ActedIn", "12:Al Pacino", "13:The Godfather", {})
   g.addEdge("ActedIn", "12:Al Pacino", "13:The Godfather Part II", {})
   g.addEdge("ActedIn", "12:Al Pacino", "13:The Godfather Coda The Death of 
Michael Corleone", {})
   g.addEdge("ActedIn", "12:Robert De Niro", "13:The Godfather Part II", {})
   
   res = g.getVertexById("12:Al Pacino").label
   print(res)
   g.close()
   ```
   
   ### Expected & Actual behavior (期望与实际表现)
   
   sample working code below:
   
   ```python
   g = client.graph()
   v1 = g.addVertex("Person", {"name": "Al Pacino", "birthDate": "1940-04-25"})
   v2 = g.addVertex("Person", {"name": "Robert De Niro", "birthDate": 
"1943-08-17"})
   v3 = g.addVertex("Movie", {"name": "The Godfather"})
   v4 = g.addVertex("Movie", {"name": "The Godfather Part II"})
   v5 = g.addVertex("Movie", {"name": "The Godfather Coda The Death of Michael 
Corleone"})
   
   g.addEdge("ActedIn", v1.id, v3.id, {})
   g.addEdge("ActedIn", v1.id, v4.id, {})
   g.addEdge("ActedIn", v1.id, v5.id, {})
   g.addEdge("ActedIn", v2.id, v4.id, {})```
   
   ### Vertex/Edge example (问题点 / 边数据举例)
   
   ```javascript
   
   ```
   
   ### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
   
   ```javascript
   
   ```


-- 
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: dev-unsubscr...@hugegraph.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to