This page introduces statements for managing properties in a graph.
Showing Properties
The show property statement retrieves information about properties associated with a node schema or an edge schema of the current graph.
<show property statement> ::=
<show node property> | <show edge property>
<show node property> ::=
"SHOW NODE" <node schema name> "PROPERTY"
<show edge property> ::=
"SHOW EDGE" <edge schema name> "PROPERTY"
To retrieve properties of the node schema User
:
SHOW NODE User PROPERTY
To retrieve properties of the edge schema Joins
:
SHOW EDGE Joins PROPERTY
The information about properties is organized into different tables:
- Node properties: Stored in
_nodeProperty
(all properties) and_nodeProperty_shard_N
(properties with data in shardN
) tables. - Edge properties: Stored in
_edgeProperty
(all properties) and_edgeProperty_shard_N
(properties with data in shardN
) tables.
Each table includes fields that provide essential details about each property:
Field |
Description |
---|---|
name |
The property name. |
type |
The property value type. |
lte |
Whether the property is loaded to the shards' memory for query acceleration. |
read |
Whether the current database user can read the property. 1 for true, 0 for false. |
write |
Whether the current database user can write the property. 1 for true, 0 for false. |
schema |
The schema that the property is associated with. |
description |
The description given to the property. |
encrypt |
The encryption method used for the property. |
Adding Properties
The add property statement adds one or more properties to the current graph.
<add property statement> ::=
<add node property> | <add edge property>
<add node property> ::=
"ALTER NODE" { <node schema name> | "*" } "ADD PROPERTY" <property types>
<add edge property> ::=
"ALTER EDGE" { <edge schema name> | "*" } "ADD PROPERTY" <property types>
<property types> ::=
"{" <property type> [ { "," <property type> }... ] "}"
<property type> ::=
<property name> <property value type>
Details
- You can specify a
<node schema name>
or<edge schema name>
to associate the properties, or use*
to apply them to all node or edge schemas. - For each
<property type>
:- When specifying the
<property name>
, note naming conventions of properties. - See all supported property value types.
- When specifying the
Integral Properties
The supported integral property value types include int32
, uint32
, int64
and uint64
.
ALTER NODE user ADD PROPERTY {age uint32}
Decimal Properties
The supported decimal property value types include float
, double
, and decimal
.
ALTER EDGE links ADD PROPERTY {distance float, weight decimal}
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.
ALTER NODE post ADD PROPERTY {title string, content text}
Temporal Properties
The supported temporal property value types include datetime
and timestamp
.
ALTER NODE post ADD PROPERTY {createdOn timestamp, publishedOn datetime}
Boolean Properties
The supported boolean property value type is bool
.
ALTER NODE city ADD PROPERTY {isCapital bool}
Spatial Properties
The supported spatial property value type is point
.
ALTER NODE city ADD PROPERTY {position point}
List Properties
The list property value type includes sub types int32
, int64
, uint32
, uint64
, float
, double
, string
, text
, datetime
and timestamp
.
ALTER NODE user ADD PROPERTY {interests list<string>}
Creating Properties for All Schemas
To create the property time
for all edge schemas:
ALTER EDGE * ADD PROPERTY {time datetime}
Dropping Properties
The drop property statement drops properties from the current graph. 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.
<drop property statement> ::=
<drop node property> | <drop edge property>
<drop node property> ::=
"ALTER NODE" { <node schema name> | "*" } "DROP PROPERTY" <property name> [ { "," <property name> }... ]
<drop edge property> ::=
"ALTER EDGE" { <edge schema name> | "*" } "DROP PROPERTY" <property name> [ { "," <property name> }... ]
To drop the properties name
and age
from user
nodes:
ALTER NODE user DROP PROPERTY name, age
To drop the property time
from links
edges:
ALTER EDGE links DROP PROPERTY time
To drop the property location
from all nodes:
ALTER NODE * DROP PROPERTY location