UltipaDocs
Products
Solutions
Resources
Company
Start Free Trial
UltipaDocs
Start Free Trial
  • Introduction
  • GQL vs Other Languages
    • Overview
    • Node and Edge Patterns
    • Path Patterns
    • Quantified Paths
    • Questioned Paths
    • Shortest Paths
    • Cheapest Paths
    • K-Hop Traversal
    • Graph Patterns
    • Overview
    • Open Graphs
    • Closed Graphs
    • Graph Types
    • Constraints
    • Projections
    • Storage Maintenance
    • Node and Edge IDs
    • INSERT
    • INSERT OVERWRITE
    • UPSERT
    • MERGE
    • SET
    • REMOVE
    • DELETE
    • FOREACH
    • LOAD CSV
    • Query Composition
    • Result Table and Visualization
    • MATCH
    • OPTIONAL MATCH
    • FILTER
    • LET
    • FOR
    • ORDER BY
    • LIMIT
    • SKIP
    • CALL
    • RETURN
    • Composite Query
    • NEXT
    • All Functions
    • Element Functions
    • Path Functions
    • Aggregate Functions
    • Mathematical Functions
    • Trigonometric Functions
    • String Functions
    • List Functions
    • Datetime Functions
    • Spatial Functions
    • Null Functions
    • Utility Functions
    • Type Conversion Functions
    • Table Functions
  • Operators
  • Predicates
    • Overview
    • CASE
    • LET Value Expression
    • Value Query Expression
    • Count Query Expression
    • List Expressions
    • Current Values
    • Index
    • Full-text Index
    • Vector Index
  • Transactions
  • Triggers
  • Query Management
  • Execution Plan
    • Variables
    • Values and Types
    • Comments
    • Reserved Words
    • Naming Conventions
    • Syntactic Notation
  • GQL Conformance
  1. Docs
  2. /
  3. ISO GQL
  4. /
  5. Functions

Element Functions

Example Graph

GQL
INSERT (p1:Paper {_id:'P1', title:'Efficient Graph Search', score:6, author:'Alex'}),
       (p2:Paper {_id:'P2', title:'Optimizing Queries', score:9, author:'Alex'}),
       (p3:Paper {_id:'P3', title:'Path Patterns', score:7, author:'Zack'}),
       (p1)-[:Cites {weight:2}]->(p2),
       (p2)-[:Cites {weight:1}]->(p3)

id()

Gets the unique identifier _id of a graph element. element_id() is a synonym.

NOTE

On an edge _id disabled graph (see Node and Edge IDs) edges have no user-visible _id, so id(e) raises an error.

Syntaxid(<elemVar>) or id(<elemVar>)
ArgumentsNameTypeDescription
<elemVar>NODE, EDGEElement variable reference
Return TypeSTRING
GQL
MATCH (n)-[e]->()
RETURN id(n), id(e)

Result:

id(n)id(e)
P252ade0a7-0247-4e68-bafb-32d2b2fbaa8b
P122b49ab0-95ab-4591-bfd9-ff5cc5f9c633

internal_id()

Returns the system-internal numeric identifier (the _uuid) of a node or edge as a decimal string.

NOTE

Unlike id() which can error on edges in an edge _id disabled graph, internal_id() always resolves. It's the function form of the built-in _uuid property and works on both edge _id enabled and disabled graphs.

Syntaxinternal_id(<elemVar>)
ArgumentsNameTypeDescription
<elemVar>NODE, EDGEElement variable reference.
Return TypeSTRING — the `_uuid` formatted as a decimal string. Returned as a string because the underlying value is a 64-bit unsigned integer that can exceed the signed-int range.
GQL
MATCH (n)-[e]->()
RETURN internal_id(n), internal_id(e)

Result:

internal_id(n)internal_id(e)
6672606546636786952
6672617541753069061

Equivalent property-form access:

GQL
MATCH (n)-[e]->()
RETURN n._uuid, e._uuid

labels()

Gets the labels of a graph element.

Syntaxlabels(<elemVar>)
ArgumentsNameTypeDescription
<elemVar>NODE, EDGEElement variable reference
Return TypeLIST<STRING>
GQL
MATCH (n)-[e]->()
RETURN labels(n), labels(e)

Result:

labels(n)labels(e)
["Paper"]["Cites"]
["Paper"]["Cites"]

type()

Gets the label of an edge. Equivalent to labels() for edges.

Syntaxtype(<edgeVar>)
ArgumentsNameTypeDescription
<edgeVar>EDGEEdge variable reference
Return TypeSTRING
GQL
MATCH ()-[e]->()
RETURN type(e)

Result:

type(e)
"Cites"
"Cites"

keys()

Returns the property names of a node, edge, or key names of a record.

Syntaxkeys(<expr>)
ArgumentsNameTypeDescription
<expr>NODE, EDGE, RECORDThe input expression
Return TypeLIST<STRING>
GQL
MATCH (n:Paper)
RETURN keys(n)

Result:

keys(n)
["score", "author", "title"]
["score", "author", "title"]
["score", "author", "title"]
GQL
LET myRecord = {x: 1, y: 3, z: 34}
RETURN keys(myRecord)

Result:

keys(myRecord)
["x", "y", "z"]

values()

Returns the property values of a node, edge, or values of a record.

Syntaxvalues(<expr>)
ArgumentsNameTypeDescription
<expr>NODE, EDGE, RECORDThe input expression
Return TypeLIST
GQL
LET myRecord = {x: 1, y: 3, z: 34}
RETURN values(myRecord)

Result:

values(myRecord)
[1, 3, 34]

properties()

Returns the properties of a node or edge as a record.

Syntaxproperties(<elemVar>)
ArgumentsNameTypeDescription
<elemVar>NODE, EDGEElement variable reference
Return TypeRECORD
GQL
MATCH (n:Paper)
RETURN properties(n)

Result:

properties(n)
{"score": 7, "author": "Zack", "title": "Path Patterns"}
{"score": 9, "author": "Alex", "title": "Optimizing Queries"}
{"score": 6, "author": "Alex", "title": "Efficient Graph Search"}

property_exists()

Checks whether a property exists on a node or edge.

Syntaxproperty_exists(<elemVar>, <propertyName>)
ArgumentsNameTypeDescription
<elemVar>NODE, EDGEElement variable reference
<propertyName>STRINGThe property name to check
Return TypeBOOL
GQL
MATCH (n:Paper)
RETURN n._id, property_exists(n, "score"), property_exists(n, "rating")

Result:

n._idproperty_exists(n, "score")property_exists(n, "rating")
P1truefalse
P2truefalse
P3truefalse