From 4b5e90bb98938455e7ee027cae14e61ecf93c467 Mon Sep 17 00:00:00 2001 From: liuxiao Date: Fri, 2 Jun 2023 22:10:45 +0800 Subject: [PATCH 1/8] docs: update vertex response --- content/cn/docs/clients/restful-api/vertex.md | 383 +++++++----------- content/en/docs/clients/restful-api/vertex.md | 366 ++++++----------- 2 files changed, 286 insertions(+), 463 deletions(-) diff --git a/content/cn/docs/clients/restful-api/vertex.md b/content/cn/docs/clients/restful-api/vertex.md index 0db38d0d2..53eae492d 100644 --- a/content/cn/docs/clients/restful-api/vertex.md +++ b/content/cn/docs/clients/restful-api/vertex.md @@ -23,7 +23,22 @@ weight: 7 ------------------------------------------------------------------- -接下来的示例均假设已经创建好了前述的各种 schema 信息 +接下来的示例需要根据以下脚本创建 `schema`。 + +```groovy +schema.propertyKey("name").asText().ifNotExist().create(); +schema.propertyKey("age").asInt().ifNotExist().create(); +schema.propertyKey("city").asText().ifNotExist().create(); +schema.propertyKey("weight").asDouble().ifNotExist().create(); +schema.propertyKey("lang").asText().ifNotExist().create(); +schema.propertyKey("price").asDouble().ifNotExist().create(); +schema.propertyKey("hobby").asText().valueList().ifNotExist().create(); + +schema.vertexLabel("person").properties("name", "age", "city", "weight", "hobby").primaryKeys("name").nullableKeys("age", "city", "weight", "hobby").ifNotExist().create(); +schema.vertexLabel("software").properties("name", "lang", "price").primaryKeys("name").nullableKeys("lang", "price").ifNotExist().create(); + +schema.indexLabel("personByAge").onV("person").by("age").range().ifNotExist().create(); +``` #### 2.1.1 创建一个顶点 @@ -55,22 +70,12 @@ POST http://localhost:8080/graphs/hugegraph/graph/vertices ```json { - "id": "1:marko", - "label": "person", - "type": "vertex", - "properties": { - "name": [ - { - "id": "1:marko>name", - "value": "marko" - } - ], - "age": [ - { - "id": "1:marko>age", - "value": 29 - } - ] + "id":"1:marko", + "label":"person", + "type":"vertex", + "properties":{ + "name":"marko", + "age":29 } } ``` @@ -152,28 +157,13 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/"1:marko"?action=appen ```json { - "id": "1:marko", - "label": "person", - "type": "vertex", - "properties": { - "city": [ - { - "id": "1:marko>city", - "value": "Beijing" - } - ], - "name": [ - { - "id": "1:marko>name", - "value": "marko" - } - ], - "age": [ - { - "id": "1:marko>age", - "value": 30 - } - ] + "id":"1:marko", + "label":"person", + "type":"vertex", + "properties":{ + "name":"marko", + "age":30, + "city":"Beijing" } } ``` @@ -227,6 +217,12 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/"1:marko"?action=appen } ``` +通过以下命令新增顶点: + +```shell +curl -H "Content-Type: application/json" -d '[{"label":"person","properties":{"name":"josh","age":32,"city":"Beijing","weight":0.1,"hobby":["reading","football"]}},{"label":"software","properties":{"name":"lop","lang":"java","price":328}}]' http:///127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch +``` + ##### Method & Url ``` @@ -281,30 +277,30 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch ```json { - "vertices": [ + "vertices":[ { - "id": "2:lop", - "label": "software", - "type": "vertex", - "properties": { - "name": "lop", - "lang": "c++", - "price": 328 + "id":"2:lop", + "label":"software", + "type":"vertex", + "properties":{ + "name":"lop", + "lang":"c++", + "price":328.0 } }, { - "id": "1:josh", - "label": "person", - "type": "vertex", - "properties": { - "name": "josh", - "age": 32, - "city": "Shanghai", - "weight": 0.3, - "hobby": [ - "swiming", + "id":"1:josh", + "label":"person", + "type":"vertex", + "properties":{ + "name":"josh", + "age":32, + "city":"Shanghai", + "weight":0.3, + "hobby":[ "reading", - "football" + "football", + "swiming" ] } } @@ -354,22 +350,12 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/"1:marko"?action=elimi ```json { - "id": "1:marko", - "label": "person", - "type": "vertex", - "properties": { - "name": [ - { - "id": "1:marko>name", - "value": "marko" - } - ], - "age": [ - { - "id": "1:marko>age", - "value": 30 - } - ] + "id":"1:marko", + "label":"person", + "type":"vertex", + "properties":{ + "name":"marko", + "age":30 } } ``` @@ -418,30 +404,14 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?label=person&propertie ```json { - "vertices": [ + "vertices":[ { - "id": "1:marko", - "label": "person", - "type": "vertex", - "properties": { - "city": [ - { - "id": "1:marko>city", - "value": "Beijing" - } - ], - "name": [ - { - "id": "1:marko>name", - "value": "marko" - } - ], - "age": [ - { - "id": "1:marko>age", - "value": 29 - } - ] + "id":"1:marko", + "label":"person", + "type":"vertex", + "properties":{ + "name":"marko", + "age":30 } } ] @@ -450,6 +420,12 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?label=person&propertie **分页查询所有顶点,获取第一页(page不带参数值),限定3条** +通过以下命令新增顶点: + +```shell +curl -H "Content-Type: application/json" -d '[{"label":"person","properties":{"name":"peter","age":29,"city":"Shanghai"}},{"label":"person","properties":{"name":"vadas","age":27,"city":"Hongkong"}}]' http://localhost:8080/graphs/hugegraph/graph/vertices/batch +``` + ##### Method & Url ``` @@ -466,69 +442,48 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?page&limit=3 ```json { - "vertices": [{ - "id": "2:ripple", - "label": "software", - "type": "vertex", - "properties": { - "price": [{ - "id": "2:ripple>price", - "value": 199 - }], - "name": [{ - "id": "2:ripple>name", - "value": "ripple" - }], - "lang": [{ - "id": "2:ripple>lang", - "value": "java" - }] - } - }, - { - "id": "1:vadas", - "label": "person", - "type": "vertex", - "properties": { - "city": [{ - "id": "1:vadas>city", - "value": "Hongkong" - }], - "name": [{ - "id": "1:vadas>name", - "value": "vadas" - }], - "age": [{ - "id": "1:vadas>age", - "value": 27 - }] - } - }, - { - "id": "1:peter", - "label": "person", - "type": "vertex", - "properties": { - "city": [{ - "id": "1:peter>city", - "value": "Shanghai" - }], - "name": [{ - "id": "1:peter>name", - "value": "peter" - }], - "age": [{ - "id": "1:peter>age", - "value": 35 - }] - } - } - ], - "page": "001000100853313a706574657200f07ffffffc00e797c6349be736fffc8699e8a502efe10004" + "vertices":[ + { + "id":"2:lop", + "label":"software", + "type":"vertex", + "properties":{ + "name":"lop", + "lang":"c++", + "price":328.0 + } + }, + { + "id":"1:josh", + "label":"person", + "type":"vertex", + "properties":{ + "name":"josh", + "age":32, + "city":"Shanghai", + "weight":0.3, + "hobby":[ + "reading", + "football", + "swiming" + ] + } + }, + { + "id":"1:marko", + "label":"person", + "type":"vertex", + "properties":{ + "name":"marko", + "age":30 + } + } + ], + "page":"CIYxOnBldGVyAAAAAAAAAAM=" } ``` -返回的body里面是带有下一页的页号信息的,`"page": "001000100853313a706574657200f07ffffffc00e797c6349be736fffc8699e8a502efe10004"`, +返回的body里面是带有下一页的页号信息的,`"page": "CIYxOnBldGVyAAAAAAAAAAM"`, 在查询下一页的时候将该值赋给page参数。 **分页查询所有顶点,获取下一页(page带上上一页返回的page值),限定3条** @@ -549,65 +504,39 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?page=001000100853313a7 ```json { - "vertices": [{ - "id": "1:josh", - "label": "person", - "type": "vertex", - "properties": { - "city": [{ - "id": "1:josh>city", - "value": "Beijing" - }], - "name": [{ - "id": "1:josh>name", - "value": "josh" - }], - "age": [{ - "id": "1:josh>age", - "value": 32 - }] - } - }, - { - "id": "1:marko", - "label": "person", - "type": "vertex", - "properties": { - "city": [{ - "id": "1:marko>city", - "value": "Beijing" - }], - "name": [{ - "id": "1:marko>name", - "value": "marko" - }], - "age": [{ - "id": "1:marko>age", - "value": 29 - }] - } - }, - { - "id": "2:lop", - "label": "software", - "type": "vertex", - "properties": { - "price": [{ - "id": "2:lop>price", - "value": 328 - }], - "name": [{ - "id": "2:lop>name", - "value": "lop" - }], - "lang": [{ - "id": "2:lop>lang", - "value": "java" - }] - } - } - ], - "page": null + "vertices":[ + { + "id":"1:peter", + "label":"person", + "type":"vertex", + "properties":{ + "name":"peter", + "age":29, + "city":"Shanghai" + } + }, + { + "id":"1:vadas", + "label":"person", + "type":"vertex", + "properties":{ + "name":"vadas", + "age":27, + "city":"Hongkong" + } + }, + { + "id":"2:ripple", + "label":"software", + "type":"vertex", + "properties":{ + "name":"ripple", + "lang":"java", + "price":199.0 + } + } + ], + "page":null } ``` @@ -631,22 +560,12 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices/"1:marko" ```json { - "id": "1:marko", - "label": "person", - "type": "vertex", - "properties": { - "name": [ - { - "id": "1:marko>name", - "value": "marko" - } - ], - "age": [ - { - "id": "1:marko>age", - "value": 29 - } - ] + "id":"1:marko", + "label":"person", + "type":"vertex", + "properties":{ + "name":"marko", + "age":30 } } ``` diff --git a/content/en/docs/clients/restful-api/vertex.md b/content/en/docs/clients/restful-api/vertex.md index a562d81e6..eccd28db4 100644 --- a/content/en/docs/clients/restful-api/vertex.md +++ b/content/en/docs/clients/restful-api/vertex.md @@ -23,7 +23,7 @@ For the `GET/PUT/DELETE` API of a vertex, the id part in the URL should be passe ------------------------------------------------------------------- -The following examples assume that the aforementioned schema information has been created. +The following examples need to create a `schema` according to the following script. #### 2.1.1 Create a vertex @@ -55,22 +55,12 @@ POST http://localhost:8080/graphs/hugegraph/graph/vertices ```json { - "id": "1:marko", - "label": "person", - "type": "vertex", - "properties": { - "name": [ - { - "id": "1:marko>name", - "value": "marko" - } - ], - "age": [ - { - "id": "1:marko>age", - "value": 29 - } - ] + "id":"1:marko", + "label":"person", + "type":"vertex", + "properties":{ + "name":"marko", + "age":29 } } ``` @@ -152,28 +142,13 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/"1:marko"?action=appen ```json { - "id": "1:marko", - "label": "person", - "type": "vertex", - "properties": { - "city": [ - { - "id": "1:marko>city", - "value": "Beijing" - } - ], - "name": [ - { - "id": "1:marko>name", - "value": "marko" - } - ], - "age": [ - { - "id": "1:marko>age", - "value": 30 - } - ] + "id":"1:marko", + "label":"person", + "type":"vertex", + "properties":{ + "name":"marko", + "age":30, + "city":"Beijing" } } ``` @@ -227,6 +202,12 @@ Assuming the original vertex and properties are: } ``` +It can be added by the following command: + +```shell +curl -H "Content-Type: application/json" -d '[{"label":"person","properties":{"name":"josh","age":32,"city":"Beijing","weight":0.1,"hobby":["reading","football"]}},{"label":"software","properties":{"name":"lop","lang":"java","price":328}}]' http:///127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch +``` + ##### Method & Url ``` @@ -281,30 +262,30 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch ```json { - "vertices": [ + "vertices":[ { - "id": "2:lop", - "label": "software", - "type": "vertex", - "properties": { - "name": "lop", - "lang": "c++", - "price": 328 + "id":"2:lop", + "label":"software", + "type":"vertex", + "properties":{ + "name":"lop", + "lang":"c++", + "price":328.0 } }, { - "id": "1:josh", - "label": "person", - "type": "vertex", - "properties": { - "name": "josh", - "age": 32, - "city": "Shanghai", - "weight": 0.3, - "hobby": [ - "swiming", + "id":"1:josh", + "label":"person", + "type":"vertex", + "properties":{ + "name":"josh", + "age":32, + "city":"Shanghai", + "weight":0.3, + "hobby":[ "reading", - "football" + "football", + "swiming" ] } } @@ -354,22 +335,12 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/"1:marko"?action=elimi ```json { - "id": "1:marko", - "label": "person", - "type": "vertex", - "properties": { - "name": [ - { - "id": "1:marko>name", - "value": "marko" - } - ], - "age": [ - { - "id": "1:marko>age", - "value": 30 - } - ] + "id":"1:marko", + "label":"person", + "type":"vertex", + "properties":{ + "name":"marko", + "age":30 } } ``` @@ -418,30 +389,14 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?label=person&propertie ```json { - "vertices": [ + "vertices":[ { - "id": "1:marko", - "label": "person", - "type": "vertex", - "properties": { - "city": [ - { - "id": "1:marko>city", - "value": "Beijing" - } - ], - "name": [ - { - "id": "1:marko>name", - "value": "marko" - } - ], - "age": [ - { - "id": "1:marko>age", - "value": 29 - } - ] + "id":"1:marko", + "label":"person", + "type":"vertex", + "properties":{ + "name":"marko", + "age":30 } } ] @@ -450,6 +405,12 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?label=person&propertie **Paginate through all vertices, retrieve the first page (page without parameter value), limited to 3 records** +Add vertices with the following command: + +```shell +curl -H "Content-Type: application/json" -d '[{"label":"person","properties":{"name":"peter","age":29,"city":"Shanghai"}},{"label":"person","properties":{"name":"vadas","age":27,"city":"Hongkong"}}]' http://localhost:8080/graphs/hugegraph/graph/vertices/batch +``` + ##### Method & Url ``` @@ -466,65 +427,44 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?page&limit=3 ```json { - "vertices": [{ - "id": "2:ripple", - "label": "software", - "type": "vertex", - "properties": { - "price": [{ - "id": "2:ripple>price", - "value": 199 - }], - "name": [{ - "id": "2:ripple>name", - "value": "ripple" - }], - "lang": [{ - "id": "2:ripple>lang", - "value": "java" - }] - } - }, - { - "id": "1:vadas", - "label": "person", - "type": "vertex", - "properties": { - "city": [{ - "id": "1:vadas>city", - "value": "Hongkong" - }], - "name": [{ - "id": "1:vadas>name", - "value": "vadas" - }], - "age": [{ - "id": "1:vadas>age", - "value": 27 - }] - } - }, - { - "id": "1:peter", - "label": "person", - "type": "vertex", - "properties": { - "city": [{ - "id": "1:peter>city", - "value": "Shanghai" - }], - "name": [{ - "id": "1:peter>name", - "value": "peter" - }], - "age": [{ - "id": "1:peter>age", - "value": 35 - }] - } - } - ], - "page": "001000100853313a706574657200f07ffffffc00e797c6349be736fffc8699e8a502efe10004" + "vertices":[ + { + "id":"2:lop", + "label":"software", + "type":"vertex", + "properties":{ + "name":"lop", + "lang":"c++", + "price":328.0 + } + }, + { + "id":"1:josh", + "label":"person", + "type":"vertex", + "properties":{ + "name":"josh", + "age":32, + "city":"Shanghai", + "weight":0.3, + "hobby":[ + "reading", + "football", + "swiming" + ] + } + }, + { + "id":"1:marko", + "label":"person", + "type":"vertex", + "properties":{ + "name":"marko", + "age":30 + } + } + ], + "page":"CIYxOnBldGVyAAAAAAAAAAM=" } ``` @@ -548,65 +488,39 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?page=001000100853313a7 ```json { - "vertices": [{ - "id": "1:josh", - "label": "person", - "type": "vertex", - "properties": { - "city": [{ - "id": "1:josh>city", - "value": "Beijing" - }], - "name": [{ - "id": "1:josh>name", - "value": "josh" - }], - "age": [{ - "id": "1:josh>age", - "value": 32 - }] - } - }, - { - "id": "1:marko", - "label": "person", - "type": "vertex", - "properties": { - "city": [{ - "id": "1:marko>city", - "value": "Beijing" - }], - "name": [{ - "id": "1:marko>name", - "value": "marko" - }], - "age": [{ - "id": "1:marko>age", - "value": 29 - }] - } - }, - { - "id": "2:lop", - "label": "software", - "type": "vertex", - "properties": { - "price": [{ - "id": "2:lop>price", - "value": 328 - }], - "name": [{ - "id": "2:lop>name", - "value": "lop" - }], - "lang": [{ - "id": "2:lop>lang", - "value": "java" - }] - } - } - ], - "page": null + "vertices":[ + { + "id":"1:peter", + "label":"person", + "type":"vertex", + "properties":{ + "name":"peter", + "age":29, + "city":"Shanghai" + } + }, + { + "id":"1:vadas", + "label":"person", + "type":"vertex", + "properties":{ + "name":"vadas", + "age":27, + "city":"Hongkong" + } + }, + { + "id":"2:ripple", + "label":"software", + "type":"vertex", + "properties":{ + "name":"ripple", + "lang":"java", + "price":199.0 + } + } + ], + "page":null } ``` @@ -630,22 +544,12 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices/"1:marko" ```json { - "id": "1:marko", - "label": "person", - "type": "vertex", - "properties": { - "name": [ - { - "id": "1:marko>name", - "value": "marko" - } - ], - "age": [ - { - "id": "1:marko>age", - "value": 29 - } - ] + "id":"1:marko", + "label":"person", + "type":"vertex", + "properties":{ + "name":"marko", + "age":30 } } ``` From cde91d41b0fb585d468963a0083ab59b00de34b2 Mon Sep 17 00:00:00 2001 From: liuxiao Date: Fri, 2 Jun 2023 22:28:50 +0800 Subject: [PATCH 2/8] fix en --- content/en/docs/clients/restful-api/vertex.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/clients/restful-api/vertex.md b/content/en/docs/clients/restful-api/vertex.md index eccd28db4..56fc5dcd1 100644 --- a/content/en/docs/clients/restful-api/vertex.md +++ b/content/en/docs/clients/restful-api/vertex.md @@ -202,7 +202,7 @@ Assuming the original vertex and properties are: } ``` -It can be added by the following command: +Add vertices with the following command: ```shell curl -H "Content-Type: application/json" -d '[{"label":"person","properties":{"name":"josh","age":32,"city":"Beijing","weight":0.1,"hobby":["reading","football"]}},{"label":"software","properties":{"name":"lop","lang":"java","price":328}}]' http:///127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch From a29d32801dc9d9a383ebd087770878c9ea22b7e0 Mon Sep 17 00:00:00 2001 From: liuxiao Date: Fri, 2 Jun 2023 22:31:09 +0800 Subject: [PATCH 3/8] add schema in en --- content/en/docs/clients/restful-api/vertex.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/content/en/docs/clients/restful-api/vertex.md b/content/en/docs/clients/restful-api/vertex.md index 56fc5dcd1..d401a6ef5 100644 --- a/content/en/docs/clients/restful-api/vertex.md +++ b/content/en/docs/clients/restful-api/vertex.md @@ -25,6 +25,21 @@ For the `GET/PUT/DELETE` API of a vertex, the id part in the URL should be passe The following examples need to create a `schema` according to the following script. +```groovy +schema.propertyKey("name").asText().ifNotExist().create(); +schema.propertyKey("age").asInt().ifNotExist().create(); +schema.propertyKey("city").asText().ifNotExist().create(); +schema.propertyKey("weight").asDouble().ifNotExist().create(); +schema.propertyKey("lang").asText().ifNotExist().create(); +schema.propertyKey("price").asDouble().ifNotExist().create(); +schema.propertyKey("hobby").asText().valueList().ifNotExist().create(); + +schema.vertexLabel("person").properties("name", "age", "city", "weight", "hobby").primaryKeys("name").nullableKeys("age", "city", "weight", "hobby").ifNotExist().create(); +schema.vertexLabel("software").properties("name", "lang", "price").primaryKeys("name").nullableKeys("lang", "price").ifNotExist().create(); + +schema.indexLabel("personByAge").onV("person").by("age").range().ifNotExist().create(); +``` + #### 2.1.1 Create a vertex ##### Method & Url From 11cf3de091aad94fdf76aef4a0bfbf66fa3b0ff8 Mon Sep 17 00:00:00 2001 From: liuxiao Date: Fri, 2 Jun 2023 22:38:14 +0800 Subject: [PATCH 4/8] fix json format --- content/cn/docs/clients/restful-api/vertex.md | 268 +++++++++--------- content/en/docs/clients/restful-api/vertex.md | 178 ++++++------ 2 files changed, 223 insertions(+), 223 deletions(-) diff --git a/content/cn/docs/clients/restful-api/vertex.md b/content/cn/docs/clients/restful-api/vertex.md index 53eae492d..fe621d30b 100644 --- a/content/cn/docs/clients/restful-api/vertex.md +++ b/content/cn/docs/clients/restful-api/vertex.md @@ -70,12 +70,12 @@ POST http://localhost:8080/graphs/hugegraph/graph/vertices ```json { - "id":"1:marko", - "label":"person", - "type":"vertex", - "properties":{ - "name":"marko", - "age":29 + "id": "1:marko", + "label": "person", + "type": "vertex", + "properties": { + "name": "marko", + "age": 29 } } ``` @@ -157,13 +157,13 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/"1:marko"?action=appen ```json { - "id":"1:marko", - "label":"person", - "type":"vertex", - "properties":{ - "name":"marko", - "age":30, - "city":"Beijing" + "id": "1:marko", + "label": "person", + "type": "vertex", + "properties": { + "name": "marko", + "age": 30, + "city": "Beijing" } } ``` @@ -187,27 +187,27 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/"1:marko"?action=appen ```json { - "vertices":[ + "vertices": [ { - "id":"2:lop", - "label":"software", - "type":"vertex", - "properties":{ - "name":"lop", - "lang":"java", - "price":328 + "id": "2:lop", + "label": "software", + "type": "vertex", + "properties": { + "name": "lop", + "lang": "java", + "price": 328 } }, { - "id":"1:josh", - "label":"person", - "type":"vertex", - "properties":{ - "name":"josh", - "age":32, - "city":"Beijing", - "weight":0.1, - "hobby":[ + "id": "1:josh", + "label": "person", + "type": "vertex", + "properties": { + "name": "josh", + "age": 32, + "city": "Beijing", + "weight": 0.1, + "hobby": [ "reading", "football" ] @@ -233,37 +233,37 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch ```json { - "vertices":[ + "vertices": [ { - "label":"software", - "type":"vertex", - "properties":{ - "name":"lop", - "lang":"c++", - "price":299 + "label": "software", + "type": "vertex", + "properties": { + "name": "lop", + "lang": "c++", + "price": 299 } }, { - "label":"person", - "type":"vertex", - "properties":{ - "name":"josh", - "city":"Shanghai", - "weight":0.2, - "hobby":[ + "label": "person", + "type": "vertex", + "properties": { + "name": "josh", + "city": "Shanghai", + "weight": 0.2, + "hobby": [ "swiming" ] } } ], - "update_strategies":{ - "price":"BIGGER", - "age":"OVERRIDE", - "city":"OVERRIDE", - "weight":"SUM", - "hobby":"UNION" + "update_strategies": { + "price": "BIGGER", + "age": "OVERRIDE", + "city": "OVERRIDE", + "weight": "SUM", + "hobby": "UNION" }, - "create_if_not_exist":true + "create_if_not_exist": true } ``` @@ -277,27 +277,27 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch ```json { - "vertices":[ + "vertices": [ { - "id":"2:lop", - "label":"software", - "type":"vertex", - "properties":{ - "name":"lop", - "lang":"c++", - "price":328.0 + "id": "2:lop", + "label": "software", + "type": "vertex", + "properties": { + "name": "lop", + "lang": "c++", + "price": 328 } }, { - "id":"1:josh", - "label":"person", - "type":"vertex", - "properties":{ - "name":"josh", - "age":32, - "city":"Shanghai", - "weight":0.3, - "hobby":[ + "id": "1:josh", + "label": "person", + "type": "vertex", + "properties": { + "name": "josh", + "age": 32, + "city": "Shanghai", + "weight": 0.3, + "hobby": [ "reading", "football", "swiming" @@ -350,12 +350,12 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/"1:marko"?action=elimi ```json { - "id":"1:marko", - "label":"person", - "type":"vertex", - "properties":{ - "name":"marko", - "age":30 + "id": "1:marko", + "label": "person", + "type": "vertex", + "properties": { + "name": "marko", + "age": 30 } } ``` @@ -404,14 +404,14 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?label=person&propertie ```json { - "vertices":[ + "vertices": [ { - "id":"1:marko", - "label":"person", - "type":"vertex", - "properties":{ - "name":"marko", - "age":30 + "id": "1:marko", + "label": "person", + "type": "vertex", + "properties": { + "name": "marko", + "age": 30 } } ] @@ -442,27 +442,27 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?page&limit=3 ```json { - "vertices":[ + "vertices": [ { - "id":"2:lop", - "label":"software", - "type":"vertex", - "properties":{ - "name":"lop", - "lang":"c++", - "price":328.0 + "id": "2:lop", + "label": "software", + "type": "vertex", + "properties": { + "name": "lop", + "lang": "c++", + "price": 328 } }, { - "id":"1:josh", - "label":"person", - "type":"vertex", - "properties":{ - "name":"josh", - "age":32, - "city":"Shanghai", - "weight":0.3, - "hobby":[ + "id": "1:josh", + "label": "person", + "type": "vertex", + "properties": { + "name": "josh", + "age": 32, + "city": "Shanghai", + "weight": 0.3, + "hobby": [ "reading", "football", "swiming" @@ -470,16 +470,16 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?page&limit=3 } }, { - "id":"1:marko", - "label":"person", - "type":"vertex", - "properties":{ - "name":"marko", - "age":30 + "id": "1:marko", + "label": "person", + "type": "vertex", + "properties": { + "name": "marko", + "age": 30 } } ], - "page":"CIYxOnBldGVyAAAAAAAAAAM=" + "page": "CIYxOnBldGVyAAAAAAAAAAM=" } ``` @@ -504,39 +504,39 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?page=001000100853313a7 ```json { - "vertices":[ + "vertices": [ { - "id":"1:peter", - "label":"person", - "type":"vertex", - "properties":{ - "name":"peter", - "age":29, - "city":"Shanghai" + "id": "1:peter", + "label": "person", + "type": "vertex", + "properties": { + "name": "peter", + "age": 29, + "city": "Shanghai" } }, { - "id":"1:vadas", - "label":"person", - "type":"vertex", - "properties":{ - "name":"vadas", - "age":27, - "city":"Hongkong" + "id": "1:vadas", + "label": "person", + "type": "vertex", + "properties": { + "name": "vadas", + "age": 27, + "city": "Hongkong" } }, { - "id":"2:ripple", - "label":"software", - "type":"vertex", - "properties":{ - "name":"ripple", - "lang":"java", - "price":199.0 + "id": "2:ripple", + "label": "software", + "type": "vertex", + "properties": { + "name": "ripple", + "lang": "java", + "price": 199 } } ], - "page":null + "page": null } ``` @@ -560,12 +560,12 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices/"1:marko" ```json { - "id":"1:marko", - "label":"person", - "type":"vertex", - "properties":{ - "name":"marko", - "age":30 + "id": "1:marko", + "label": "person", + "type": "vertex", + "properties": { + "name": "marko", + "age": 30 } } ``` diff --git a/content/en/docs/clients/restful-api/vertex.md b/content/en/docs/clients/restful-api/vertex.md index d401a6ef5..1a6cd9bcc 100644 --- a/content/en/docs/clients/restful-api/vertex.md +++ b/content/en/docs/clients/restful-api/vertex.md @@ -70,12 +70,12 @@ POST http://localhost:8080/graphs/hugegraph/graph/vertices ```json { - "id":"1:marko", - "label":"person", - "type":"vertex", - "properties":{ - "name":"marko", - "age":29 + "id": "1:marko", + "label": "person", + "type": "vertex", + "properties": { + "name": "marko", + "age": 29 } } ``` @@ -277,27 +277,27 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch ```json { - "vertices":[ + "vertices": [ { - "id":"2:lop", - "label":"software", - "type":"vertex", - "properties":{ - "name":"lop", - "lang":"c++", - "price":328.0 + "id": "2:lop", + "label": "software", + "type": "vertex", + "properties": { + "name": "lop", + "lang": "c++", + "price": 328 } }, { - "id":"1:josh", - "label":"person", - "type":"vertex", - "properties":{ - "name":"josh", - "age":32, - "city":"Shanghai", - "weight":0.3, - "hobby":[ + "id": "1:josh", + "label": "person", + "type": "vertex", + "properties": { + "name": "josh", + "age": 32, + "city": "Shanghai", + "weight": 0.3, + "hobby": [ "reading", "football", "swiming" @@ -350,12 +350,12 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/"1:marko"?action=elimi ```json { - "id":"1:marko", - "label":"person", - "type":"vertex", - "properties":{ - "name":"marko", - "age":30 + "id": "1:marko", + "label": "person", + "type": "vertex", + "properties": { + "name": "marko", + "age": 30 } } ``` @@ -404,14 +404,14 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?label=person&propertie ```json { - "vertices":[ + "vertices": [ { - "id":"1:marko", - "label":"person", - "type":"vertex", - "properties":{ - "name":"marko", - "age":30 + "id": "1:marko", + "label": "person", + "type": "vertex", + "properties": { + "name": "marko", + "age": 30 } } ] @@ -442,27 +442,27 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?page&limit=3 ```json { - "vertices":[ + "vertices": [ { - "id":"2:lop", - "label":"software", - "type":"vertex", - "properties":{ - "name":"lop", - "lang":"c++", - "price":328.0 + "id": "2:lop", + "label": "software", + "type": "vertex", + "properties": { + "name": "lop", + "lang": "c++", + "price": 328 } }, { - "id":"1:josh", - "label":"person", - "type":"vertex", - "properties":{ - "name":"josh", - "age":32, - "city":"Shanghai", - "weight":0.3, - "hobby":[ + "id": "1:josh", + "label": "person", + "type": "vertex", + "properties": { + "name": "josh", + "age": 32, + "city": "Shanghai", + "weight": 0.3, + "hobby": [ "reading", "football", "swiming" @@ -470,16 +470,16 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?page&limit=3 } }, { - "id":"1:marko", - "label":"person", - "type":"vertex", - "properties":{ - "name":"marko", - "age":30 + "id": "1:marko", + "label": "person", + "type": "vertex", + "properties": { + "name": "marko", + "age": 30 } } ], - "page":"CIYxOnBldGVyAAAAAAAAAAM=" + "page": "CIYxOnBldGVyAAAAAAAAAAM=" } ``` @@ -503,39 +503,39 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?page=001000100853313a7 ```json { - "vertices":[ + "vertices": [ { - "id":"1:peter", - "label":"person", - "type":"vertex", - "properties":{ - "name":"peter", - "age":29, - "city":"Shanghai" + "id": "1:peter", + "label": "person", + "type": "vertex", + "properties": { + "name": "peter", + "age": 29, + "city": "Shanghai" } }, { - "id":"1:vadas", - "label":"person", - "type":"vertex", - "properties":{ - "name":"vadas", - "age":27, - "city":"Hongkong" + "id": "1:vadas", + "label": "person", + "type": "vertex", + "properties": { + "name": "vadas", + "age": 27, + "city": "Hongkong" } }, { - "id":"2:ripple", - "label":"software", - "type":"vertex", - "properties":{ - "name":"ripple", - "lang":"java", - "price":199.0 + "id": "2:ripple", + "label": "software", + "type": "vertex", + "properties": { + "name": "ripple", + "lang": "java", + "price": 199 } } ], - "page":null + "page": null } ``` @@ -559,12 +559,12 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices/"1:marko" ```json { - "id":"1:marko", - "label":"person", - "type":"vertex", - "properties":{ - "name":"marko", - "age":30 + "id": "1:marko", + "label": "person", + "type": "vertex", + "properties": { + "name": "marko", + "age": 30 } } ``` From 998ff47dd5002a282fb4663aadd8982deddb04b6 Mon Sep 17 00:00:00 2001 From: liuxiao Date: Fri, 2 Jun 2023 22:43:29 +0800 Subject: [PATCH 5/8] update en --- content/en/docs/clients/restful-api/vertex.md | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/content/en/docs/clients/restful-api/vertex.md b/content/en/docs/clients/restful-api/vertex.md index 1a6cd9bcc..651a28415 100644 --- a/content/en/docs/clients/restful-api/vertex.md +++ b/content/en/docs/clients/restful-api/vertex.md @@ -157,13 +157,13 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/"1:marko"?action=appen ```json { - "id":"1:marko", - "label":"person", - "type":"vertex", - "properties":{ - "name":"marko", - "age":30, - "city":"Beijing" + "id": "1:marko", + "label": "person", + "type": "vertex", + "properties": { + "name": "marko", + "age": 30, + "city": "Beijing" } } ``` @@ -187,27 +187,27 @@ Assuming the original vertex and properties are: ```json { - "vertices":[ + "vertices": [ { - "id":"2:lop", - "label":"software", - "type":"vertex", - "properties":{ - "name":"lop", - "lang":"java", - "price":328 + "id": "2:lop", + "label": "software", + "type": "vertex", + "properties": { + "name": "lop", + "lang": "java", + "price": 328 } }, { - "id":"1:josh", - "label":"person", - "type":"vertex", - "properties":{ - "name":"josh", - "age":32, - "city":"Beijing", - "weight":0.1, - "hobby":[ + "id": "1:josh", + "label": "person", + "type": "vertex", + "properties": { + "name": "josh", + "age": 32, + "city": "Beijing", + "weight": 0.1, + "hobby": [ "reading", "football" ] @@ -233,37 +233,37 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch ```json { - "vertices":[ + "vertices": [ { - "label":"software", - "type":"vertex", - "properties":{ - "name":"lop", - "lang":"c++", - "price":299 + "label": "software", + "type": "vertex", + "properties": { + "name": "lop", + "lang": "c++", + "price": 299 } }, { - "label":"person", - "type":"vertex", - "properties":{ - "name":"josh", - "city":"Shanghai", - "weight":0.2, - "hobby":[ + "label": "person", + "type": "vertex", + "properties": { + "name": "josh", + "city": "Shanghai", + "weight": 0.2, + "hobby": [ "swiming" ] } } ], - "update_strategies":{ - "price":"BIGGER", - "age":"OVERRIDE", - "city":"OVERRIDE", - "weight":"SUM", - "hobby":"UNION" + "update_strategies": { + "price": "BIGGER", + "age": "OVERRIDE", + "city": "OVERRIDE", + "weight": "SUM", + "hobby": "UNION" }, - "create_if_not_exist":true + "create_if_not_exist": true } ``` From 1cc2bbd274c74c754a4e303f294a9d9932b2e5c0 Mon Sep 17 00:00:00 2001 From: liuxiao Date: Sun, 4 Jun 2023 00:22:06 +0800 Subject: [PATCH 6/8] fix typos --- content/cn/docs/clients/restful-api/vertex.md | 8 ++++---- content/en/docs/clients/restful-api/vertex.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/content/cn/docs/clients/restful-api/vertex.md b/content/cn/docs/clients/restful-api/vertex.md index fe621d30b..e866f9fea 100644 --- a/content/cn/docs/clients/restful-api/vertex.md +++ b/content/cn/docs/clients/restful-api/vertex.md @@ -23,7 +23,7 @@ weight: 7 ------------------------------------------------------------------- -接下来的示例需要根据以下脚本创建 `schema`。 +接下来的示例需要先根据以下 `groovy` 脚本创建图 `schema` ```groovy schema.propertyKey("name").asText().ifNotExist().create(); @@ -251,7 +251,7 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch "city": "Shanghai", "weight": 0.2, "hobby": [ - "swiming" + "swimming" ] } } @@ -300,7 +300,7 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch "hobby": [ "reading", "football", - "swiming" + "swimming" ] } } @@ -465,7 +465,7 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?page&limit=3 "hobby": [ "reading", "football", - "swiming" + "swimming" ] } }, diff --git a/content/en/docs/clients/restful-api/vertex.md b/content/en/docs/clients/restful-api/vertex.md index 651a28415..f5f3dc598 100644 --- a/content/en/docs/clients/restful-api/vertex.md +++ b/content/en/docs/clients/restful-api/vertex.md @@ -23,7 +23,7 @@ For the `GET/PUT/DELETE` API of a vertex, the id part in the URL should be passe ------------------------------------------------------------------- -The following examples need to create a `schema` according to the following script. +The next example requires first creating the graph `schema` from the following `groovy` script ```groovy schema.propertyKey("name").asText().ifNotExist().create(); @@ -251,7 +251,7 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch "city": "Shanghai", "weight": 0.2, "hobby": [ - "swiming" + "swimming" ] } } @@ -300,7 +300,7 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch "hobby": [ "reading", "football", - "swiming" + "swimming" ] } } @@ -465,7 +465,7 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?page&limit=3 "hobby": [ "reading", "football", - "swiming" + "swimming" ] } }, From fa307c7d30091adc709aa4e83182f47d4ef1b00e Mon Sep 17 00:00:00 2001 From: liuxiao Date: Sun, 4 Jun 2023 01:01:46 +0800 Subject: [PATCH 7/8] optimize by new-bing --- content/cn/docs/clients/restful-api/vertex.md | 56 +++++++++---------- content/en/docs/clients/restful-api/vertex.md | 13 +++-- 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/content/cn/docs/clients/restful-api/vertex.md b/content/cn/docs/clients/restful-api/vertex.md index e866f9fea..6cc8dd98e 100644 --- a/content/cn/docs/clients/restful-api/vertex.md +++ b/content/cn/docs/clients/restful-api/vertex.md @@ -6,7 +6,7 @@ weight: 7 ### 2.1 Vertex -顶点类型中的 Id 策略决定了顶点的 Id 类型,其对应关系如下: +顶点类型中的 `Id` 策略决定了顶点的 `Id` 类型,其对应的 `id` 类型如下: | Id_Strategy | id type | |------------------|---------| @@ -16,10 +16,10 @@ weight: 7 | CUSTOMIZE_NUMBER | number | | CUSTOMIZE_UUID | uuid | -顶点的 `GET/PUT/DELETE` API 中 url 的 id 部分传入的应是带有类型信息的 id 值,这个类型信息用 json 串是否带引号表示,也就是说: +顶点的 `GET/PUT/DELETE` API 中 url 的 id 部分应该传入带有类型信息的 id 值,这个类型信息通过 json 串是否带引号来表示,也就是说: -- 当 id 类型为 number 时,url 中的 id 不带引号,形如 xxx/vertices/123456 -- 当 id 类型为 string 时,url 中的 id 带引号,形如 xxx/vertices/"123456" +- 当 id 类型为 `number` 时,url 中的 id 不带引号,例如 `xxx/vertices/123456` +- 当 id 类型为 `string` 时,url 中的 id 带引号,例如 `xxx/vertices/"123456"` ------------------------------------------------------------------- @@ -145,7 +145,7 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/"1:marko"?action=appen } ``` -> 注意:属性的取值是有三种类别的,分别是single、set和list。如果是single,表示增加或更新属性值;如果是set或list,则表示追加属性值。 +> 注意:属性的取值有三种类别,分别为single、set和list。single表示增加或更新属性值,set或list表示追加属性值。 ##### Response Status @@ -172,18 +172,18 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/"1:marko"?action=appen ##### 功能说明 -批量更新顶点的属性,并支持多种更新策略,包括 +批量更新顶点的属性时,可以选择多种更新策略,如下: - SUM: 数值累加 -- BIGGER: 两个数字/日期取更大的 -- SMALLER: 两个数字/日期取更小的 +- BIGGER: 原值和新值(数字、日期)取更大的 +- SMALLER: 原值和新值(数字、日期)取更小的 - UNION: Set属性取并集 - INTERSECTION: Set属性取交集 - APPEND: List属性追加元素 - ELIMINATE: List/Set属性删除元素 - OVERRIDE: 覆盖已有属性,如果新属性为null,则仍然使用旧属性 -假设原顶点及属性为: +假设原顶点的属性如下: ```json { @@ -308,16 +308,16 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch } ``` -结果分析: +结果分析如下: -- lang 属性未指定更新策略,直接用新值覆盖旧值,无论新值是否为null; -- price 属性指定 BIGGER 的更新策略,旧属性值为328,新属性值为299,所以仍然保留了旧属性值328; -- age 属性指定 OVERRIDE 更新策略,而新属性值中未传入age,相当于age为null,所以仍然保留了原属性值32; -- city 属性也指定了 OVERRIDE 更新策略,且新属性值不为null,所以覆盖了旧值; -- weight 属性指定了 SUM 更新策略,旧属性值为0.1,新属性值为0.2,最后的值为0.3; -- hobby 属性(基数为Set)指定了 UNION 更新策略,所以新值与旧值取了并集; +- lang 属性值未指定更新策略,直接用新值覆盖旧值,无论新值是否为null; +- price 属性值指定 BIGGER 的更新策略,旧属性值为328,新属性值为299,所以仍然保留了旧属性值328; +- age 属性值指定 OVERRIDE 更新策略,而新属性值中未传入age,相当于age为null,所以仍然保留了原属性值32; +- city 属性值也指定了 OVERRIDE 更新策略,且新属性值不为null,所以覆盖了旧值; +- weight 属性值指定了 SUM 更新策略,旧属性值为0.1,新属性值为0.2,最后的值为0.3; +- hobby 属性值(基数为Set)指定了 UNION 更新策略,所以新值与旧值取了并集; -其他的更新策略使用方式可以类推,不再赘述。 +其他更新策略的使用方式与此类似,此处不再详述。 #### 2.1.5 删除顶点属性 @@ -364,14 +364,14 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/"1:marko"?action=elimi ##### Params -- label: 顶点类型 -- properties: 属性键值对(根据属性查询的前提是预先建立了索引) -- limit: 查询最大数目 -- page: 页号 +- label: 顶点的类型 +- properties: 属性键值对(查询属性的前提是该属性已经建立了索引) +- limit: 查询结果的最大数目 +- page: 分页的页号 -以上参数都是可选的,如果提供page参数,必须提供limit参数,不允许带其他参数。`label, properties`和`limit`可以任意组合。 +以上参数都是可选的,但如果提供了page参数,就必须同时提供limit参数,并且不能再提供其他参数。`label, properties`和`limit`之间可以任意组合。 -属性键值对由JSON格式的属性名称和属性值组成,允许多个属性键值对作为查询条件,属性值支持精确匹配和范围匹配,精确匹配时形如`properties={"age":29}`,范围匹配时形如`properties={"age":"P.gt(29)"}`,范围匹配支持的表达式如下: +属性键值对由属性名称和属性值组成JSON格式的对象,可以使用多个属性键值对作为查询条件,属性值支持精确匹配和范围匹配,精确匹配的形式如`properties={"age":29}`,范围匹配的形式如`properties={"age":"P.gt(29)"}`,范围匹配支持以下表达式: | 表达式 | 说明 | |------------------------------------|-----------------------------| @@ -386,7 +386,7 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/"1:marko"?action=elimi | P.outside(number1,number2) | 属性值小于number1且大于number2的顶点 | | P.within(value1,value2,value3,...) | 属性值等于任何一个给定value的顶点 | -**查询所有 age 为 20 且 label 为 person 的顶点** +**查询所有 age 为 29 且 label 为 person 的顶点** ##### Method & Url @@ -483,15 +483,14 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?page&limit=3 } ``` -返回的body里面是带有下一页的页号信息的,`"page": "CIYxOnBldGVyAAAAAAAAAAM"`, -在查询下一页的时候将该值赋给page参数。 +返回的 `body` 里面是带有下一页的页号信息的,`"page": "CIYxOnBldGVyAAAAAAAAAAM="`,在查询下一页的时候将该值赋给 `page` 参数。 **分页查询所有顶点,获取下一页(page带上上一页返回的page值),限定3条** ##### Method & Url ``` -GET http://localhost:8080/graphs/hugegraph/graph/vertices?page=001000100853313a706574657200f07ffffffc00e797c6349be736fffc8699e8a502efe10004&limit=3 +GET http://localhost:8080/graphs/hugegraph/graph/vertices?page=CIYxOnBldGVyAAAAAAAAAAM=&limit=3 ``` ##### Response Status @@ -540,7 +539,7 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?page=001000100853313a7 } ``` -此时`"page": null`表示已经没有下一页了 (注: 后端为 Cassandra 时,为了性能考虑,返回页恰好为最后一页时,返回 `page` 值可能非空,通过该 `page` 再请求下一页数据时则返回 `空数据` 及 `page = null`,其他情况类似) +当`"page": null`时,表示已经没有下一页了(注:如果后端使用的是 Cassandra ,为了提高性能,当返回的页数刚好是最后一页时,返回的 `page` 值可能不为空,但是如果用这个 `page` 值再请求下一页数据时,就会返回 `空数据` 和 `page = null`,其他情况也类似) #### 2.1.7 根据Id获取顶点 @@ -601,6 +600,7 @@ DELETE http://localhost:8080/graphs/hugegraph/graph/vertices/"1:marko"?label=per ``` ##### Response Status + ```json 204 ``` diff --git a/content/en/docs/clients/restful-api/vertex.md b/content/en/docs/clients/restful-api/vertex.md index f5f3dc598..78e8f4c5f 100644 --- a/content/en/docs/clients/restful-api/vertex.md +++ b/content/en/docs/clients/restful-api/vertex.md @@ -6,7 +6,7 @@ weight: 7 ### 2.1 Vertex -In vertex types, the Id strategy determines the type of the vertex Id, with the corresponding relationships as follows: +In vertex types, the `Id` strategy determines the type of the vertex `Id`, with the corresponding relationships as follows: | Id_Strategy | id type | |------------------|---------| @@ -18,8 +18,8 @@ In vertex types, the Id strategy determines the type of the vertex Id, with the For the `GET/PUT/DELETE` API of a vertex, the id part in the URL should be passed as the id value with type information. This type information is indicated by whether the JSON string is enclosed in quotes, meaning: -- When the id type is number, the id in the URL is without quotes, for example: xxx/vertices/123456. -- When the id type is string, the id in the URL is enclosed in quotes, for example: xxx/vertices/"123456". +- When the id type is `number`, the id in the URL is without quotes, for example: `xxx/vertices/123456`. +- When the id type is `string`, the id in the URL is enclosed in quotes, for example: `xxx/vertices/"123456"`. ------------------------------------------------------------------- @@ -386,7 +386,7 @@ Property key-value pairs consist of the property name and value in JSON format. | P.outside(number1,number2) | Vertices with property value less than `number1` and greater than `number2` | | P.within(value1,value2,value3,...) | Vertices with property value equal to any of the given `values` | -**Query all vertices with age 20 and label person** +**Query all vertices with age 29 and label person** ##### Method & Url @@ -483,14 +483,14 @@ GET http://localhost:8080/graphs/hugegraph/graph/vertices?page&limit=3 } ``` -The returned body contains information about the page number of the next page, `"page": "001000100853313a706574657200f07ffffffc00e797c6349be736fffc8699e8a502efe10004"`. When querying the next page, assign this value to the `page` parameter. +The returned `body` contains information about the page number of the next `page`, `"page": "CIYxOnBldGVyAAAAAAAAAAM"`. When querying the next page, assign this value to the `page` parameter. **Paginate and retrieve all vertices, including the next page (passing the `page` value returned from the previous page), limited to 3 items.** ##### Method & Url ``` -GET http://localhost:8080/graphs/hugegraph/graph/vertices?page=001000100853313a706574657200f07ffffffc00e797c6349be736fffc8699e8a502efe10004&limit=3 +GET http://localhost:8080/graphs/hugegraph/graph/vertices?page=CIYxOnBldGVyAAAAAAAAAAM=&limit=3 ``` ##### Response Status @@ -600,6 +600,7 @@ DELETE http://localhost:8080/graphs/hugegraph/graph/vertices/"1:marko"?label=per ``` ##### Response Status + ```json 204 ``` From 72a6584582a042f7cd9739479bb16f65b749b7dd Mon Sep 17 00:00:00 2001 From: liuxiao Date: Sun, 4 Jun 2023 01:03:34 +0800 Subject: [PATCH 8/8] fix --- content/cn/docs/clients/restful-api/vertex.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/content/cn/docs/clients/restful-api/vertex.md b/content/cn/docs/clients/restful-api/vertex.md index 6cc8dd98e..4b8a2f79b 100644 --- a/content/cn/docs/clients/restful-api/vertex.md +++ b/content/cn/docs/clients/restful-api/vertex.md @@ -310,12 +310,12 @@ PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch 结果分析如下: -- lang 属性值未指定更新策略,直接用新值覆盖旧值,无论新值是否为null; -- price 属性值指定 BIGGER 的更新策略,旧属性值为328,新属性值为299,所以仍然保留了旧属性值328; -- age 属性值指定 OVERRIDE 更新策略,而新属性值中未传入age,相当于age为null,所以仍然保留了原属性值32; -- city 属性值也指定了 OVERRIDE 更新策略,且新属性值不为null,所以覆盖了旧值; -- weight 属性值指定了 SUM 更新策略,旧属性值为0.1,新属性值为0.2,最后的值为0.3; -- hobby 属性值(基数为Set)指定了 UNION 更新策略,所以新值与旧值取了并集; +- lang 属性未指定更新策略,直接用新值覆盖旧值,无论新值是否为null; +- price 属性指定 BIGGER 的更新策略,旧属性值为328,新属性值为299,所以仍然保留了旧属性值328; +- age 属性指定 OVERRIDE 更新策略,而新属性值中未传入age,相当于age为null,所以仍然保留了原属性值32; +- city 属性也指定了 OVERRIDE 更新策略,且新属性值不为null,所以覆盖了旧值; +- weight 属性指定了 SUM 更新策略,旧属性值为0.1,新属性值为0.2,最后的值为0.3; +- hobby 属性(基数为Set)指定了 UNION 更新策略,所以新值与旧值取了并集; 其他更新策略的使用方式与此类似,此处不再详述。