id() returns the id of a vertex or edge.
Syntax:id(expression)
Returns:
An agtype integer
Arguments:
Considerations:
Query:
SELECT * FROM cypher('graph_name', $$ MATCH (a) RETURN id(a) $$) as (id agtype);
Results
start_id() returns the id of the vertex that is the starting vertex for the edge.
Syntax: start_id(expression)
Returns:
An agtype integer
Arguments:
Considerations:
Query:
SELECT * FROM cypher('graph_name', $$ MATCH ()-[e]->() RETURN start_id(e) $$) as (start_id agtype);
Results
end_id() returns the id of the vertex that is the ending vertex for the edge.
Syntax: end_id(expression)
Returns:
An agtype integer
Arguments:
Query:
SELECT * FROM cypher('graph_name', $$ MATCH ()-[e]->() RETURN end_id(e) $$) as (end_id agtype);
Results
type() returns the string representation of the edge type
Syntax: type(edge)
Returns:
An agtype string
Arguments:
Considerations:
Query:
SELECT * FROM cypher('graph_name', $$ MATCH ()-[e]->() RETURN type(e) $$) as (type agtype);
Results
Returns an agtype map containing all the properties of a vertex or edge. If the argument is already a map, it is returned unchanged.
Syntax: properties(expression)
Returns:
An agtype Map.
Arguments:
Considerations:
Query:
SELECT * FROM cypher('graph_name', $$ CREATE (p:Person {name: 'Stefan', city: 'Berlin'}) RETURN properties(p) $$) as (type agtype);
Results:
returns the first element in an agtype list.
Syntax: head(list)
Returns:
The type of the value returned will be that of the first element of the list.
Arguments:
Considerations:
Query
SELECT * FROM cypher('graph_name', $$ MATCH (a) WHERE a.name = 'Eskil' RETURN a.array, head(a.array) $$) as (lst agtype, lst_head agtype);
The first element in the list is returned.
Result:
returns the last element in an agtype list.
Syntax:last(list)
Returns:
The type of the value returned will be that of the last element of the list.
Arguments:
Considerations:
Query
SELECT * FROM cypher('graph_name', $$ MATCH (a) WHERE a.name = 'Eskil' RETURN a.array, last(a.array) $$) as (lst agtype, lst_tail agtype);
The first element in the list is returned.
Result:
length() returns the length of a path.
Syntax: length(path)
Returns:
An agtype Integer.
Arguments:
Considerations:length(null) returns null.
Query
SELECT * FROM cypher('graph_name', $$ MATCH p = (a)-[]->(b)-[]->(c) WHERE a.name = 'Alice' RETURN length(p) $$) as (length_of_path agtype);
The length of the path p is returned.
Results:
size() returns the length of a list.
Syntax:size(list)
Returns:
An agtype Integer.
Arguments:
Considerations:
Query
SELECT * FROM cypher('graph_name', $$ RETURN size(['Alice', 'Bob']) $$) as (size_of_list agtype);
The length of the path p is returned.
Results:
startNode() returns the start node of an edge.
Syntax:startNode(edge)
Returns:
A vertex.
Arguments:
Considerations:
Query
SELECT * FROM cypher('graph_name', $$ MATCH (x:Developer)-[r]-() RETURN startNode(r) $$) as (v agtype);
Result
endNode() returns the start node of an edge.
Syntax: endNode(edge)
Returns:
A vertex.
Arguments:
Considerations:
Query
SELECT * FROM cypher('graph_name', $$ MATCH (x:Developer)-[r]-() RETURN endNode(r) $$) as (v agtype);
Result
timestamp() returns the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.
Syntax:timestamp()
Returns:
An Agtype Integer.
Considerations:
Query
SELECT * FROM cypher('graph_name', $$ RETURN timestamp() $$) as (t agtype);
The time in milliseconds is returned.
Results:
toBoolean() converts a string value to a boolean value.
Syntax: toBoolean(expression)
Returns:
An agtype Boolean.
Arguments:
Considerations:
Query
SELECT * FROM cypher('graph_name', $$ RETURN toBoolean('TRUE'), toBoolean('not a boolean') $$) as (a_bool agtype, not_a_bool agtype);
Result:
toFloat() converts an integer or string value to a floating point number.
Syntax:toFloat(expression)
Returns:A Float.
Considerations:
Query
SELECT * FROM cypher('graph_name', $$ RETURN toFloat('11.5'), toFloat('not a number') $$) as (a_float agtype, not_a_float agtype);
Result:
toInteger() converts a floating point or string value to an integer value.
Syntax:toInteger(expression)
Returns:
An agtype Integer.
Arguments
Considerations:
Query
SELECT * FROM cypher('graph_name', $$ RETURN toInteger('42'), toInteger('not a number') $$) as (an_integer agtype, not_an_integer agtype);
Result:
coalesce() returns the first non-null value in the given list of expressions.
Syntax:coalesce(expression [, expression]*)
Returns:
The type of the value returned will be that of the first non-null expression.
Arguments:
Considerations:
Query
SELECT * FROM cypher('graph_name', $$ MATCH (a) WHERE a.name = 'Alice' RETURN coalesce(a.hairColor, a.eyes), a.hair_color, a.eyes $$) as (color agtype, hair_color agtype, eyes agtype);
Result