What news from AWS re:Invent last week will have the most impact on you?
Amazon Q, an AI chatbot for explaining how AWS works.
Super-fast S3 Express storage.
New Graviton 4 processor instances.
Emily Freeman leaving AWS.
I don't use AWS, so none of this will affect me.
Data / Software Development / Storage

Try a Neo4j Graph Database Right Here, Right Now

If you’ve got five minutes, you have time to interact with a fully functional graph database. Watch 60 years of database history become antiquated in about 6 seconds.
Dec 9th, 2022 8:51am by
Featued image for: Try a Neo4j Graph Database Right Here, Right Now
Feature image via Unsplash

What is it that a graph database enables you to accomplish that another type of database won’t? A Neo4j graph database lets you analyze, experiment with and accurately estimate the levels of relationship, influence and impact that elements of data (“nodes”) have on one another.

Put another way, a graph database is the right tool to use when the purpose of your inquiry is not just to recall the data you’ve already stored, which existing database structures do well enough. It’s to evaluate the depths, degrees and integrities of relationships within your data elements and point the way toward the solution you’re looking for.

A regular database is there to recall. A graph database is here to solve.

See It Now

In a special arrangement with The New Stack, Neo4j has set up a testbed for you to try using a fully prepopulated Neo4j AuraDB cloud-based, open source graph database engine. Your AuraDB console will open in a new tab, so you can read along here as you try things there. You don’t have to register or enter your name first. Though, we do hope you will register after you’ve discovered how Neo4j works and how it may play a problem-solving role in your organization that you may not have considered before. But first, we want you to use Neo4j to see what it does and how it works.

Click here to instantly put Neo4j AuraDB to work.

Now You See It

You may be familiar with using a database browser or console where you establish a connection with a database, enter SQL commands directly into a command line and see the results in a scrollable window. The Neo4j tool on the Test Drive page, conceptually speaking, isn’t all that different. Of course, right now it’s tailored for use with any of three sets of preimported sample data. The full cloud-based Neo4j AuraDB engine uses a full-scale browser of its own.

Here’s what you’re looking at: StackOverflow, as you may know, publishes its complete, up-to-date data on questions its users have fielded, and their responses, in portable data formats. It’s a huge database, so for the purposes of the Test Drive page, we extracted data around a set of 300 questions asked and answered about the Neo4j database.

The first test query you see when the Test Drive page opens is a statement written in the Cypher language, not SQL. A Cypher query asks Neo4j to reveal all the nodes (data entities represented in the graph by circles) whose relationships with other nodes match a pattern. This can be a very complex pattern, although it’s quite simple here. Cypher employs special characters to help you draw those patterns into the statements as though they were ASCII art.

Here’s this Cypher query up close:

As you know, the principal keyword in SQL for specifying data to be retrieved from a set is SELECT. Its Cypher counterpart is MATCH. Inside this MATCH statement, you can see where the parentheses ( ) enclose elements (nodes) that would be inside circles. Relationships in the graph are represented by arrows; those arrows are re-created here in Cypher, literally sticking through the names of properties.

Find Out Why and How

The purpose of every database is to group related information together so that it stays grouped. Every query retrieves the rest of the information in a group, or a record, when you supply it with part of the information from that group. A graph database is a subset of the database set. Not only does it store related data, but also why it’s related — the relationships. So when you query the database, you will see all the related data plus their relationships. And because those relationships were produced as a graph to begin with, the retrieved relationships may be displayed as a graph just as easily.

There are three key relationships in this data set: one representing a user asking a question, another representing a user receiving a response to a question and a third representing a user providing a response to a question. The Cypher statement declares three variables q, u and a to represent the three classes of nodes in this data set. And from the results mode buttons to the left of the results area, you can choose to see the results as a traditional list, or even in JSON.

But what we actually want here is a mapping of who asked what, and who responded. It’s through the visual projection of this data that we become fully informed. Picture in your mind the table produced by an SQL query that asks for q, u and a, all laid out in rows and columns. Now imagine the effort it would take for you to piece together the relationships between these three elements, and convey those relationships in a single model. You can’t really do it without a graph.

Now, you could invest in an add-on that re-interprets that product table in a graphical format, perhaps not unlike this graph. But if it’s the relationships you want from the beginning, then you could choose to use a graph database from the beginning and save yourself the headaches.

A graph database is not a relational database with a graph visualization tool mounted on top of it so it can spit out reports with circles and arrows that you paste into PowerPoints. It’s also not an add-on, attachment or accessory for the database you currently have. Rather, it’s a means of storing relationships between data elements, or nodes, along with the data. This way, your query can be focused on relationships, and you can make calculations and analyses based on relationships. A true graph database answers both how and why things are related to one another.

The first edit you might try is to copy the Cypher query from the results pane to the database prompt, and delete MATCH 10 from the end. Then using the controls on the lower right of the graph, zoom out to see the full graph for the complete data set of 300 entries.

Where from Here?

This is just a taste of the robust experience of using Neo4j with a complete set of data and analysis tools. You can take the next step without investing a single cent. You can register for AuraDB Free, set up a database in our fully managed cloud service and use the full Cypher language to create functions and analyses that you can incorporate into applications with the same languages you use now, including Python, Java and Node.js.

Here are some of the options open to you now:

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Pragma, The New Stack.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.