Planet Neo4j

Neo4j home | news | blog | Neo Technology

Neo4j Blog

FUN with FACEBOOK in NEO4J

Ever since Facebook promoted its “graph search” methodology, lots of people in our industry have been waking up to the fact that graphs are über-cool. Thanks to the powerful query possibilities, people like Facebook, Twitter, LinkedIn, and let us not forget, Google have been providing us with some of the most amazing technologies. Specifically, the power of the “social network” is tempting

by Rik Van Bruggen (noreply@blogger.com) at June 19, 2013 11:15 AM

Ian Robinson

Running the Graph Databases Book Examples

The current version of Neo4j has two different types of index: named indexes and automatic indexes. The Cypher query examples throughout the Graph Databases book use named indexes. In this query, for example, venue, city and author are named node indexes:

START theater=node:venue(name='Theatre Royal'), 
      newcastle=node:city(name='Newcastle'), 
      bard=node:author(lastname='Shakespeare')
MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater) 
      <-[:VENUE]-()-[:PERFORMANCE_OF]->()-[:PRODUCTION_OF]-> 
      (play)<-[:WROTE_PLAY]-(bard)
RETURN DISTINCT play.title AS play

There’s a problem, however: data created using a Cypher CREATE statement won’t be indexed in a named index. This has led to some confusion for anyone wanting to code along with the examples: if you use the CREATE statements as published, the query examples won’t work.

(You can find out more about Neo4j indexes in the documentation.)

If you want to code along with the examples, the easiest thing to do is create the data using Cypher and automatic indexes. You’ll need to modify the queries to use the automatic indexes, but the changes aren’t complicated.

Configure Automatic Indexes

The examples below show how to run the Shakespeare examples (pp.47-50) using automatic indexes.

Before you create any data, you’ll need to configure the automatic indexes. The approach you take will depend on whether you are running Neo4j in embedded or server mode.

Embedded mode

If running in embedded mode, configure the database at startup:

GraphDatabaseService graphDb = new GraphDatabaseFactory().
    newEmbeddedDatabaseBuilder( storeDirectory ).
    setConfig( GraphDatabaseSettings.node_keys_indexable, "name,lastname" ).
    setConfig( GraphDatabaseSettings.node_auto_indexing, "true" ).
    newGraphDatabase();

Server mode

If running in server mode and executing Cypher statements through the console or using the REST API, add the following to the conf/neo4j.properties file.

node_auto_indexing=true
node_keys_indexable=name,lastname

Modify the Queries

The Shakespeare queries should then be modified as follows. In each case we’ve replaced a named node index (e.g. node:author) with an automatic node index (node:node_auto_index).

p.47:

START theater=node:node_auto_index(name='Theatre Royal'), 
      newcastle=node:node_auto_index(name='Newcastle'), 
      bard=node:node_auto_index(lastname='Shakespeare')
MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)
      <-[:VENUE]-()-[:PERFORMANCE_OF]->()-[:PRODUCTION_OF]-> 
      (play)<-[:WROTE_PLAY]-(bard)
RETURN DISTINCT play.title AS play

p.48:

START theater=node:node_auto_index(name='Theatre Royal'),
      newcastle=node:node_auto_index(name='Newcastle'), 
      bard=node:node_auto_index(lastname='Shakespeare')
MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)
      <-[:VENUE]-()-[:PERFORMANCE_OF]->()-[:PRODUCTION_OF]-> 
      (play)<-[w:WROTE_PLAY]-(bard)
WHERE w.year > 1608
RETURN DISTINCT play.title AS play

p.49:

START theater=node:node_auto_index(name='Theatre Royal'), 
      newcastle=node:node_auto_index(name='Newcastle'), 
      bard=node:node_auto_index(lastname='Shakespeare')
MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)
      <-[:VENUE]-()-[p:PERFORMANCE_OF]->()-[:PRODUCTION_OF]-> 
      (play)<-[:WROTE_PLAY]-(bard)
RETURN play.title AS play, count(p) AS performance_count 
ORDER BY performance_count DESC

p.50:

START bard=node:node_auto_index(lastname='Shakespeare') 
MATCH (bard)-[w:WROTE_PLAY]->(play)
WITH play
ORDER BY w.year DESC
RETURN collect(play.title) AS plays

Download Working Examples

The code that we used to generate most of the examples for the book, including the use cases, can be found on my GitHub account.

by iansrobinson at June 11, 2013 11:59 AM

Neo4j Blog

Graphs for Bunnies

Over the past couple of months, I have been doing lots of "Intro to Graphs" talks across Europe. What started out as an idea in our London User Group, has now been a standard monthly introduction that has been extremely well attended. And that's not where it stops - many other people want to start doing these sessions as well in different cities. During these talks, lots of people have been

by Rik Van Bruggen (noreply@blogger.com) at June 10, 2013 05:19 PM

Neo4j Blog

New Milestone Release Neo4j 2.0.0-M03

The latest M03 milestone release of Neo4j 2.0 is as you expected all about improvements to Cypher. This blog post also discusses some changes made in the last milestone (M02) which we didn’t fully cover. MERGE Cypher now contains a MERGE clause which is pretty big: It will be replacing CREATE UNIQUE as it also takes indexes and labels into accounts and can even be used for single node

by Michael Hunger (noreply@blogger.com) at May 31, 2013 03:31 PM

Neo4j Blog

Graph Databases and Software Metrics & Analysis

This is the first in a series of blog posts that discuss the usage of a graph database like Neo4j to store, compute and visualize a variety of software metrics and other types of software analytics (method call hierarchies, transitive clojure, critical path analysis, volatility & code quality). Follow up posts by different contributors will be linked from this one. Everyone who works in software

by Michael Hunger (noreply@blogger.com) at May 24, 2013 01:16 PM

Neo4j Community Ecosystem Project Releases for 1.9.GA

In the wake of Tuesdays Neo4j 1.9 GA release, the Neo4j community released a number of dependent ecosystem projects for Neo4j 1.9 to the Neo4j Maven repository (m2.neo4j.org). Some of them follow a new versioning scheme. Here is the list for 1.9: Structr CMS and REST-Backend org.structr:structr-ui:0.7 (maven.structr.org) Neo4j Gremlin Plugin org.neo4j.server.plugin:gremlin-plugin:1.9 (in

by Michael Hunger (noreply@blogger.com) at May 24, 2013 12:17 AM

Neo4j Blog

Neo4j 1.9 General Availability Announcement!

After over a year of R&D, five milestone releases, and two release candidates, we are happy to release Neo4j 1.9 today! It is available for download effective immediately. And the latest source code is available, as always, on Github. The 1.9 release adds primarily three things: Auto-Clustering, which makes Neo4j Enterprise clustering more robust & easier to administer, with fewer moving

by Philip Rathle (noreply@blogger.com) at May 21, 2013 06:31 PM

New Incubator Project: Neo4j Mobile for Android v0.1!

During this busy week of Android hacking at Google I/O, we are pleased to announce an amazing new Community project, for all of those who have been yearning to run Neo4j on mobile: Neo4j Mobile for Android v0.1! This project is available today on GitHub: for hacking, experimenting, evolution, and use. As the 0.1 version number indicates, this is an incubation project. This means that it’s

by Philip Rathle (noreply@blogger.com) at May 21, 2013 05:39 PM

Neo4j Blog

Reloading my Beergraph - using an in-graph-alcohol-percentage-index

What happened before As  you may remember, I created a little beer graph some time ago to experiment and have fun with beer, and graphs. And yes, I have been having LOTS of fun with it - using it to explain graph concepts to lots of not-so-technical folks, like myself. Many people liked it, and even more people had some questions about it - started thinking in graphs, basically. Which is way

by Rik Van Bruggen (noreply@blogger.com) at May 18, 2013 08:24 AM

Neo4j Blog

Neo Technology and the LDBC project - an update

A bit has happened since I (Alex Averbuch) last updated you about progress in the LDBC (Linked Data Benchmark Council), and Neo’s part in it. So, without further ado and in no particular order, here’s what we’ve been doing... Second Technical User Community meeting Of high priority for the LDBC is getting industry input on benchmark development - benchmarks that are not interesting to

by Alex Averbuch (noreply@blogger.com) at May 13, 2013 02:17 PM

Neo4j Blog

Inserting data into Neo4j with Neo4j-Shell and Cypher

Alireza Rezaei Mahdiraji I am Alireza Rezaei Mahdiraji and I am a PhD student. My field or research is database systems. I am experimenting several databases to support large scale scientific and simulation data. Some of the datasets have an inherent graph structure which make graph databases a good choice for modeling and querying such data. I picked Neo4j for my modeling tasks

by Peter Neubauer (noreply@blogger.com) at May 08, 2013 04:43 PM

Neo4j Blog

Graph Cafe's starting in Belgium and Netherlands

Let's expand the Graph - with Beer I guess I can no longer keep it a secret: I really do like beer. And Graphs. So every opportunity I get I will try to talk about both. Try to shut me up - it won't work ;-) ... So that's why we are going to try something different in Belgium and The Netherlands, to get more and more people excited about Graphs - with beer. On the 11th and 12th of June,

by Rik Van Bruggen (noreply@blogger.com) at May 07, 2013 10:10 PM

Neo4j Blog

Nodes are people, too

Neo4j 2.0 will let you define sets of nodes within the graph Philip Rathle Senior Director of Products Update: 2.0.0-M02 is now available Today we are releasing Milestone Release Neo4j 2.0.0-M01 of the Neo4j 2.0 series which we expect to be generally available (GA) in the next couple months. This release is significant in that it is the first time since the inception of Neo4j

by Philip Rathle (noreply@blogger.com) at April 29, 2013 08:55 AM

Neo4j Blog

Data migration between MySQL and Neo4j

Luanne Misquitta, IDMission LLC Many organizations that are looking at modeling highly connected data to add business intelligence or analytical capabilities using Neo4j already have a database in place. Introducing a graph database into the mix does not have to be a disruptive process. As with any technology, understanding its place and contribution to the entire system is key to

by Peter Neubauer (noreply@blogger.com) at April 26, 2013 11:41 AM

Neo4j Blog

Gmail Email analysis with Neo4j - and spreadsheets

A bunch of different graphistas have pointed out to me in recent months that there is something funny about Graphs and email. Specifically, about graphs and email analysis. From my work in previous years at security companies, I know that Email Forensics is actually big business. Figuring out who emails whom, about what topics, with what frequency, at what times - is important. Especially when

by Rik Van Bruggen (noreply@blogger.com) at April 24, 2013 09:22 PM

Neo4j Blog

Neo4j goes Nasa Space Apps Challenge

Bonjour, namaste, aloha, hej! This past weekend, a team from Neo Technology participated in the NASA International Space Apps Challenge. Pernilla, Tobias, and Mattias from Neo Technology joined forces with our friend Hatim, who is an organizer of the Stockholm Neo4j meetup group. Together we joined the event in Gothenburg, and formed Team Awesome (team name was not where we spent our

by Pernilla Lindh (noreply@blogger.com) at April 22, 2013 05:18 PM

Neo4j Blog

Almost There: Neo4j 1.9-RC1!

Today is Leonhard Euler’s birthday, and we’re celebrating by announcing a first Release Candidate for Neo4j 1.9, now available for download! This release includes a number of incremental changes from the last Milestone (1.9-M05). This release candidate includes the last set of features we'd love our community to try out, as we prepare Neo4j 1.9 for General Availability (GA). Google is

by Philip Rathle (noreply@blogger.com) at April 15, 2013 10:54 PM

Heroku Addon News: New "Try" Plan Migration and Request for Feedback

We’ve been working to improve our architecture in our Heroku Add-on.  We’ve also been working on making it possible for you guys to migrate off of our deprecated Test plan, and onto our supported Try plan.  That’s taken longer than we thought, and we’ve learned a lot along the way. Now, it’s possible for you to upgrade to our Try plan. We’ve implemented feature toggles for this, and you’

by Peter Neubauer (noreply@blogger.com) at April 15, 2013 01:56 PM

Neo4j Blog

Neo4j.org 3.0 Launch

A new year, a new look - after gathering a lot of feedback for the launch of neo4j.org after GraphConnect last year we decided to invest more time and effort to make the site the main hub for information around Neo4j. Goals One major goal is to make it easier for you to get up and running with Neo4j. We hope to achieve this by providing everything in one place, from the download, set-up

by Michael Hunger (noreply@blogger.com) at March 20, 2013 11:11 AM

Neo4j Blog

Neo4j 1.9.M05 released - wrapping up

Hi all, We are very proud to announce the next milestone of the Neo4j 1.9 release cycle. This time, we have been trying to introduce as few big changes as possible and instead concentrate on things that make the production environment a more pleasant experience. That means Monitoring, Cypher profiling, Java7 and High Availability were the targets for this work. Let’s look at some of them:

by Michael Hunger (noreply@blogger.com) at March 06, 2013 07:54 PM