Graph Data Formats
Before importing graph data, familiarize yourself with the graph data formats supported by GES.
- GES supports the loading of raw graph data in the standard CSV format. If your raw data is not in the specified format, convert it to the format supported by GES.
- GES graph data consists of the vertex, edge, and metadata files.
- Vertex files store vertex data.
- Edge files store edge data.
- Metadata is used to describe the formats of data in vertex and edge files.
Concept Description
Graph data is imported based on the property graph model in GES, so you must learn the concept of the property graph.
A property graph is a directed graph consisting of vertices, edges, labels, and properties.
- A vertex is also called a node, and an edge is also called a relationship. Nodes and relationships are the most important entities.
- The metadata is used to describe vertex and edge properties. The metadata consists of multiple labels and each label consists of one or more properties.
- Vertices with the same label belong to a group or a set.
- Each vertex or edge can have only one label.
In the following example, the graph data consists of three vertices and three edges. Vivian, Eric, and Lethal Weapon indicate vertices. (Vivian, Eric), (Vivian, Lethal Weapon), and (Eric, Lethal Weapon) indicate edges. user and movie indicate the vertex types (labels), and rate and friends indicate the relationship types (labels).
Metadata
The GES metadata is a file in XML format and is used to define vertex and edge properties.
It contains labels and properties.
- Label
A label is a collection of properties. It describes all property data formats contained within a vertex or an edge.
If the same Property Name is defined in different labels, the Cardinality and Data Type in different labels must be the same.
- Property
A property refers to the data format of a single property and contains three fields.
- Property Name: Indicates the name of a property. It contains 1 to 256 characters and cannot contain special characters such as angle brackets (<>) and ampersands (&).
A label cannot contain two properties with the same name.
- cardinality: Indicates the composite type of data. Possible values are single, list, and set.
- single indicates that the data of this property has a single value, such as a digit or a character string.
If the value of a single property in a data file is value1;value2, value1;value2 is regarded as a single value.
- list and set indicate that data of this property consists of multiple values separated by semicolons (;).
- list: The values are placed in sequence and can be repeated. For example, 1;1;1 contains three values.
- set: The values are in random sequence and must be unique. Duplicate values will be overwritten. For example, 1;1;1 contains only one value (1).
list and set do not support the char array data type.
- single indicates that the data of this property has a single value, such as a digit or a character string.
- Data Type: Indicates the data type. The following table lists the data types supported by GES.
Table 1 Supported data types Type
Description
char
Character
char array
Fixed-length character string (The maximum length must be specified.)
NOTE:- Only single supports the data type.
- If the data is a character string, you are advised to set this parameter to char array. If it is set to string, the import is slower.
float
Float type (32-bit float)
double
Double float type (64-bit float)
bool
bool type. Possible values are (0/1) and (true/false).
long
Long integer (value range: -2^63 to 2^63-1)
int
Integer (value range: -2^31 to 2^31-1)
date
Date. Currently, the following formats are supported:
- YYYY-MM-DD HH:MM:SS
- YYYY-MM-DD
NOTE:The value of MM or DD must consist of two digits. If the day or month number contains only one digit, add 0 before it, for example, 05/01.
enum
Enumeration (you need to specify the number of enumeration types and each enumeration value). For details, see Figure 2.
string
Variable character string
NOTE:The string length is not fixed, which affects data import efficiency. You are advised to use char array instead.
You can define the length of char array based on service requirements. It is recommended that the length be less than or equal to 32 characters.
- Property Name: Indicates the name of a property. It contains 1 to 256 characters and cannot contain special characters such as angle brackets (<>) and ampersands (&).
The following figure shows the metadata example:
Vertex Files
A vertex file contains the data of each vertex. A vertex of data is generated for each behavior. The following shows the format. id is the unique identifier of a set of vertex data.
id, label, property 1, property 2, property 3,...
- The vertex ID cannot contain hyphens (-).
- You do not need to set the vertex ID type. Its default value is string.
Example:
Lethal Weapon, movie, Lethal Weapon, 1987, Action; Comedy; Crime; Drama Vivian, user, Vivian, F, 25-34, artist, 98133 Eric, user, Eric, M, 18-24, college/grad student, 40205
Edge Files
An edge file contains the data of each edge. An edge of data is generated for each behavior. Graph specifications in GES are defined based on the edge quantity, for example, one million edges. The following shows the format. id 1 and id 2 are the IDs of the two endpoints of an edge.
id 1, id 2, label, property 1, property 2,...
Example:
Vivian,Lethal Weapon,rate,5,2000-12-27 23:44:41 Eric,Lethal Weapon,rate,4,2000-11-21 15:33:18 Vivian,Eric,friends
Last Article: Introduction to GES Management Console
Next Article: Overview

Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.