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
    • Graph Patterns
    • Overview
    • Open Graph
    • Closed Graph
    • Constraints
    • Unique Identifiers
    • INSERT
    • INSERT OVERWRITE
    • SET
    • REMOVE
    • DELETE
    • 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
    • AI & Vector Functions
    • Database Functions
  • Operators
  • Predicates
  • Expressions
    • Index
    • Full-text Index
    • Vector Index
  • Transactions
  • Triggers
  • Query Management
  • Backup and Restore
    • Variables
    • Values and Types
    • Comments
    • Reserved Words
    • 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() / element_id()

Gets the unique identifier _id of a graph element.

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

Result:

element_idid
P2e:2
P1e:1

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:

labelslabels
["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
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
["score", "author", "title"]
["score", "author", "title"]
["score", "author", "title"]
GQL
LET myRecord = {x: 1, y: 3, z: 34}
RETURN keys(myRecord)

Result:

keys
["x", "y", "z"]

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
{"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_existsproperty_exists
P1truefalse
P2truefalse
P3truefalse