This is an automated email from the ASF dual-hosted git repository. jin pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-ai.git
The following commit(s) were added to refs/heads/main by this push: new a972b56 fix(clien): fix documentation sample code error (#219) a972b56 is described below commit a972b5614769fb51852c94691a70f358468a060b Author: John <thesp...@qq.com> AuthorDate: Tue May 6 11:28:54 2025 +0800 fix(clien): fix documentation sample code error (#219) Id of vertex in sample code in README is hardcoding, but which should be get by `id` field. --- hugegraph-python-client/README.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/hugegraph-python-client/README.md b/hugegraph-python-client/README.md index 31d8df7..d282016 100644 --- a/hugegraph-python-client/README.md +++ b/hugegraph-python-client/README.md @@ -6,6 +6,8 @@ It is used to define graph structures, perform CRUD operations on graph data, ma ## Installation +### Install released package(Stable) + To install the `hugegraph-python-client`, you can use pip/poetry/source building: ```bash @@ -18,7 +20,7 @@ To install from the source, clone the repository and install the required depend ```bash git clone https://github.com/apache/incubator-hugegraph-ai.git -cd path/to/hugegraph-python-client +cd incubator-hugegraph-ai/hugegraph-python-client # Normal install pip install . @@ -60,18 +62,18 @@ 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 +v_al_pacino = g.addVertex("Person", {"name": "Al Pacino", "birthDate": "1940-04-25"}) +v_robert = g.addVertex("Person", {"name": "Robert De Niro", "birthDate": "1943-08-17"}) +v_godfather = g.addVertex("Movie", {"name": "The Godfather"}) +v_godfather2 = g.addVertex("Movie", {"name": "The Godfather Part II"}) +v_godfather3 = g.addVertex("Movie", {"name": "The Godfather Coda The Death of Michael Corleone"}) + +g.addEdge("ActedIn", v_al_pacino.id, v_godfather.id, {}) +g.addEdge("ActedIn", v_al_pacino.id, v_godfather2.id, {}) +g.addEdge("ActedIn", v_al_pacino.id, v_godfather3.id, {}) +g.addEdge("ActedIn", v_robert.id, v_godfather2.id, {}) + +res = g.getVertexById(v_al_pacino.id).label print(res) g.close() ```