Updated on 2025-03-05 GMT+08:00

Executing the DSL Algorithm

Function

This API is used to provide flexible and controllable DSLs to help users design and run algorithms at low costs. For details about the DSL algorithm, see DSL Syntax.

After the DSL algorithm is executed, you need to use the "Dumping HyG Algorithm Results" API to dump the DSL execution results to OBS.

URI

POST /ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=algorithm-query
Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which is used for resource isolation. For details about how to obtain the value, see Obtaining a Project ID.

graph_name

Yes

String

Graph name

Request Parameters

Table 2 Body parameter

Parameter

Mandatory

Type

Description

commands

Yes

String

Command executed by the custom operation. For details about the syntax, see the syntax introduction.

Response Parameters

Table 3 Response parameters

Parameter

Type

Description

errorMessage

String

System prompt

  • If the execution succeeds, this parameter may be left blank.
  • If the execution fails, this parameter is used to display the error message.

errorCode

String

System prompt code

  • If the execution succeeds, this parameter may be left blank.
  • If the execution fails, this parameter is used to display the error code.

data

Object

Query results. This parameter is left blank when the query fails.

Example Request

POST/ges/v1.0/{project_id}/graphs/{graph_name}/action?action_id=algorithm-query
 {
     "commands":"Match<Vertex> v(['1']); v.repeat(bothV()).limit(2); return v;"
 }

Example Response

  • Example response for a successful request

    Status code: 200

    OK
    {
         "data":{
             "vertices":[
                 {
                     "id":"1",
                     "label":"movie",
                     "properties":{
                         "genres":[
                             "Comedy"
                         ],
                         "movieid":[
                             1
                         ],
                         "title":[
                             "Airplane! (1980)"
                         ]
                     }
                 }
             ],
             "runtime":0.126476598
         }
     }
  • Example response for a failed request
    {  
         "errorCode":"GES.8814",
         "errorMessage":"Unsupported API."
     }

Return Value

  • Normal

    200

  • Abnormal
    Table 4 Description

    Return Value

    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.