Updated on 2022-08-09 GMT+08:00

Querying Schema Structure

Function

This API is used to query the structure of the generated schema (obtained from OBS).

URI

  • URI format
    GET /ges/v1.0/{project_id}/graphs/{graph_name}/schema/structure/structure?detail={details}
  • Parameters
    Table 1 URI parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID, which is used for resource isolation. For details, see Obtaining a Project ID.

    graph_name

    Yes

    String

    Graph name

    details

    No

    String

    Detailed information of the schema structure. 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.

Request

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

Response

  • Parameters
    Table 2 property parameter description

    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. If execution succeeds, this parameter may be left blank. If execution fails, this parameter is used to display the error code.

    schema

    JSON

    Schema structure. For details, see schema parameter description.

    Table 3 schema parameter description

    Parameter

    Type

    Description

    vertices

    JSONArray

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

    edges

    JSONArray

    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

  • Response example (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"
                }
            ]
        }
    }
  • Response example (failed request)
    Http Status Code: 400
    {
        "errorMessage": "Bad Request, parameter [detail] cannot be null.",
        "errorCode": "GES.8813"
    }

Return Value

  • Normal

    200

  • Abnormal
    Table 6 Return code for failed requests

    Return Value

    Description

    400 Bad Request

    Request error.

    401 Unauthorized

    Authentication failed.

    403 Forbidden

    No operation permission.

    404 Not Found

    No resources found.

    500 Internal Server Error

    Internal service error.