October 2017
Beginner to intermediate
316 pages
8h
English
This is not rocket science, a function is just a method in a Java class. This method must be annotated with @UserFunction and @Description (both in the org.neo4j.procedure package).
To start, let's create a function that returns true if the given parameter is an odd number, and its even counterpart. The source code is as follows:
package learningneo4j;import org.neo4j.procedure.Description;import org.neo4j.procedure.Name;import org.neo4j.procedure.UserFunction;public class OddEven { @UserFunction @Description("Returns true if the given number is odd") public Boolean isOdd(@Name("number") Long number){ if(number!=null) return number%2==1; else return false; } @UserFunction @Description("Returns true if the given number ...
Read now
Unlock full access