Using our algorithm from Cypher
This is the last step of plugin development: we are going to annotate our file so that Cypher knows what we are talking about, then build the JAR file and test it from Cypher.
Adding annotations
Before generating the JAR file, we need to annotate our PageRank
class so that we can configure how it can be used from Neo4j:
@PregelProcedure(name = "gdsbook.pr", modes = {GDSMode.STREAM, GDSMode.MUTATE, GDSMode.WRITE}) public class PageRank implements PregelComputation<PageRank.Config> { // rest of the code is unchanged ... }
Here, we specify two important parameters:
- The procedure’s name: This is the name of the procedure known by Cypher. In short, it means that we will be able to write the following:
CALL gdsbook.pr.<mode>(…) in Cypher
- The procedure’s modes: Here, we can choose one or many among the GDS modes (stream, mutate, write, and stats) that will be available.
- Optionally, we can...