NoSQL Zone is brought to you in partnership with:

Andreas Kollegger is a leading speaker and writer on graph databases and Neo4j and the bridge between community and developer efforts. He works actively in the community, speaking around the world and promoting the larger Neo4j ecosystem of projects. Author of Fair Trade Software, and the lead for Neo4j in the cloud, Andreas plays a valuable role for progressive happenings within Neo4j. Andreas is a DZone MVB and is not an employee of DZone and has posted 68 posts at DZone. You can read more from them at their website. View Full User Profile

Neo4j 1.8 Release - Fluent Graph Literacy

10.03.2012
| 4391 views |
  • submit to reddit

Available immediately, Neo4j 1.8 offers a delightful experience for reading and writing graph data with the simple expressiveness of the Cypher language. Whether you're just discovering the social power of Facebook's Open Graph or are building your own Knowledge Graph for Master Data Management, speaking in graph is easy with Cypher. It is the key to making sense of data with Neo4j.

Consider some everyday examples about books.

What to read?

Through a lovely summer of lounging around you've read through a stack of paperbacks. The starting academic season has you in a more serious mood, so you browse through the classics you never actually read in college wondering which is worth catching up on. You can narrow the list, but not decide. Generally, our friends make good recommendations since we tend to associate with similar-minded people. Ask them.
"Well, starting with me, go to each of my friends to check whether they liked Infinite Jest, On the Road, or The Right Stuff, then pick the most liked."
Cypher was conceived of as short-hand for answering questions just like that: a place to start, a "path" to traverse, then some values to peek at. The book recommendation could look like this:
START me= nodes:node_auto_index(name="Andreas")
MATCH (me)-[:knows]->(friends)-[r:likes]->(books) 
WHERE books.title in["Infinite Jest", "On the Road", "The Right Stuff"] 
RETURN books.title, count(r)

Reading carefully through that, you'll easily be able to decipher the meaning. The basics of reading data with Cypher compose nicely into larger, rich queries. Read even more over in Neo4j's online manual to learn the details.

Changing the story

Somehow, magically, information has to exist before you can ask for it. We like to say that Neo4j is whiteboard friendly — what you draw is what you store. With Cypher, data becomes normal sounding statements, particularly when compared to relational databases. I've got fairly nerdy friends, yet none of them declare that they have a foreign key relationship with ISBN 0316066524. They pretty much just say they like "Infinite Jest."
To create data about myself, my friend Heather, a book, our friendship and her appreciation of the book:
CREATE (me {name:"Andreas"}), (heather {name:"Heather Yorkston"}),
(jest {title:"Infinite Jest"}),
(me)-[:knows]->(heather), (heather)-[:likes]->(jest)

We could keep track of how much people liked a particular book by adding a star rating, like so:

start heather=nodes:node_auto_index(name='Heather Yorkston')
match (heather)-[r:likes]->(book) where book.title="Infinite Jest"
SET r.rating=5

If Heather tells me that she has never even read the book, we can remove the "liked" like this:

start heather=nodes:node_auto_index(name='Heather Yorkston')
match (heather)-[r:likes]->(book) where book.title="Infinite Jest"
DELETE r

That's a small sample of how Cypher performs basic database operations: creating, reading, updating and deleting. There's much more to delve into. Get comfy, then read up on Cypher in Neo4j's online manual.

Fine Print

This release of Neo4j includes the following highlights:
  • Zero-downtime rolling upgrades in HA clusters, for nicer administrative ops
  • Streamed responses to REST API requests, for faster remote access
  • Bi-directional traversals, branch state and path expanders in the traversal framework, for even faster queries
  • Support in the Cypher language for writing graph data and updating auto-indexes, see above ;)
  • Support for explicit transactions in neo4j-shell, on the command line and through the web
For a full summary of changes in this release, please review the CHANGES.TXT, which is also included in the download. Even better, join me for a live webinar to review all the latest features of Neo4j 1.8.

Upgrading

As an incremental service release, Neo4j 1.8 builds upon the previous 1.6 and 1.7 releases, with full backward compatibility. It does not require any explicit upgrade to persistent stores created using Neo4j 1.6 and 1.7 installations. Please see the deployment section of the manual for more detail, including instructions for upgrading installations running Neo4j versions released before 1.6.

Get Neo4j 1.8

Neo4j 1.8 is available for:

Really, I do hope you join us at GraphConnect in November. It will be a great time and I'd love to chat with you in person about the joy of graphs.

Always,
Andreas

 

 

 

Published at DZone with permission of Andreas Kollegger, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags: