This page introduces statements for managing properties in a graph.
Showing Properties
To retrieve properties of the node schema User
in the current graph:
SHOW NODE User PROPERTY
To retrieve properties of the edge schema Joins
in the current graph:
SHOW EDGE Joins PROPERTY
The information about properties is organized into different tables:
- Node properties: Stored in
_nodeProperty
(all properties) and_nodeProperty_shard_<id>
(properties with data stored in shard<id>
). - Edge properties: Stored in
_edgeProperty
(all properties) and_edgeProperty_shard_<id>
(properties with data stored in shard<id>
).
Ultipa Manager has been configured to display only the
_nodeProperty
and_edgeProperty
tables.
Each table includes the following fields:
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 ALTER NODE
or ALTER EDGE
statement can be used to add properties to one or all node or edge schemas in the current graph.
<add property statement> ::=
"ALTER" < "NODE" | "EDGE" > { <schema name> | "*" } "ADD PROPERTY" <property types>
<property types> ::=
"{" <property type> [ { "," <property type> }... ] "}"
<property type> ::=
<property name> <property value type> [ <property description> ]
Details
- You can specify a
<schema name>
or use*
to specify all node or edge schemas. - Each property is defined by the following:
- Property name. See naming conventions.
- Property value type. See all property value types.
- Property description (Optional): Description of the property.
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(10,5)}
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}
Renaming Properties
The ALTER NODE
or ALTER EDGE
statement can be used to rename a property associated with a node or edge schema in the current graph.
To rename the property name
to username
for User
nodes in the current graph:
ALTER NODE User name RENAME TO username
To rename the property createdOn
to startDate
for Follows
edges in the current graph:
ALTER EDGE Follows createdOn RENAME TO startDate
Altering Schema Descriptions
The ALTER NODE
or ALTER EDGE
statement can be used to alter the description of a property associated with a node or edge schema in the current graph.
To update the description for the name
property of User
nodes in the current graph:
ALTER NODE User name COMMENT "Contains 5 to 64 characters"
To update the description for the createdOn
property of Follows
edges in the current graph:
ALTER EDGE Follows createdOn COMMENT "When the relationship is established"
Dropping Properties
The ALTER NODE
or ALTER EDGE
statement can be used to delete properties associated with one or all node or edge schemas in the current graph. When a property is dropped, all related data — including the property values and the associated indexes, full-text indexes, and any LTE-ed values held in memory — are removed.
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