Updated on 2023-08-04 GMT+08:00

Querying a Schema

Function

This API is used to query a generated schema (obtained from OBS).

URI

GET /ges/v1.0/{project_id}/graphs/{graph_name}/schema/structure?detail={details}
Table 1 URI parameters

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

details

No

String

Detailed information of the schema. The value can be SIMPLE or FULL. If you set this parameter to SIMPLE, only the labels of vertices or edges are returned. If you set it to FULL, the number of vertices or edges is returned in addition to the labels. If this parameter is left empty, the default value SIMPLE is used.

Response Parameters

Table 2 Response body parameters

Parameter

Type

Description

errorMessage

String

System prompt.

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

errorCode

String

System prompt code.

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

schema

Object

Schema structure. For details, see schema parameter description.

Table 3 schema parameter description

Parameter

Type

Description

vertices

String

Vertex result set. If the graph is empty, the return value is empty. For details, see vertices parameter description.

edges

String

Edge result set. If the graph is empty, the return value is empty. For details, see edges parameter description.

Table 4 vertices parameter description

Parameter

Type

Description

vertex

String

Label name

weight

String

Number of vertices that have the label

Table 5 edges parameter description

Parameter

Type

Description

source

String

Label the start vertex.

target

String

Label the end vertex.

relation

String

Relationship label

weight

String

Number of edges that have the label

Example Request

Query a generated schema (obtained from OBS).

GET http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/schema/structure?detail=SIMPLE

Example Response

Status code: 200

Example response for a successful request

{
    "schema": {
        "vertices": [
            {
                "vertex": "user",
                "weight": 100
            },
            {
                "vertex": "movie",
                "weight": 46
            }
        ],
        "edges": [
            {
                "weight": 1209,
                "source": "user",
                "target": "movie",
                "relation": "rate"
            },
            {
                "weight": 450,
                "source": "user",
                "target": "user",
                "relation": "default"
            }
        ]
    }
}

Status code: 400

Example response for a failed request

Http Status Code: 400
{
    "errorMessage": "Bad Request, parameter [detail] cannot be null.",
    "errorCode": "GES.8813"
}

Status Code

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.

Error Code

See Error Code.