Friday, December 23, 2011

Neo4j - Community matters. You matter.


Peter Neubauer
Hi all graphistas,

Andreas Kollegger
a while back I wrote a mail, announcing that we are putting a lot of effort from Neo Technology into helping the Neo4j community to prosper. This is not just empty talk.

Michael Hunger
We're more than happy to announce that from now on a dedicated team (with mainly Peter, Andreas Kollegger and Michael Hunger contributing part of their time) will take care of you, the awesome Neo4j community and the Graph Database and NOSQL area at large. It has been taking off in 2011 and probably will do so in 2012 , so join the party!

Driving a startup that is relying on an Open Source Project is in our opinion the ultimate joy and challenge - we can pipe back the support from our customers (let's call you sponsors) into supporting the project in a scalable manner along with all the contributions from the community.

We want to take an organized and transparent approach to this, so for your information, we will work on a number of programs, most notably:


  • Community Contributors: Engage active contributors for stronger participation
  • Community Issues: Respond to community issues and bugs in timely manner
  • Community Response: Respond to discussions in all channels
  • Community Onboarding: Make learning, installing and using Neo4j easier
  • Community Mindshare: Engage in the broader NOSQL community


We are just getting started with it, so please bear with us. We'll start small and continually improve, revisit and iterate.

As one of the goals we want to make Neo4j more community friendly, especially for people just getting started with NOSQL / graph-databases and neo4j (but also for you, the power users). Please let us know in what areas you think it is currently too hard to get going with Neo4j, and what could be done to improve this (there is a comment section below ;).

We are also going to virtually hang out with all of you, starting once a week in a Neo4j Cuddle Room with whiteboard sharing, voice and audio/video. There we can show off cool stuff to each other, provide feedback on community projects and just hang out. Stay tuned for the exact day and time. Hope to see you there!

We really need you to help us to make this a global movement, and we are thrilled to see what is happening. If you feel you want to be part of this, please contact us and we will make sure to get you to improve your karma via Neo4j, Graphs and NOSQL code contributions, blog content and speaking engagements. And we have Cookies.

Thanks a lot for your time, and Happy New Year!

Peter, Andreas and Michael


Tuesday, December 20, 2011

Neo4j 1.6.M02 “Jörn Kniv”


We have another milestone for you - 1.6.M02. As I’ve written before, we’re heavily into improving our infrastructure - our build, stress testing etc. But we have more: Faster and better Cypher and open beta on Heroku!

Heroku Public Beta

Our private beta on Heroku was going along just fine. We were getting positive feedback, tweaking provisioning and monitoring, and starting to feel comfortable about stepping into the cloud. Then Peter Neubauer showcased a great demo last week on how to get up and running on Heroku with Neo4j, topping it off with a Google Spreadsheets front-end. This clever hackery was even featured in the Heroku December newsletter.

It seemed time to finally allow other people to join the fun. So, we’re pleased to announce that the Neo4j Add-on is now in public beta on Heroku.

With a verified account, creating a Neo4j application in the cloud can now be as simple as:
sudo gem install heroku
git clone git@github.com:neo4j-examples/heroku-neo4j-appscript-demo.git
cd heroku-neo4j-appscript-demo
heroku apps:create
heroku addons:add neo4j
git push heroku master
heroku open
curl -d"start n=node(0) return n" http://your-app-name.heroku.com/raw-cypher
heroku addons:open neo4j

If you no longer require it, please remove the heroku app with
heroku apps:destroy --app your-app-name --confirm your-app-name

Documentation on how to get started with the Heroku Neo4j Add-on can be found at the Heroku DevCenter. We’ll be posting additional guides for getting started on Heroku with Neo4j. Stay tuned.

Latest on Cypher

Most the work in Cypher for this milestone has been internal changes that are not immediately visible to an end user. The type system has been rebuilt and revamped, and a second, simpler, pattern matcher has been added. The first change makes the Cypher code base faster to work with, and the second makes your queries faster.

End user facing changes include: possibility to get all shortest paths, the COALESCE function, column aliasing, and the possibility for variable length relationships to introduce an iterable of the relationships.

Finally, there are two breaking changes - the syntax for the ALL/NONE/ANY/SINGLE predicates has changed, and the ExecutionResult is now a read-once, forward only iterable.

New to Cypher? Then you should watch this updated "Introduction to Cypher" screencast by Alistair Jones:


New on the web admin

I’m quite happy to announce that the web admin interface now supports Cypher calls directly in the data browser. It’s so sweet to be able to query your way around the node space! I luv it.
Moreover, Gremlin has been updated to version 1.4.

Breaking changes and deprecating

We’re introducing a new way to handle breaking changes. They will be flagged in the change logs as “BREAKING CHANGE.”
Where we do introduce a breaking change, we will continue to support the older functionality for 2 GA releases. This would typically be six months heads up and will allow you to adopt new GA releases quickly while giving plenty of time to develop against the new API. This policy applies to published and stable APIs, including Cypher.
In the same vein: We now have a deprecated feature. Cypher execution is now part of the core REST API, the cypher plugin is deprecated.
This policy does not cover third-party add-ons (like Gremlin from Tinkerpop) which have their own release strategy.

Bug fixes galore

This milestone has a slew of bug fixes incorporated. For more information please read more on the various “CHANGES.txt” files.

Go for it

Your feedback is of great value and we would love for you to join our community mailing list.

The Neo4j 1.6.M02 is ready - download now and get involved!

Björn Granvik et al
Director of Engineering @ Neo Technology

Sunday, December 18, 2011

Domain Modeling With Spring Data Neo4j

Spring Data Neo4j provides a powerful framework for building applications with simple POJO annotations.  In this blog post, Willie Wheeler explains domain modeling with Neo4j using Spring Data Neo4j.
Focusing on a Person entity (common in so many applications), Willie shows the annotations needed to map into Neo4j nodes and relationships. Then he introduces a repository to retrieve instances from the database, and a controller to expose it all to the web.

The standard looking class diagram is something like this:


Read on to appreciate the simplicity.

Friday, December 16, 2011

A “typical” week in the Neo4j Community


We were curious ourselves how much happens within a single week in our community. So we did the easy thing and just harvested our ingenious @neo4j twitter stream. And here is the result, we were just blown away, so much activity and so many people contributing, thanks a lot to all of you.

Google Groups

Heroku

Cloud

Tinkerpop

Neo4j.rb

Neo4jPHP

Neo4j-Python

Spring Data Neo4j

Vaadin

SparQL-Neo4j-Plugin

Neo4j-Cypher-Jdbc-Driver

Cool Stuff

Educational

Upcoming Community Events

Conferences

Jobs

  • @peterneubauer: Wanna work with Neo4j-related contracts in Germany next year? Contact me. #jobs #in

Graphistas-Map

All Graphistas please put your flag on this map: http://maps.google.com/maps - Hit the red edit and then the little marker marker button. Thanks!
Enjoy your weekend and probably you'll find time for some Neo4j related hacking.
Cheers
Peter, Andreas and Michael

public> heroku addons:add neo4j

Hello Graphistas and Rubyists!

Now Heroku has become a language polyglot platform , we’re happy to announce that we’re enhancing the NOSQL ecosystem for Heroku customers and users by releasing the Neo4j-Graph Database Add-On. The Neo4j-Graph Database Add-On became “public” this week, so it’s available to all registered beta-testers of the Heroku PAAS platform. This is the first step in our efforts to provide hosted Neo4j Servers to a number of PAAS providers. And the Neo4j Add-On is currently available for free with the test plan, which we think is pretty cool.


       

What is a Graph Database ?

A graph database is a type of NOSQL datastore suited for interconnected data. It stores its content as nodes connected via relationships, both of which can have any number of properties (this particular model is known as a property-graph). Graph databases have constant time query characteristics for local data access which is independent of data set size. They are a perfect fit for storing object networks but don't rely on fixed schemas, so highly dynamic domains are more than welcome (in both dimensions - properties and connections). In terms of scalability, Neo4j currently scales up well since graphs tend to require far fewer writes than traditional RDBMS to achieve the same informational goals. Neo4j scales out reasonably too (especially for reads) through master/slave replication (where slaves are writable). An instance of Neo4j can handle billions of nodes and relationships on a single machine typically surpasses other technologies (like RDBMS) when executing the graph equivalent of multi-join queries.

Provisioning a Neo4j Server instance

For the Heroko Neo4j Add-On we've created our own hosting infrastructure on AWS EC2 instances co-located in the same region (us-east). As a Heroku user, you can add Neo4j to you application by simply issuing the following command:
> heroku addons:add neo4j:test
A Neo4j Server will then be provisioned for your application (with currently generous amounts of RAM). You may visit the heroku page for your add-on to see the following information.

Neo4j Add-On Settings

Most of this connection information is also available via
> heroku config.
The first link points to the Neo4j Web Administration UI which allows you to visualize and manage certain aspects of your graph database. The second link (REST-URL) is used by your application to connect to the Neo4j Server. (Please note that unlike the Neo4j Server available from http://neo4j.org/download this setup requires a username and password for basic authentication). The Backup & Restore feature allows to you to pull the current content of your database anytime (suspending the server meanwhile) and replacing the available content with alternative data-sets. For your convenience we began to provide datasets and will add more of them in the future so that you can start to explore larger graphs right away. Please note that for saving capacity we suspend idle instances after 24 hours of inactivity. The fist request of a suspended instance will take longer than usual as the instance has to be resumed.

Your first Application

The simplest setup for a application using the Neo4j-Server would be using a REST library like rest-client. Anyway the usage with rest-client would look like this.
irb> p JSON.parse(RestClient.get ENV['NEO4J_URL'])
Remember that instances of Neo4j are suspended after periods of inactivity, so the first call to an instance may take a little longer than normal as the instance is resumed. A gem like neography encapsulates all the low-level details of the API and provides a clean object-oriented way of interacting with the Neo4j-Server.

# i_love_you.rb 
require 'sinatra' 
require 'neography' 
neo = Neography::Rest.new(ENV['NEO4J_URL'] || "http://localhost:7474")  

def create_graph(neo)   
  # procedural API   
  me = neo.get_root   
  pr = neo.get_node_properties(me)   
  return if pr && pr['name']
  neo.set_node_properties(me,{"name" => "I"})   
  you = neo.create_node("name" => "you")   
  neo.create_relationship("love", me, you) 
end  

create_graph(neo)  

get '/' do   
  ## object-oriented API   
  me = Neography::Node.load(neo, 0)          
  rel = me.rels(:love).first   
  you = rel.end_node   
  "#{me.name} #{rel.rel_type} #{you.name}" 
end

(J)Ruby Server Side Extensions

The Neo4j Heroku Add-On contains one more new piece of functionality that can be added to the Neo4j-Server: the ability to extend behavior of the server in other languages than Java. Since we want to support efficient execution of code written in dynamic programming languages like Ruby, we've provided a means to move code to the server where it is executed performantly close to the underlying database. We employ JRuby on the server to run rack-applications packaged as ruby gems (for easier management versioning). Those rack applications can use gems like neo4j.rb to access Neo4j directly without any intermediate or remote layers. This allows a more granular, batch oriented domain level REST API to your front-end providing (or consuming) all the information that has to be exchanged with the graph database in one go. A simple example of an application split into a persistence back-end and a front-end hosted on heroku is available on the Heroku documentation pag. We also made the sample code available on github.

Documentation Galore

Everything you read here and even more details are available on our Heroku Neo4j Add-On documentation page

Sunday, December 11, 2011

Neo4j is going GoogleGroups

Hi everyone,
after some preparation, we are finally done transitioning all the new Neo4j and Graph-related discussions to The Neo4j Google Group. New discussions will be started there, so please accept the invite you have got as an existing community member and switch over. You can even directly subscribe from the neo4j.org site.

We are keeping the old archives around so we can refer to them but wil eventually close the old mailing list for new posts. The archives and Google searches will be kept intact at http://neo4j.org/nabble/

Sorry for the inconvenience that this might cause, but the grass WILL be greener of the other side :)

/Your friendly Neo4j Community.

Wednesday, December 7, 2011

Cypher - A view from a recovering SQL DBA

Through the eyes of a SQL master, Cypher looks different yet somehow familiar. In this humorous and insightful blog post, Andrés Taylor guides you along the mental shift required to grok querying Neo4j. Through progressive examples, he presents SQL queries then maps them to the equivalent Cypher.

Read the full post: Cypher - A view from a recovering SQL DBA



Sunday, December 4, 2011

Neo4j Labs: Heroku, Neo4j and Google Spreadsheet in 10min. Flat.

Hi all,

Last Friday, we were all labbing again - the best day of the week.

I didn't have much time so I decided to try to produce a screencast that would measure the time required to go from nothing to flash using some of our tools.

What I came up with demonstrates the process required to set up a Neo4j instance via Heroku, then connect to it from within a Google Spreadsheet (which your managers will like) using appscript.
Simple, yet pretty cool.

Note: Please make sure that you are part of the Heroku private beta program, before trying this yourself.  Alternatively send an email to heroku at neo4j.org for getting registered.
The addon-documentation is also available at heroku (protected).

 The basic steps are:
  • Register at Heroku and install the heroku gem
  • Create and install a Heroku app (heroku apps:create)
  • Add a Neo4j addon instance to it (heroku addons:add neo4j)
  • Upload existing Twitter data to the graph
  • Create a custom Ruby app (code below, GitHub)
  • Execute Cypher queries (queries below) 
  • Connect to the app using a Google Spreadsheet 
  • Build a small bar chart from a Cypher query.
Watch the screencast to see it in action:

Heroku, Neo4j and Google Spreadsheet in 10min. Flat.

What do you think, both about the content and the screencast itself? Some thoughts:
  • quality is not stellar but acceptable with IShowU and built-in MacBookPro Mic
  • probably a transcript of the commands used in the cast would be good, as suggested by Patrick Durusau
  • YouTube seems to have a problem accepting my login via iMovie, which I used for putting together the pieces.
  • All in all, it will take about 2h to produce this kind of casts, hope to get that down to 1h for 5 minutes.
Create and launch Heroku Application
# Register at Heroku and for the beta program
> git init
> heroku apps:create <app-name>
> heroku addons:add neo4j
> add the files below
> git add *; git commit -m"neo4j demo"
> git push heroku master
# Gemfile
source :rubygems

gem 'sinatra'
gem 'json'
gem 'rest-client'

#config.ru
require './cypher-endpoint'
run Sinatra::Application

#cypher-endpoint.rb
require 'sinatra'
require 'rest-client'
require 'json'

rest = RestClient::Resource.new(ENV['NEO4J_URL'])

post '/raw-cypher' do
    data = {:query=>request.body.read }
    rest["/db/data/ext/CypherPlugin/graphdb/execute_query"].post data.to_json, 
                 {:accept=>"application/json",:content_type=>"application/json"}
end

Cypher Queries
start user=node(212) match user-[:USED]->tag return tag.name
start user=node:users(twid:*)
  match user-[:TWEETED]->tweet
  return user.twid, count(*)
curl -d'start user=node:users("twid:*")
  match user-[:TWEETED]-> tweet -[:TAGGED]-> tag
  return user.twid, tag.name, count(*)
  order by count(*)
  desc limit 10' http://heroku-neo4j-appscript-demo.heroku.com/raw-cypher


For the next screencasts, please suggest topics that you are interested in!
Even better - create a screencast about a Neo4j topic yourself.

Enjoy!

/peter

PS: The front picture is my son Kalle during a tour around the beautiful island of Nordkoster.