imbajin commented on code in PR #276: URL: https://github.com/apache/incubator-hugegraph-doc/pull/276#discussion_r1241173574
########## content/cn/docs/clients/restful-api/edge.md: ########## @@ -323,72 +382,68 @@ PUT http://localhost:8080/graphs/hugegraph/graph/edges/S1:peter>1>>S2:lop?action } ``` -> 注意:这里会直接删除属性(删除key和所有value),无论其属性的取值是single、set或list。 +> 注意:这里会直接删除属性(删除 key 和所有 value),无论其属性的取值是 single、set 或 list ##### Response Status ```json -200 +400 ``` ##### Response Body +无法删除未设置为 nullable 的属性 + ```json { - "id": "S1:peter>1>>S2:lop", - "label": "created", - "type": "edge", - "inVLabel": "software", - "outVLabel": "person", - "inV": "2:lop", - "outV": "1:peter", - "properties": { - "date": "20170324" - } + "exception": "class java.lang.IllegalArgumentException", + "message": "Can't remove non-null edge property 'p[weight->1.0]'", + "cause": "" } ``` #### 2.2.6 获取符合条件的边 ##### Params -- vertex_id: 顶点id -- direction: 边的方向(OUT | IN | BOTH) -- label: 边的标签 -- properties: 属性键值对(根据属性查询的前提是预先建立了索引) -- offset:偏移,默认为0 -- limit: 查询数目,默认为100 -- page: 页号 - -支持的查询有以下几种: +**路径参数说明:** -- 提供vertex_id参数时,不可以使用参数page,direction、label、properties可选,offset和limit可以 -限制结果范围 -- 不提供vertex_id参数时,label和properties可选 - - 如果使用page参数,则:offset参数不可用(不填或者为0),direction不可用,properties最多只能有一个 - - 如果不使用page参数,则:offset和limit可以用来限制结果范围,direction参数忽略 +- graph:待操作的图 -属性键值对由JSON格式的属性名称和属性值组成,允许多个属性键值对作为查询条件,属性值支持精确匹配和范围匹配,精确匹配时形如`properties={"weight":0.8}`,范围匹配时形如`properties={"age":"P.gt(0.8)"}`,范围匹配支持的表达式如下: +**请求参数说明:** -| 表达式 | 说明 | -|------------------------------------|----------------------------| -| P.eq(number) | 属性值等于number的边 | -| P.neq(number) | 属性值不等于number的边 | -| P.lt(number) | 属性值小于number的边 | -| P.lte(number) | 属性值小于等于number的边 | -| P.gt(number) | 属性值大于number的边 | -| P.gte(number) | 属性值大于等于number的边 | -| P.between(number1,number2) | 属性值大于等于number1且小于number2的边 | -| P.inside(number1,number2) | 属性值大于number1且小于number2的边 | -| P.outside(number1,number2) | 属性值小于number1且大于number2的边 | -| P.within(value1,value2,value3,...) | 属性值等于任何一个给定value的边 | +- vertex_id: 顶点 id +- direction: 边的方向 (OUT | IN | BOTH),默认为 BOTH +- label: 边的标签 +- properties: 属性键值对 (根据属性查询的前提是预先建立了索引) +- keep_start_p: 是否支持范围匹配,默认为 false +- offset:偏移,默认为 0 +- limit: 查询数目,默认为 100 +- page: 页号 -**查询与顶点 person:josh(vertex_id="1:josh") 相连且 label 为 created 的边** +属性键值对由 JSON 格式的属性名称和属性值组成,允许多个属性键值对作为查询条件,属性值支持精确匹配和范围匹配,精确匹配时形如 `properties={"weight":0.8}`,范围匹配时形如 `properties={"age":"P.gt(0.8)"}`,范围匹配支持的表达式如下: + +| 表达式 | 说明 | +|------------------------------------|----------------------------------| +| P.eq(number) | 属性值等于 number 的边 | +| P.neq(number) | 属性值不等于 number 的边 | +| P.lt(number) | 属性值小于 number 的边 | +| P.lte(number) | 属性值小于等于 number 的边 | +| P.gt(number) | 属性值大于 number 的边 | +| P.gte(number) | 属性值大于等于 number 的边 | +| P.between(number1,number2) | 属性值大于等于 number1 且小于 number2 的边 | +| P.inside(number1,number2) | 属性值大于 number1 且小于 number2 的边 | +| P.outside(number1,number2) | 属性值小于 number1 且大于 number2 的边 | +| P.within(value1,value2,value3,...) | 属性值等于任何一个给定 value 的边 | +| P.textcontains(value) | 属性值包含给定 value 的边 (string 类型) | +| P.contains(value) | 属性值包含给定 value 的边 (collection 类型) | + +**查询与顶点 person:marko(vertex_id="1:marko") 相连且 label 为 knows 的边** ##### Method & Url ``` -GET http://127.0.0.1:8080/graphs/hugegraph/graph/edges?vertex_id="1:josh"&direction=BOTH&label=created&properties={} +GET http://127.0.0.1:8080/graphs/hugegraph/graph/edges?vertex_id="1:marko"&label=knows Review Comment: why we remove property condiment here? maybe we need provide a demo for users to refer ########## content/cn/docs/clients/restful-api/edge.md: ########## @@ -82,7 +124,17 @@ POST http://localhost:8080/graphs/hugegraph/graph/edges ##### Params -- check_vertex: 是否检查顶点存在(true | false),当设置为 true 而待插入边的源顶点或目标顶点不存在时会报错。 +**路径参数说明:** + +- graph:待操作的图 + +**请求参数说明:** + +- check_vertex:当设置为 true 而待插入边的源顶点或目标顶点不存在时会报错,默认为 true Review Comment: 似乎应该保留可选值 `true/false` 的语义说明, 因为用户不知道这是一个字符串还是 `bool` ########## content/cn/docs/clients/restful-api/edge.md: ########## @@ -6,32 +6,74 @@ weight: 8 ### 2.2 Edge -顶点 id 格式的修改也影响到了边的 Id 以及源顶点和目标顶点 id 的格式。 +顶点 id 格式的修改也影响到了边的 Id 以及源顶点和目标顶点 id 的格式 -EdgeId是由 `src-vertex-id + direction + label + sort-values + tgt-vertex-id` 拼接而成, -但是这里的顶点id类型不是通过引号区分的,而是根据前缀区分: +EdgeId 是由 `src-vertex-id + direction + label + sort-values + tgt-vertex-id` 拼接而成,但是这里的顶点 id 类型不是通过引号区分的,而是根据前缀区分: -- 当 id 类型为 number 时,EdgeId 的顶点 id 前有一个前缀`L` ,形如 "L123456>1>>L987654" -- 当 id 类型为 string 时,EdgeId 的顶点 id 前有一个前缀`S` ,形如 "S1:peter>1>>S2:lop" +- 当 id 类型为 number 时,EdgeId 的顶点 id 前有一个前缀 `L` ,形如 "L123456>1>>L987654" +- 当 id 类型为 string 时,EdgeId 的顶点 id 前有一个前缀 `S` ,形如 "S1:peter>1>>S2:lop" -------------------------------------------------------------------------------- -接下来的示例均假设已经创建好了前述的各种schema和vertex信息 +接下来的示例需要先根据以下 `groovy` 脚本创建图 `schema` Review Comment: 可以使用统一的测试用例导入, 但需要确保其他的 case 里是一致的为宜 @liuxiaocs7 你之前也是用的这个 dataset 么 -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
