Category Archives: Java

Changes in Direction with The Traversal API

We got an odd request in User Slack the other day. A user wanted to find paths between nodes where the direction of the relationships changes up to just one time. Cypher doesn’t have a good handle on the concept of Direction beyond specifying it on a path. APOC doesn’t seem to have a method to figure this one out either… but to be fair I may have missed it since there are hundreds of awesome stored procedures now. Regardless, lets go ahead and build it the “old school” way. Using the Traversal API… and just to be slick, we’ll use the Bidirectional Traverser.

Continue reading

Tagged , , , , , , , , ,

Faux Bitmap Indexes in Neo4j Part Two

Last time we introduced the problem of single model, multiple property search queries taking a bit of time in Neo4j. We saw that using composite indexes or using “additional” labels can help us in some situations but not all. I promised you a stored procedure to build fake bitmap indexes could help, so today we’re going to see how to build one.
Continue reading

Tagged , , , , , , , , ,

Faux Bitmap Indexes in Neo4j

If you’ve ever watched my talks about Neo4j, I tend to say we’re not very well optimized for Single Model queries where relationships aren’t considered. In fact, we’re kinda bad at it. Things got better when Composite Indexes were introduced, but we still have some limitations to deal with. Today we’re going to explore the issues and build our own faux “bitmap indexes” to get around this problem.
Continue reading

Tagged , , , , , , , , , , ,

Getting and Creating Likes with Neo4j

In the last blog post, we created the Schema of our application and that was pretty dry stuff. It doesn’t get much better yet, so feel free to go do something more useful with your time, but before you go let me ask you a question. Did you ever have someone you really liked, I’m talking about the kind of person you thought about constantly, who made your heart skip a beat. The kind of person you knew was “the one“. But…

Continue reading

Tagged , , , , , , , ,

Stored Procedures in Neo4j Are NOT Evil

Some of you may be too young to remember this, but writing your application logic in Stored Procedures was all the rage back in the day (PG devs you wouldn’t understand). That is mostly because they were typically written by consultants from IBM and Oracle that cost a fortune and told you to do it this way. Eventually people wised up and realized they (both) sucked and as all things in Software Development, the pendulum swung the other way and people started treating databases like dumb storage. A 15 year old blog post from Jeff Atwood lists some of the problems:

  1. Written in T-SQL/PL-SQL, not a real programming language.
  2. Cannot be debugged in the same IDE
  3. Little to no feedback when things go wrong
  4. Can’t pass objects.
  5. No idea what a proc is doing

Continue reading

Tagged , , , , , , ,

Graphs and Pyramids

Question: Do you want to get Rich?
I’ll answer for you: “Yes!”

Follow along with this blog series and if it doesn’t make you rich, you can go back to your youtube videos, you can go back to watching Tiger King on Netflix, you can go back to your crappy life. Let’s continue.

Question: Are you poor? dumb? ugly? do you make bad decisions?
I’ll answer for you: “Yes!”.

If you were not poor, you would be on a yacht in Ibiza and not reading my blog. If you were not dumb you would be doing whatever it is smart people do, I wouldn’t know but I’m pretty sure it’s not reading my blog. If you were not ugly you would be in Paris or Milan murdering the runway instead of reading my blog. If you didn’t make bad decisions you wouldn’t have decided to read my blog which just made you feel sad about your life. See where I’m going with this?

Continue reading

Tagged , , , , , , , , , ,

Updating your Neo4j 3.x Unmanaged Extensions to 4.x

Neo4j 4.0 has been out for a few months now, but since the whole world is on lock down, it didn’t get a chance to make a grand entrance at Graph Connect 2020. It comes loaded with some great new features but I’m not here to tell you about all that. There are plenty of better places for it. Instead I’m going to tell you about an old feature that got a bit of an update. Unmanaged Extensions. Yup, those things have been with us since dinosaurs roamed the earth and they are still in Neo4j 4.0. Why you ask? Because they let you turn Neo4j into an HTTP API style service making it super easy to integrate into your existing infrastructure. It’s still one of my favorite ways to build Neo4j applications because once you have the documentation of the API locked down, you can crank out the endpoints quickly and the service is done before you know it.

Continue reading

Tagged , , , , , , , , , ,

Building a Chat Bot in Neo4j Part 3

In part one, we learned to listen to our users, in part two we began learning how to talk back. Before we go any further in to the stored procedure, how about we build a little front end to show off the work we’ve done so far on this proof of concept? That will also make things easier to test out and let us get into the mindset of the user. There are a ton of options here, lots of folks like Spring and Spring Boot. Others are more hipsters and into Micronaut. I am even more of a hipster and prefer to use Jooby, but it doesn’t really matter. We’ll be using Cypher, the Neo4j Drivers and the Stored Procedures we build along the way so technically you can do this in just about any language.
Continue reading

Tagged , , , , , , , ,

Building a Chat Bot in Neo4j Part 2

In part one our this building a chatbot series, we figured out how to use OpenNLP to “hear” what a user is saying and figure out both their intent and any entities they may have mentioned. Today we’re going to learn how to use Neo4j to talk back… like an impudent child.

Continue reading

Tagged , , , , , , , , ,

Building a Chat Bot in Neo4j

Last year eBay built a chatbot using Neo4j. Unfortunately we have grown so big I didn’t get a chance to work on that project and kinda feel left out. So I decided I’m going to build my own chatbot with Neo4j. As usual I’ve never done this before, have very little idea what I’m doing, have no team, and have barely any time to get this done. So with those disclaimers out of the way, let’s see what we can do.
Continue reading

Tagged , , , , , , , ,