Talk to me about how you use Neo4j. What projects are you working on?Conrad Taylor: Right now I’m creating a job site for a client – fashionfreelance.com – which will connect people looking for jobs with people looking to hire, all in the fashion industry.
At some point during the process, I got to a point where I had seemingly simple questions — related to email filtering, for example — that ended up being extremely difficult to answer. Do I send this email to this person? Yes or no. Did the freelancer receive this email? Yes or no. Did the employer received an email regarding this particular freelancer? Yes or no. This led to an SQL conundrum, and I knew there had to be an easier way.
I decided to gather and perform extensive queries that send out emails to employers and freelancers. The goal was to do something a bit more transactional. For example, when an employer posts a job, an email goes out to the freelancers and an employer receives an email with a list of eligible freelancers. That was the goal, but it didn’t happen that way. Now that we’ve found Neo4j, I’ve started to rethink how to build that type of email service.
Currently, I’m trying to build an email service that will extract the email handle rather than trying to re-write everything from Neo4j. Right now, our system is building some post requests in SQL, and we’re using Ruby on Rails as a framework.
The goal is to set up the microservice, which has an APIN point, with a backend Neo4j persistence engine. I’m also planning to use Neo4j as a recommendation engine so that we can recommend jobs to freelancers.
We’re also going to use Neo4j to make sure that job seekers and posters can see something within the website itself. I’m the only developer, so I’m trying to leverage a number of tools and technologies, and Neo4j seemed like a great fit. I had only generally heard about graph databases, but was blown away when I attended GraphConnect last year.
I thought, how did I miss this? Now I finally have the bandwidth to take on this type of challenge. It’s great that there are so many options in this system arena that allows you to choose the best option for your particular use case.
Why did you choose Neo4j? What made it stand out?Conrad: There are a number of reasons I chose Neo4j, including its flexibility, being able to perform efficient queries using Cypher, and being able to see a visualization of your query in the Neo4j Browser. That was huge for me.
At the end of the day, I realized that my problem was a graph. For example, I have a freelancer, and I want to ask questions in an email object such as “Did the freelancer see this email?” That’s one relationship. And an email could have several relationships to my freelancers, which I can now easily see. That was so much easier than looking at it from a relational database perspective.
What are some of the most interesting or surprising results you’ve seen from using Neo4j?Conrad: One of my biggest “Aha” moments was when I was looking at Cypher for the first time and understood some of the simpler queries without even knowing the language. I realized that I understood Cypher more than I ever understood SQL.
Cypher is succinct, I would say, if you’re looking at it from a functional programming language; it’s easier to get to the point of what you want to do instead of how you want to do it.
At some point in SQL, the query starts out being simple. But then you end up having to add one left outer JOIN, and then another left outer JOIN, and then subquery after subquery. But Cypher is just so much more succinct.
If you could take everything you know about Neo4j now and go back to the beginning of your project, is there anything you would do differently?Conrad: I definitely would have started with Neo4j. It would have made my life a lot easier. Right now there are a lot of places within the code base that have a number of JOIN tables without any information; they have these foreign key attributes which point to other tables.
Using the Neo4j Browser would have made testing these queries a lot easier because it’s such a dynamic tool. Neo4j is extremely flexible; if you start with something that doesn’t work, you can just iterate up on it. That was the big thing for me.
Anything else you’d like to add?Conrad: Right now, what I’m doing with the system is building microservices that have a well-defined focus in terms of what I want to do. One is email filtering and one is showing in-browser recommendations.
The nice thing is that I don’t necessarily have to change my existing code base to do either of these things, because this recommendation service is abstracted out from the current code base. For the most part I have a very good foundation.
And after I finish this particular project, I’ll feel confident recommending Neo4j for other projects. Because now I’m seeing graphs in a number of different places.