Help Center/ Graph Engine Service/ API Reference (ME-Abu Dhabi Region)/ Service Plane APIs/ Updating Specified Properties of Vertices and Edges by Importing a File
Updated on 2022-02-22 GMT+08:00

Updating Specified Properties of Vertices and Edges by Importing a File

Function

This API is used to update specified properties of vertices and edges by importing a file.

To prevent failures in restoring the updated graph data during system restarting, do not delete the data stored on OBS when the graph is in use.

URL

  • URI format
    POST  /v1.0/{project_id}/graphs/{graph_name}/action?action_id=import-properties
  • Parameter description
    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

Request

  • Request example
    POST http://Endpoint/v1.0/{project_id}/graphs/{graph_name}/action?action_id=import-properties
    {
      "vertexsetPath": "datasets/movie/movie.csv",
      "vertexsetFormat": "csv",
      "vertexProperties": [
        {
          "label": "movie",
          "properties": [
            "genres"
          ]
        }
      ],  
      "edgesetPath": "datasets/movie/ranking_edge.csv",
      "edgesetFormat": "csv",
      "edgeProperties": [
        {
          "label": "rate",
          "properties": [
            "Datetime"
          ]
        }
      ],
      "targetProperties": [
        {
          "label": "rate",
          "properties": [
            "Rating"
          ]
        }
      ],
      "delimiter": ",",
      "trimQuote": "\"",
      "obsParameters": {
    	"accessKey": "XXXXXXX",
    	"secretKey": "XXXXXXX"
      }
      "vertexFileContainLabel":  true
    }
  • Parameter description

    The format of the CSV file for updating properties is as follows:

    • Vertex file (including label): vertex ID,label,property_1...property_n
    • Vertex file (excluding label): vertex ID,property_1...property_n
    • Edge file: source vertex ID, target vertex ID, label, edge ID, property_1...property_n
    Table 2 Request body parameter description

    Parameter

    Mandatory

    Type

    Description

    vertexsetPath

    Either vertexsetPath or edgesetPath is mandatory.

    String

    Vertex file directory or name

    vertexsetFormat

    No

    String

    Format of the vertex data set. Currently, only the CSV format is supported.

    The CSV format is used by default.

    vertexProperties

    Mandatory if vertexsetPath exists

    Json

    Label of a vertex and list of properties to be updated in a vertex file, in JSONArray format

    edgesetPath

    Either vertexsetPath or edgesetPath is mandatory.

    String

    Edge file directory or name

    edgesetFormat

    No

    String

    Format of the edge data set. Currently, only the CSV format is supported.

    The CSV format is used by default.

    edgeProperties

    Mandatory if edgesetPath exists

    Json

    Label of an edge and list of properties to be updated in an edge file, in JSONArray format

    targetProperties

    Mandatory if edgesetPath exists

    Json

    Indicates property information used to distinguish duplicate edges in the edge file, in JSONArray format.

    delimiter

    No

    Character

    Field separator in a CSV file. The default value is comma (,). The default element separator in a field of the list/set type is semicolon (;).

    trimQuote

    No

    Character

    Field quote character in a CSV file. The default value is double quotation marks ("). It is used to enclose a field if the field contains separators or line breaks.

    obsParameters

    Yes

    String

    OBS authentication parameters. For details, see Table 3.

    vertexFileContainLabel

    No

    Boolean

    Whether the vertex file contains label information. This parameter is optional. The default value is true.

    Table 3 vertexProperties parameter description

    Parameter

    Mandatory

    Type

    Description

    label

    Yes

    String

    Name of a label

    properties

    Yes

    Json

    Properties to be updated, in JSONArray format. The sequence of the properties must be the same as that in the vertex file.

    Table 4 edgeProperties parameter description

    Parameter

    Mandatory

    Type

    Description

    label

    Yes

    String

    Name of a label

    properties

    Yes

    Json

    Properties to be updated, in JSONArray format. The sequence of the properties must be the same as that in the edge file.

    Table 5 targetProperties parameter description

    Parameter

    Mandatory

    Type

    Description

    label

    Yes

    String

    Name of a label

    properties

    Yes

    Json

    Edge ID properties, in JSONArray format. Currently, only one property is supported.

Response

  • Parameter description
    Table 6 Parameter description

    Parameter

    Mandatory

    Type

    Description

    errorMessage

    No

    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

    No

    String

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

    job_id

    No

    String

    ID of an asynchronous job

    NOTE:

    You can view the job execution status and obtain the return result by querying the job ID. For details, see Job Management APIs.

  • Response example (successful request)
    Http Status Code: 200
    {
      "jobId": "b4f2e9a0-0439-4edd-a3ad-199bb523b613"
    }
  • Response example (failed request)
    Http Status Code: 400
    {
      "errorMessage": "parameter format error",
      "errorCode": "GES.8013"
    }

Return Value

  • Normal

    200

  • Abnormal
    Table 7 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

    The requested resource was not found.

    500 Internal Server Error

    Internal service error.

    503 Service Unavailable

    Service unavailable.