Database Reference
In-Depth Information
Here you'rechecking that the nodehasayear ofbirth property set, before usingit inmath-
ematical calculations
. Then you return the calculated average value
.
Note
To get the age of the user, you subtract the year of birth from the current year. We're using
this topic's publication year of 2014 in this example.
Let's now have a look at Cypher's built-in functions.
6.4.2. Functions
Cypher supports a number of functions that you can use to evaluate expressions in your
query. Let's look at some of them.
Cypher functions are used to access internal attributes of graph entities, such as node and
relationship IDs and relationship labels (types). In the count example, you've seen the
ID(node) function used to retrieve the internal ID of a given node. In addition, you can
use the TYPE(relationship) function to find the type for a relationship.
To demonstrate the use of the TYPE function, let's find an answer to the following ques-
tion: “How many relationships of each type start or finish at user John?” The following
snippet shows the required Cypher query:
Search WWH ::




Custom Search