更新时间:2023-07-19 gmt 08:00

点过滤查询(1.0.0)-凯发k8国际娱乐官网入口

功能介绍

查询满足过滤条件的顶点集合。

uri

post /ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?action_id=query
表1 路径参数

参数

是否必选

类型

说明

project_id

string

项目id。获取方法请参见。

graph_name

string

图名称。

请求参数

表2 body参数说明

参数

是否必选

类型

说明

labels

labels和vertexfilters两者必选其一

string

顶点类型过滤条件。

vertexfilters

labels和vertexfilters两者必选其一

object

过滤条件,按属性过滤,jsonarray格式字符串。

offset

integer

本次请求的起始位置。

limit

integer

每页资源数量的最大值,默认为10。

sorts

object

结果排序的属性,jsonarray格式字符。

表3 sorts参数说明

参数

是否必选

类型

说明

key

key和propertyname必选其一

string

可选值有id、label、property,分别表示对id、label和属性排序。

propertyname

key和propertyname必选其一

string

属性名称。

ordervalue

string

可选“incr”和“decr”,分别表示升序和降序,默认值“incr”。

表4 vertexfilters参数结构

参数

是否必选

类型

说明

propertyname

string

属性名称。

predicate

string

逻辑关系,可选值“=”、“<”、“>”、“<=”、“>=”、“range”、“has”“hasnot”、“full_text_match”、“full_text_prefix”、“full_text_wildcard”、“full_text_regexp”、“full_text_fuzzy”和 “full_text_combination”。

说明:

属性复合类型为list或者set时,逻辑关系仅支持has、hasnot。关于复合类型的介绍请参见。

values

string

属性的值。当predicate为full_text_combination时,values类型不是string,详见vertexfilters样例2以及说明。

type

string

过滤条件逻辑关系,可选值“and”和“or”,默认为“and”。

响应参数

表5 响应body参数

参数

类型

说明

errormessage

string

系统提示信息。

  • 执行成功时,字段可能为空。
  • 执行失败时,用于显示错误信息。

errorcode

string

系统提示信息。

  • 执行成功时,字段可能为空。
  • 执行失败时,用于显示错误码。

jobid

string

查询节点任务id。请求失败时字段为空。

说明:

可以查询jobid查看任务执行状态、获取返回结果,详情参考查询job状态(1.0.0)-业务面

jobtype

integer

任务类型。请求失败时,该字段为空。

请求示例

查询满足过滤条件的顶点集合,请求的起始位置为0,每页资源数量的最大值为2,用于过滤的属性条件为movie和user,用于过滤的属性名为age。

post https://{server_url}/ges/v1.0/{project_id}/graphs/{graph_name}/vertices/action?action_id=query  
{
   "offset":0,
   "limit":2,
   "labels": ["movies",
             "user"],
   "vertexfilters":[{
      "propertyname":"age",
      "predicate":"=", 
      "values":["18-24"]
      }
   ]
} 

server_url:图的访问地址,取值请参考。

vertexfilters样例1
[
 {
   "propertyname":"gender",
   "predicate":"=",
   "values":["f"]
 },
 {
   "propertyname":"age",
   "predicate":"range", 
   "values":["18-24","56 "],
   "type":"or"
 }
]
vertexfilters样例2(full_text_combination)
"vertexfilters": [
        {
            "propertyname": "propertyname",
            "predicate": "full_text_combination",
            "values": [
                {
                    "propertyname": "movieid",
                    "value": "0"
                },
                {
                    "propertyname": "title",
                    "value": "american"
                }
            ]
        }
    ]

当predicate为“full_text_match”、“full_text_prefix”、“full_text_wildcard”、“full_text_regexp”和“full_text_fuzzy”、“full_text_combination”时,vertexfilters列表中只能有一个元素,即不能有多层过滤并列存在。labels参数不可以同时出现。当predicate为“full_text_combination”时,最外层的propertyname直接设置为“propertyname”即可, values不再是简单的string类型列表,values的每个元素有“propertyname”和“value”两个成员。如果您想使用以上全文索引的能力,需要预先调用创建全文索引的api。

响应示例

状态码: 200

成功响应示例
http status code: 200
{
    "jobid": "03e774f5-29ea-4187-9508-5435f3892ead016886200",
    "jobtype": 1
}

状态码: 400

失败响应示例

http status code: 400
{
    "errormessage": "bad request, parameter labels and vertexfilters cannot all be null",
    "errorcode": "ges.8203"
}

状态码

返回值

说明

400 bad request

请求错误

401 unauthorized

鉴权失败

403 forbidden

没有操作权限

404 not found

找不到资源

500 internal server error

服务内部错误

503 service unavailable

服务不可用

错误码

请参见。

分享:
网站地图