At a Conference? Need a Dataset? Neo4j at NOSQL NOW

jieforest發表於2012-09-25
For the "Lunch and Learn around Neo4j" with Andreas Kollegger we wanted to use a dataset that is easy to understand and interesting enough for attendees of the conference.

So we chose to use just that days conference program as dataset. Conference data is usually well connected and has the opportunity for challenging data model discussions and insightful queries.

So we set up a Heroku instance, connected to a provisioned Neo4j database hosting an informational website. It explains Neo4j, the local installation, the Heroku add-on and lists available drivers for the different languages. We then used a small ruby script. with the neography gem by our community rock star Max De Marzi to populate the database.

From our example-data site, you can download the graph.db directory for your local Neo4j server.

CODE:

01.require 'rubygems'
02.require 'neography'
03.
04.def neo
05.@neo ||= Neography::Rest.new("http://localhost:7474")
06.end
07.
08.def has_rel(node, dir, type)
09.res = neo.get_node_relationships(node, dir, type)
10.return res && res.size > 0
11.end
12.
13.def add_talk(slot, title, speakers,audience,tags)
14.root = neo.get_root()
15.talk = neo.create_node({:title => title})
16.slot = neo.create_unique_node(:slots, :slot, slot, { :slot => slot})
17.neo.create_relationship(:at, talk, slot)
18.speakers.each do |name, from|
19.speaker = neo.create_unique_node(:speakers, :name, name, { :name => name})
20.neo.create_relationship(:presents, speaker, talk)
21.company = neo.create_unique_node(:companies, :company, from, { :company => from})
22.neo.create_relationship(:works_at, speaker, company) unless has_rel(speaker, :out, :works_at)
23.end
24.tags.each do |name|
25.tag = neo.create_unique_node(:tags, :tag, name, { :tag => name})
26.neo.create_relationship(:tagged, talk, tag)
27.neo.create_relationship(:tag, root, tag) unless has_rel(tag,:in, :tag)
28.end
29.who = neo.create_unique_node(:audience, :audience, audience, { :audience => audience})
30.neo.create_relationship(:for, talk, who)
31.end
32.
33.neo.execute_query("start n=node(*) match n-[r?]-m where ID(n)<>0 delete n,r")
34.
35.[:slots, :speakers, :companies, :tags, :audience].each do |name|
36.neo.create_node_index(name, :exact, :lucene)
37.end
38.
39.
40.add_talk("08:30 AM - 09:00 AM",'The Journey to Amazon DynamoDB: From Scaling by Architecture to Scaling by Commandment',
41.{'Swami Sivasubramanian'=>'Amazon Web Services'}, 'Technical - Introductory', [ 'Cloud Computing',"NoSQL Architecture and Design"])
42.add_talk("09:00 AM - 09:45 AM", 'Then Our Buildings Shape Us: A new way to think about NoSQL technology selection',
43.{'Tim Berglund'=>'GitHub'}, 'Business / Non-Technical', [ 'NoSQL Architecture and Design', "NoSQL Technology Evaluation"])
44.add_talk("09:45 AM - 10:00 AM",'Create Powerful New Applications with Graphs',
45.{'Emil Eifrem'=>'Neo Technology'}, 'Business / Non-Technical', [ 'Graph Databases'])
46.add_talk("10:30 AM - 11:15 AM",'Why and When You Should Use Redis',
47.{'Josiah Carlson'=>'ChowNow Inc.'}, 'Technical - Introductory', [ 'NoSQL Technology Evaluation'])
48....
49.add_talk("10:30 AM - 11:15 AM",'Intro to Graph Databases 101',
50.{'Andreas Kollegger'=>'Neo Technology'}, 'Technical - Introductory', ['Graph Databases'])
51....
52.add_talk("01:15 PM - 02:00 PM",'Lunch N Learn with Neo Technology and Neo4j',
53.{'Andreas Kollegger'=>'Neo Technology'}, 'Technical - Introductory', ['Graph Databases'])
54.add_talk("02:15 PM - 03:00 PM", 'Using Graph Databases to Analyze Relationships, Risks and Business Opportunities - A Case Study',
55.{'Jans Aasman'=>'Franz Inc'}, 'Technical - Introductory', [ 'Graph Databases'])
56.add_talk("04:15 PM - 04:45 PM", 'High performance graph database using cache, cloud, and standards',
57.{'Bryan Thompson'=>'SYSTAP, LLC'}, 'Technical - Advanced', [ 'Graph Databases'])
58.....
59.add_talk("04:15 PM - 04:45 PM", 'Introducing Hadoop and Big Data into a Healthcare Organization: A True Story and Learned Lessons',
60.{'Vladimir Bacvanski'=>'SciSpike'}, 'Technical - Intermediate', [ 'Big Data'])
61.add_talk("04:15 PM - 04:45 PM", 'NoSQL Data Modelling for Scalable eCommerce',
62.{'Dipali Trivedi'=>'Staples.com'}, 'Technical - Intermediate', [ 'NoSQL Architecture and Design'])
63.
64.
65.add_talk("05:30 PM - 06:30 PM",'The NoSQL "C Panel"', {"Robert Scoble"=>"RackSpace",
66."Bob Wiederhold"=>"Couchbase",
67."Dwight Merriman"=>"10gen",
68."Emil Eifrem"=>"Neo Technology",
69."Jay Jarrell"=>"Objectivity, Inc.",
70."Kirk Dunn"=>"Cloudera, Inc."},
71."Business / Non-Technical",
72.["Graph Databases","Hadoop", "MongoDB"])

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/301743/viewspace-744995/,如需轉載,請註明出處,否則將追究法律責任。

相關文章