Learn more about using Scala with Neo4j for user-defined procedures and APOC

[As community content, this post reflects the views and opinions of the particular author and does not necessarily reflect the official stance of Neo4j. This was originally posted on the Knoldus blog and was used with permission.]

Editor’s Note: For more information on the Scala driver for Neo4j – AnormCypher – check out our developer page here.

In my last blog post, Getting Started with Neo4j with Scala: An Introduction, we discussed about how to use Neo4j with Scala. Now we are going to take it one step further.

As you likely know from using a relational database (RDBMS), procedures provide the advantages of better performance, scalability, productivity, ease of use and security. In Neo4j, we can use APOC and user-defined procedures which provide the same advantages which we get from a relational database.

User-Defined Procedures

In some of my previous posts, we used user-defined procedures in a relational database which we store in the database and call from there whenever needed. In Neo4j, we also do the same thing. Here we create procedure method with the @Procedure annotation.

When we annotate with @Procedure, it takes any Cypher type as parameters and returns a stream of Data Transfer Objects (DTO).

When procedures write to the database, we should also use the @PerformWrites annotation. We should use user-defined procedures only for common tasks or for those tasks which you use more frequently, because we can’t create procedures for every single purpose.

Read the rest of this blog post on Scala for Neo4j by Anurag Srivastava on the Knoldus blog.

Want to learn more about graph databases and Neo4j? Click below to register for our online training class, Introduction to Graph Databases and master the world of graph technology.

Take the Course



About the Author

Anurag Srivastava , Software Consultant, Knóldus Software

Anurag Srivastava Image

Anurag Srivastava is a Software Consultant at Knoldus Software LLP in Uttar Pradesh, India.

Leave a Reply

Your email address will not be published. Required fields are marked *


Upcoming Event


Have a Graph Question?

Stack Overflow
Community Forums
Contact Us

Share your Graph Story?

Email us: content@neo4j.com