Did you know? DZone has great portals for Python, Cloud, NoSQL, and HTML5!
NoSQL Zone is brought to you in partnership with:

Mitch Pronschinske is the Senior Content Curator (aka. "Lord of the Zones") at DZone. That means he writes and searches for the finest developer content in the land so that you don't have to. He often has hotdogs for lunch, likes to make his own ringtones, enjoys card and board games, and is married to an underwear model. Mitch is a DZone employee and has posted 1710 posts at DZone. You can read more from them at their website. View Full User Profile

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

12.07.2011
Email
Views: 3677
  • submit to reddit
This article is part of the DZone NoSQL Resource Portal, which is brought to you in collaboration with Neo Technology and DataStax. Visit the NoSQL Resource Portal for additional tutorials, videos, opinions, and other resources on this topic.
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.

This post was authored by

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:

  • Create and install a Heroku app (heroku apps:create)
  • Add a Neo4j instance to it (heroku addons:add neo4j)
  • Upload existing Twitter data in a graph to run on
  • Create a custom Ruby app (see below, GitHub
  • Execute Cypher queries (see 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:



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 }
    path = "/db/data/ext/CypherPlugin/graphdb/execute_query"
    rest[path].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


Source:  http://blog.neo4j.org/2011/12/neo4j-labs-heroku-neo4j-and-google.html


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

Neo Technology and DataStax are leading the charge for the NoSQL movement.  You can learn more about the Neo4j Graph Database in the project discussion forums and try out the new Spring Data Neo4j, which enables POJO-based development.  You can also see how Apache Cassandra, a ColumnFamily data store, is pushing the boundaries of persistence with cloud capabilities and deployments at SocialFlow and Netflix.

Comments

Afandi Merathi replied on Sat, 2012/03/24 - 8:20am

Really great demo !

What was exactly in that zip file containing the data and how did it get into Neo4j? 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.