Repeat-query API
Function
This API is used to cyclically perform traversal query based on certain exit conditions.
For example, the Gremlin statement is as follows:
g.V('a','b').repeat(out('c')).times(2).emit().path() g.V('label_1').repeat(out('label_2')).emit()
URL
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
graph_name |
Yes |
String |
Graph name |
Request Parameters

The number of elements in each traversal cannot exceed 100 million.
Parameter description |
Mandatory |
Type |
Description |
---|---|---|---|
executionMode |
No |
String |
sync: synchronous; async: asynchronous. The default value is async, indicating asynchronous mode. |
vertices |
Yes |
Array of Json |
List of IDs of source vertices to be queried |
edges |
No |
Array of Json |
List of edges to be queried. Either this parameter or vertices is selected. For details, see edges element formats. |
repeat |
Yes |
Array of Json |
Filter criteria for repeat queries. Each element in the array corresponds to a filter. For details about the format, see repeat element formats. |
until |
No |
Array of Json |
while/do looping mode. Stops traversing the filter condition list. Each element in the array corresponds to the condition to be terminated at each layer in the repeat. The filter type must be the same as that of each layer in the repeat. For example, the first layer is vertex_filter. For details about the format, see repeat element formats. |
times |
No |
Integer |
Maximum number of steps. The default value is 5 and the maximum value is 20. |
query_type |
No |
String |
Possible values are Default, SimpleSubgraph, SimpleEdges, and Path.
|
emit |
No |
Boolean |
Whether to return all elements. The default value is true. This parameter is available only when query_type is set to Default. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
source |
Yes |
String |
Source vertex ID |
target |
Yes |
String |
Target vertex ID |
index |
Yes |
String |
Indexes of edges in the source edge set |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
operator |
Yes |
String |
Query type. s are as follows: inV: ingress; outV: egress. bothV: ingress point. |
vertex_filter |
No |
Json String |
It takes effect on the vertex of the next hop. For details, see Table property_filter element format. |
edge_filter |
No |
Json String |
Indicates the edge between point-to-point vertices. For details, see Table property_filter element format. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
vertex_filter |
No |
Json String |
This parameter is optional when operator is set to inV, outV, or bothV. For details about the format, see property_filter element formats. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
leftvalue |
No |
String |
Left value of the string type. For details, see leftvalue element formats. |
properties |
Yes |
String |
Filter type. Possible values are = (equal to), != (not equal to), < (less than), <= (less than or equal to), > (greater than), >= (greater than or equal to), & (and), | (or), HAS/HASNOT (whether a property exists), and CONTAIN/NOTCONTAIN (whether the property value contains the right value). SUBSET: The right value is a subset of the attribute value. IN/NOTIN: Check whether the left value and right value overlap. PREFIX: The right value is the prefix of the left value. FUZZY: Fuzzy match. REGEX: Regular expression match. SUBSTRING: The right value is the substring of the left value. CISUBSTRING: The substring is case-insensitive. |
rightvalue |
Yes |
String |
Right value. For details about the format, see rightvalue element formats. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
label_name |
No |
String |
If label is used as the filter criterion, set this parameter to labelName and value of rightvalue to the label name. |
property_name |
No |
String |
If property is used as the filter criterion, set this parameter to the property name and value of rightvalue to the property value. |
ID |
No |
String |
If the vertex ID is filtered, this parameter is optional. |
property_filter |
No |
String |
If predicate is set to & or |, property_filter can be nested in leftvalue and rightvalue. |
degree |
No |
String |
Direction of vertex degree filtering statistics. This parameter is optional. The value can be both, in, or out. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
value |
Yes |
String |
If label is used as the filter criterion, the value is the label name. If property is used as the filter criterion, the value is the property name. |
property_filter |
No |
String |
If predicate is set to & or |, property_filter can be nested in leftvalue and rightvalue. |
predicate |
label_name |
id |
property_name |
Nested Filtering |
---|---|---|---|---|
& |
No |
No |
No |
Yes |
| |
No |
No |
No |
Yes |
HAS/HASNOT |
No |
No |
Yes |
No |
=/!=/</<=/>/>= |
Yes |
Yes |
Yes |
No |
Response Parameters
Parameter description |
Type |
Description |
---|---|---|
errorMessage |
String |
System prompt.
|
errorCode |
String |
System prompt.
|
data |
Object |
Query results This parameter is left blank when the query fails. |
Parameter description |
Type |
Description |
---|---|---|
source |
String |
Source vertex ID |
target |
String |
Target vertex ID |
index |
String |
Edge index |
label |
String |
Edge label |
Example Request
POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=repeat-query { "executionMode": "async", "repeat": [ { "operator": "outV", "vertex_filter": { "property_filter": { "leftvalue": { "label_name": "labelName" }, "predicate": "=", "rightvalue": { "value": "rate" } } } } ], "until": [ { "vertex_filter": { "property_filter": { "leftvalue": { "property_name": "movieid" }, "predicate": "=", "rightvalue": { "value": "1" } } } } ], "emit": false, "vertices": [ "tr_10","tr_11" ] }

The preceding request is equivalent to the following Gremlin statement:
g.V('tr_10','tr_11').repeat(out().hasLabel('rate')).until(has('movieid','1')).dedup()
Example Response
Status code: 200
Example response for a successful request
{ "data":{ "edges":[ { "index":"1", "source":"tr_1", "label":"rate", "properties":{ "Rating":[ 0 ], "Datetime":[ "" ] }, "target":"tr_3" }, { "index":"199998", "source":"tr_1", "label":"rate", "properties":{ "Rating":[ 0 ], "Datetime":[ "" ] }, "target":"tr_200000" } ] } }
Status code: 400
Example response for a failed request
HttpStatusCode:400 { "errorMessage":"graph [tesdt_117] is not found", "errorCode":"GES.8806" }
Status Codes
Response Code |
Description |
---|---|
400 Bad Request |
Request error. |
401 Unauthorized |
Authorization failed. |
403 Forbidden |
No operation permissions. |
404 Not Found |
No resources found. |
500 Internal Server Error |
Internal server error. |
503 Service Unavailable |
Service unavailable. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot