UltipaDocs
Try Playground
  • Introduction
  • Terminologies
    • Graphset
    • Schema
    • Property
    • Constraints
    • Insert
    • Overwrite or Insert
    • Upsert
    • Update
    • Delete
    • Find Nodes
    • Find Edges
      • AB
      • Autonet
      • Spread
      • Path Template
      • K-Hop
      • K-Hop Template
    • GROUP BY
    • ORDER BY
    • SKIP
    • LIMIT
    • WHERE
    • RETURN
    • WITH
    • UNCOLLECT
    • UNION
    • UNION ALL
    • CALL
    • All Functions
    • Path Functions
    • Aggregate Functions
    • Mathematical Functions
    • Trigonometric Functions
    • String Functions
    • List Functions
    • Datetime Functions
    • Spatial Functions
    • Table Functions
    • Null Functions
    • Type Conversion Functions
  • Operators
  • Expressions
    • Index
    • Full-text Index
    • Vector Index
    • Cache
    • Overview
    • Managing HDC Graphs
    • HDC Graph Queries
    • Process
    • Job
    • Execution Plan
    • Alias
    • Filter
    • Values and Types
    • Data Flow in Queries
    • Comments
    • Reserved Words
  • Access Control
  1. Docs
  2. /
  3. UQL
  4. /
  5. Graph Management

Property

Overview

Properties are linked to a node or edge schema to define the attributes of the corresponding nodes or edges. For example, a node schema card may have properties balance and openedDate, while an edge schema transfers may have properties amount and time.

In UQL, the operator . is used to extract a property from a schema. The expression @<schema>.<property> specifies a certain property of a schema, such as @company.name.

System Property

Each node has two system properties serving as unique identifiers: _id and _uuid. The _id value can be manually assigned, ensuring distinct identification of nodes, while the _uuid value is always generated by the system.

System Property
Value Type
Description
_idstringA string-type (with a length of up to 128 bytes) unique identifier for a node.
_uuiduint64A numeric unique identifier for a node.

Each edge has only the _uuid as its unique identifier, which is also generated by the system. Each edge connects a source node to a destination node, its _from/_to and _from_uuid/_to_uuid identify its two end nodes.

System Property
Value Type
Description
_uuiduint64A numeric unique identifier for an edge.
_fromstringThe _id of the source node of an edge.
_tostringThe _id of the destination node of an edge.
_from_uuiduint64The _uuid of the source node of an edge.
_to_uuiduint64The _uuid of the destination node of an edge.

Showing Properties

To retrieve information about properties in current graphset:

UQL
// Shows all properties
show().property()

// Shows all node properties
show().node_property()

// Shows properties associated with a specified node schema
show().node_property(@card)

// Shows all edge properties
show().edge_property()

// Shows properties associated with a specified edge schema
show().edge_property(@transfers)

The information about properties is organized into different tables:

  • Node properties: Stored in _nodeProperty (all properties) and _nodeProperty_shard_N (properties with data in one shard) tables.
  • Edge properties: Stored in _edgeProperty (all properties) and _edgeProperty_shard_N (properties with data in one shard) tables.

Each table includes fields that provide essential details about each property:

Field
Description
nameThe property name.
typeThe property value type.
lteWhether the property is loaded to the shards' memory for query acceleration.
readWhether the current database user can read the property. 1 for true, 0 for false.
writeWhether the current database user can write the property. 1 for true, 0 for false.
schemaThe schema that the property is associated with.
descriptionThe description given to the property.
encryptThe encryption method used for the property.

Creating Properties

You can create one or more properties using a single create() statement. Each property is specified by chaining a node_property() or edge_property() method. To encrypt a property, use the encrypt() method.

Syntax
create()
  .node_property(<schema>, "<propName>", <propValueType?>, "<propDesc?>").encrypt("<encMeth?>")
  .edge_property(<schema>, "<propName>", <propValueType?>, "<propDesc?>").encrypt("<encMeth?>")
  ...
MethodParamDescription
node_property() or edge_property()<schema>Specifies the node or edge schema (e.g., @user); @* denotes all node or edge schemas.
<propName>Property name. Naming conventions are:
  • 2 to 127 characters.
  • Cannot start with an underscore(_) or a tilde (~).
  • Cannot contain backticks (`) or the name of any system properties, system table aliases and system aliases (refer to Reserved Keywords).
Property names must be unique among a schema.
<propValueType?>Optional. Property value type. When it is omitted, string is used by default. See all supported property value types. Note that the type cannot be modified after the property is created.
<propDesc?>Optional. Description of the property.
encrypt()<encMeth?>Optional. Encrypts property values using one of the supported encryption methods: AES128 (default), AES256, RSA and ECC.

Integral Properties

The supported integral property value types include int32, uint32, int64 and uint64.

UQL
create().node_property(@user, "age", uint32)

Decimal Properties

The supported decimal property value types include float, double, and decimal.

UQL
create()
  .edge_property(@links, "distance", float)
  .edge_property(@links, "weight",  "decimal(25,10)", "Weight of the relation")

The decimal(25,10) specifies a decimal type with a precision of 25 (total digits, excluding the decimal point) and a scale of 10 (digits after the decimal point). You may set the precision between 1 to 65, and the scale between 0 to 30. Specifically, decimal(<precision>, <scale>) must be declared within quotes.

Textual Properties

The supported textual property value types include string and text, with string set as the default type. When defining a property as string, you can omit specifying the type during creation.

UQL
create()
  .node_property(@post, "title")
  .node_property(@post, "content", text)

Temporal Properties

The supported temporal property value types include date, local datetime, local time, zoned datetime, zoned time, timestamp, datetime, duration(year to month), and duration(day to second).

UQL
create()
  .node_property(@post, "createdOn", "local datetime", "When the post is created")
  .node_property(@post, "visibilityPeriod", "duration(year to month)", "When the post is published")

Boolean Properties

The supported boolean property value type is bool.

UQL
create().node_property(@city, "isCapital", bool, "Indicates whether it is the capital city")

Spatial Properties

The supported spatial property value types are point and point3d.

UQL
create().node_property(@city, "position", point, "Location of the city")

Record Properties

The supported record property value type is record.

UQL
create().node_property(@product, "specs", record, "Specifications such as weight, color and warranty")

Binary Properties

The supported binary property value type is blob.

UQL
create().node_property(@user, "avatar", blob, "Avatar image file")

List Properties

The supported list property value type is <subtype>[]. Supports all of the above types as subtypes, except for bool.

UQL
create().node_property(@user, "interests", "string[]", "user interest tags")

Set Properties

The supported set property value type is set(<subtype>). Supports all of the above types as subtypes, except for bool.

UQL
create()
  .node_property(@user, "heights", "set(float)", "Store user heights history as a set")

Creating a Property for All Schemas

To create the property time for all edge schemas:

UQL
create().edge_property(@*, "time", datetime)

Encrypting a Property

To create the property password and encrypt it using AES256:

UQL
create().node_property(@user, "password", string).encrypt("AES256")

Altering Name and Description

You can modify the name and description of a property using the alter().node_property().set() or alter().edge_property().set() statement.

In the node_property() or edge_property() method, you can specify a particular property in the form of @<schema>.<property>, or target all properties with the same name in the form of @*.<property>.

To alter both name and description of the node property @user.name:

UQL
alter().node_property(@user.name).set({name: "Name", description: "Full name"})

To alter name of all the edge properties time:

UQL
alter().edge_property(@*.time).set({name: "createdOn"})

Dropping Properties

You can drop one or more properties using a single drop() statement. Each property is specified by chaining a node_property() or edge_property() method. When a property is dropped, all related data — including the property values, associated indexes, full-text indexes, and any LTE-ed values held in memory — are removed.

In the node_property() or edge_property() method, you can specify a particular property in the form of @<schema>.<property>.

To drop the node property @user.name:

UQL
drop().node_property(@user.name)

To drop the edge property @links.time:

UQL
drop().edge_property(@links.time)

To drop multiple properties:

UQL
drop().node_property(@user.age).edge_property(@links.time)