redcar 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +6 -0
- data/Rakefile +1 -1
- data/lib/redcar.rb +2 -2
- data/lib/redcar/installer.rb +3 -2
- metadata +4 -62
- data/plugins/project_search/vendor/lucene/CHANGELOG +0 -147
- data/plugins/project_search/vendor/lucene/CONTRIBUTORS +0 -17
- data/plugins/project_search/vendor/lucene/Gemfile +0 -9
- data/plugins/project_search/vendor/lucene/Gemfile.lock +0 -33
- data/plugins/project_search/vendor/lucene/LICENSE +0 -19
- data/plugins/project_search/vendor/lucene/README.rdoc +0 -283
- data/plugins/project_search/vendor/lucene/Rakefile +0 -35
- data/plugins/project_search/vendor/lucene/examples/active_model/serializers.rb +0 -25
- data/plugins/project_search/vendor/lucene/examples/active_model/validation.rb +0 -26
- data/plugins/project_search/vendor/lucene/examples/admin/Rakefile +0 -4
- data/plugins/project_search/vendor/lucene/examples/admin/admin.rb +0 -29
- data/plugins/project_search/vendor/lucene/examples/admin/public/jquery.js +0 -4376
- data/plugins/project_search/vendor/lucene/examples/admin/public/neo4j.css +0 -153
- data/plugins/project_search/vendor/lucene/examples/admin/public/neo_admin.js +0 -18
- data/plugins/project_search/vendor/lucene/examples/admin/spec/admin_spec.rb +0 -26
- data/plugins/project_search/vendor/lucene/examples/admin/views/index.erb +0 -21
- data/plugins/project_search/vendor/lucene/examples/filetree/README.rdoc +0 -9
- data/plugins/project_search/vendor/lucene/examples/filetree/app.rb +0 -7
- data/plugins/project_search/vendor/lucene/examples/filetree/batch.props +0 -5
- data/plugins/project_search/vendor/lucene/examples/filetree/features/step_definitions/add_steps.rb +0 -121
- data/plugins/project_search/vendor/lucene/examples/filetree/features/support/env.rb +0 -30
- data/plugins/project_search/vendor/lucene/examples/filetree/features/support/rspec_helper.rb +0 -50
- data/plugins/project_search/vendor/lucene/examples/filetree/features/treesizes.feature +0 -19
- data/plugins/project_search/vendor/lucene/examples/imdb/1_create_neo_db.rb +0 -66
- data/plugins/project_search/vendor/lucene/examples/imdb/2_index_db.rb +0 -23
- data/plugins/project_search/vendor/lucene/examples/imdb/README +0 -12
- data/plugins/project_search/vendor/lucene/examples/imdb/find_actors.rb +0 -56
- data/plugins/project_search/vendor/lucene/examples/imdb/install.sh +0 -12
- data/plugins/project_search/vendor/lucene/examples/imdb/model.rb +0 -37
- data/plugins/project_search/vendor/lucene/examples/railway/README +0 -111
- data/plugins/project_search/vendor/lucene/examples/railway/railnet-app.rb +0 -31
- data/plugins/project_search/vendor/lucene/examples/railway/railnet-data.rb +0 -42
- data/plugins/project_search/vendor/lucene/examples/rest/example.rb +0 -41
- data/plugins/project_search/vendor/lucene/examples/you_might_know/YouMightKnow.java +0 -60
- data/plugins/project_search/vendor/lucene/examples/you_might_know/all_simple_paths.rb +0 -34
- data/plugins/project_search/vendor/lucene/examples/you_might_know/nodes.rb +0 -34
- data/plugins/project_search/vendor/lucene/examples/you_might_know/you_might_know.rb +0 -50
- data/plugins/project_search/vendor/lucene/lib/lucene.rb +0 -15
- data/plugins/project_search/vendor/lucene/lib/lucene/config.rb +0 -145
- data/plugins/project_search/vendor/lucene/lib/lucene/document.rb +0 -96
- data/plugins/project_search/vendor/lucene/lib/lucene/field_info.rb +0 -144
- data/plugins/project_search/vendor/lucene/lib/lucene/hits.rb +0 -54
- data/plugins/project_search/vendor/lucene/lib/lucene/index.rb +0 -267
- data/plugins/project_search/vendor/lucene/lib/lucene/index_info.rb +0 -146
- data/plugins/project_search/vendor/lucene/lib/lucene/index_searcher.rb +0 -157
- data/plugins/project_search/vendor/lucene/lib/lucene/jars.rb +0 -5
- data/plugins/project_search/vendor/lucene/lib/lucene/query_dsl.rb +0 -135
- data/plugins/project_search/vendor/lucene/lib/lucene/transaction.rb +0 -117
- data/plugins/project_search/vendor/lucene/lib/lucene/version.rb +0 -3
- data/plugins/project_search/vendor/lucene/lucene.gemspec +0 -23
- data/plugins/project_search/vendor/lucene/spec/lucene/document_spec.rb +0 -32
- data/plugins/project_search/vendor/lucene/spec/lucene/field_info_spec.rb +0 -70
- data/plugins/project_search/vendor/lucene/spec/lucene/index_info_spec.rb +0 -76
- data/plugins/project_search/vendor/lucene/spec/lucene/index_spec.rb +0 -643
- data/plugins/project_search/vendor/lucene/spec/lucene/query_dsl_spec.rb +0 -142
- data/plugins/project_search/vendor/lucene/spec/lucene/sort_spec.rb +0 -101
- data/plugins/project_search/vendor/lucene/spec/lucene/spec_helper.rb +0 -10
- data/plugins/project_search/vendor/lucene/spec/lucene/transaction_spec.rb +0 -118
@@ -1,19 +0,0 @@
|
|
1
|
-
Feature: Tree size calulations
|
2
|
-
In order to get some feeling for the file size performance
|
3
|
-
As a user
|
4
|
-
I want to test some traverse operations on Neo4j
|
5
|
-
|
6
|
-
# Scenario: Simple tests
|
7
|
-
# When I create a filetree with 2 files a 1kb and 1 subfolders in each folder, 3 times nested
|
8
|
-
# Then the total number of nodes in the db should be greater than 7
|
9
|
-
# Then the total size of one top folder files should be 4 kb and response time less than 0.015 s
|
10
|
-
|
11
|
-
Scenario: Bigger data sample
|
12
|
-
When I create a filetree with 400 files a 1kb and 50 subfolders in each folder, 3 times nested
|
13
|
-
Then the total number of nodes in the db should be greater than 20000
|
14
|
-
Then the total size of one top folder files should be 20400 kb and response time less than 0.5 s
|
15
|
-
|
16
|
-
# Scenario: Big data sample
|
17
|
-
# When I create a filetree with 3000 files a 1kb and 300 subfolders in each folder, 3 times nested
|
18
|
-
# Then the total number of nodes in the db should be greater than 20000
|
19
|
-
# Then the total size of one top folder files should be 20400 kb and response time less than 0.5 s
|
@@ -1,66 +0,0 @@
|
|
1
|
-
IMDB_FILE = 'data/test-actors.list'
|
2
|
-
|
3
|
-
Neo4j.migration 1, "Create DB by parsing IMDB file" do
|
4
|
-
up do
|
5
|
-
puts "Migration 1, processing #{IMDB_FILE} file ..."
|
6
|
-
Neo4j::Transaction.run do
|
7
|
-
movies = {}
|
8
|
-
current_actor = nil
|
9
|
-
actors = 0
|
10
|
-
no_films = 0
|
11
|
-
|
12
|
-
File.open(IMDB_FILE).each_line do |line|
|
13
|
-
next if line.strip.empty?
|
14
|
-
|
15
|
-
tab_items = line.split("\t")
|
16
|
-
|
17
|
-
unless tab_items.empty?
|
18
|
-
if !tab_items[0].empty?
|
19
|
-
current_actor = Actor.new
|
20
|
-
current_actor.name = tab_items.shift.strip
|
21
|
-
actors += 1
|
22
|
-
# puts "Parse new actor no. #{actors} '#{current_actor.name}'"
|
23
|
-
end
|
24
|
-
tab_items.shift
|
25
|
-
|
26
|
-
film = tab_items.shift.strip
|
27
|
-
|
28
|
-
# already created film ?
|
29
|
-
movie = movies[film]
|
30
|
-
if (movie.nil?)
|
31
|
-
movie = Movie.new
|
32
|
-
movie.title = film
|
33
|
-
movie.year = /\((\d+)(\/.)?\)/.match(film)[1]
|
34
|
-
movies[film] = movie
|
35
|
-
# puts "Created new film #{film}"
|
36
|
-
no_films += 1
|
37
|
-
end
|
38
|
-
|
39
|
-
role = tab_items.shift
|
40
|
-
roleNode = current_actor.acted_in.new(movie)
|
41
|
-
|
42
|
-
unless (role.nil?)
|
43
|
-
role.strip!
|
44
|
-
# remove []
|
45
|
-
role.slice!(0)
|
46
|
-
role.chop!
|
47
|
-
title, character = role.split('-')
|
48
|
-
roleNode.title = title.strip unless title.nil?
|
49
|
-
roleNode.character = character.strip unless character.nil?
|
50
|
-
end
|
51
|
-
|
52
|
-
#puts "Actor: '#{current_actor}' Film '#{film}' Year '#{year}' Title '#{title}' Character '#{character}'"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
puts "created #{actors} actors and #{no_films} films"
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
down do
|
60
|
-
puts "deleting all movies and actors"
|
61
|
-
Neo4j::Transaction.run do
|
62
|
-
Actor.all.each {|a| a.del}
|
63
|
-
Movie.all.each {|m| m.del}
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
Neo4j.migration 2, "Index DB" do
|
2
|
-
up do
|
3
|
-
|
4
|
-
puts "Migration 2, Index DB on #{Lucene::Config[:storage_path]}"
|
5
|
-
|
6
|
-
Neo4j::Transaction.run do
|
7
|
-
puts "Creating lucene index ..."
|
8
|
-
Actor.index :name, :tokenized => true
|
9
|
-
start = Time.new
|
10
|
-
Actor.update_index
|
11
|
-
puts "Index speed #{Time.new - start} sec"
|
12
|
-
end
|
13
|
-
# only possible to access and query the index after the transaction commits
|
14
|
-
end
|
15
|
-
|
16
|
-
down do
|
17
|
-
puts "removing lucene index"
|
18
|
-
Actor.remove_index :name
|
19
|
-
# Actor.update_index # maybe nicer way of deleting indexes - hmm, does it work ?
|
20
|
-
require 'fileutils'
|
21
|
-
FileUtils.rm_rf Lucene::Config[:storage_path] # quick and dirty way of killing the lucene index
|
22
|
-
end
|
23
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
Shows how to store and query a neo4j database
|
2
|
-
|
3
|
-
1. Download the database type: ./install.sh
|
4
|
-
2. Run the application: jruby find_actors.rb willis
|
5
|
-
|
6
|
-
The find_actors.rb uses migration which means that the first time the it is used it will take
|
7
|
-
a while to process the imdb file and create the index.
|
8
|
-
|
9
|
-
Notice that you can play around with migrations by require the 'find_actor' in JIRB and then for example
|
10
|
-
Neo4j.migrate! 1
|
11
|
-
which will delete the lucene index (migration number 2)
|
12
|
-
|
@@ -1,56 +0,0 @@
|
|
1
|
-
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../../lib")
|
2
|
-
require "rubygems"
|
3
|
-
require "neo4j"
|
4
|
-
|
5
|
-
# we have to configure these before the model is loaded
|
6
|
-
Lucene::Config[:store_on_file] = true
|
7
|
-
Lucene::Config[:storage_path] = "tmp/lucene"
|
8
|
-
|
9
|
-
|
10
|
-
require "model"
|
11
|
-
require "neo4j/extensions/reindexer"
|
12
|
-
|
13
|
-
|
14
|
-
# Keep lucene index on file system instead of in memory
|
15
|
-
|
16
|
-
|
17
|
-
# Load Migrations
|
18
|
-
# Create Database
|
19
|
-
require '1_create_neo_db'
|
20
|
-
|
21
|
-
# just for fun I have two migrations - first one for importing the database and second for indexing it.
|
22
|
-
require '2_index_db'
|
23
|
-
|
24
|
-
puts "Neo4j Version #{Neo4j::VERSION}"
|
25
|
-
|
26
|
-
def find_actor(name)
|
27
|
-
Neo4j::Transaction.run do
|
28
|
-
puts "Find all actors named #{name}"
|
29
|
-
result = Actor.find(:name => name)
|
30
|
-
|
31
|
-
puts "Found #{result.size} actors"
|
32
|
-
result.each {|x| puts "#{x.neo_id}\t#{x}"}
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def find_movies(neo_id)
|
37
|
-
Neo4j::Transaction.run do
|
38
|
-
actor = Neo4j.load_node(neo_id)
|
39
|
-
puts "No actor found with neo id #{neo_id}" if actor.nil?
|
40
|
-
return if actor.nil?
|
41
|
-
|
42
|
-
puts "#{actor} acted in:"
|
43
|
-
actor.acted_in_rels.each {|r| puts "Movie #{r.end_node.title} title: #{r.title}"}
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
Neo4j.start
|
48
|
-
if (ARGV.size == 1)
|
49
|
-
find_actor(ARGV[0])
|
50
|
-
elsif ARGV.size == 2 && ARGV[0] == "-m"
|
51
|
-
find_movies(ARGV[1])
|
52
|
-
else
|
53
|
-
puts "Usage: jruby find_actors.rb [-m] <actor name|actor neo_id>\n\n -m \tfinds the movies for the given actor neo_id"
|
54
|
-
end
|
55
|
-
|
56
|
-
Neo4j.stop
|
@@ -1,12 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
# In order to run this example the following files must be downloaded in unpacked
|
4
|
-
# in the data folder
|
5
|
-
|
6
|
-
mkdir data
|
7
|
-
cd data
|
8
|
-
wget https://trac.neo4j.org/export/2067/laboratory/users/andersn/imdb-app/src/test/data/test-actors.list.gz --no-check-certificate
|
9
|
-
wget https://trac.neo4j.org/export/2067/laboratory/users/andersn/imdb-app/src/test/data/test-movies.list.gz --no-check-certificate
|
10
|
-
gunzip test-actors.list.gz
|
11
|
-
gunzip test-movies.list.gz
|
12
|
-
|
@@ -1,37 +0,0 @@
|
|
1
|
-
|
2
|
-
class Movie; end
|
3
|
-
|
4
|
-
|
5
|
-
class Role
|
6
|
-
include Neo4j::RelationshipMixin
|
7
|
-
property :title, :character
|
8
|
-
|
9
|
-
def to_s
|
10
|
-
"Role title #{self.title} character #{self.character}"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class Actor
|
15
|
-
include Neo4j::NodeMixin
|
16
|
-
property :name
|
17
|
-
has_n(:acted_in).to(Movie).relationship(Role)
|
18
|
-
index :name, :tokenized => true
|
19
|
-
|
20
|
-
def to_s
|
21
|
-
"Actor #{self.name}"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class Movie
|
26
|
-
include Neo4j::NodeMixin
|
27
|
-
property :title
|
28
|
-
property :year
|
29
|
-
|
30
|
-
# defines a method for traversing incoming acted_in relationships from Actor
|
31
|
-
has_n(:actors).from(Actor, :acted_in)
|
32
|
-
|
33
|
-
def to_s
|
34
|
-
"Movie #{self.title}"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
@@ -1,111 +0,0 @@
|
|
1
|
-
* Railway Network Application Example (with JRuby Neo4j bindings)
|
2
|
-
by Bert Fitié
|
3
|
-
|
4
|
-
** A. Network application
|
5
|
-
|
6
|
-
(1) Nodes. The nodes are railway stations
|
7
|
-
(2) Arcs. The arcs are the connections between the stations
|
8
|
-
(3) Paths. The (named) paths are trains
|
9
|
-
(4) Usage. The user performs the following navigation:
|
10
|
-
(4.1) The user selects (loads) a start station
|
11
|
-
(4.2) The user generates a list of outgoing trains from this station
|
12
|
-
(4.3) The user selects the train he wants to board from this station
|
13
|
-
(4.4) The user generates the train path, i.e. the sequence of all
|
14
|
-
stations visited by this train from this station
|
15
|
-
(4.5) The user selects (loads) a destination station from this path
|
16
|
-
(4.6) If this station is the final destination, the user is done,
|
17
|
-
otherwise, the user continues has travel with (4.2)
|
18
|
-
|
19
|
-
** B. Example network
|
20
|
-
|
21
|
-
(1) The example network has 8 stations:
|
22
|
-
Alpha, Bravo, Charlie, Delta, Echo, Foxtrot, Golf, Hotel
|
23
|
-
(2) The example network has 8 arcs:
|
24
|
-
(2.1) Alpha - Bravo
|
25
|
-
(2.2) Bravo - Charlie
|
26
|
-
(2.3) Charlie - Delta
|
27
|
-
(2.4) Delta - Echo
|
28
|
-
(2.5) Alpha - Foxtrot
|
29
|
-
(2.6) Foxtrot - Charlie
|
30
|
-
(2.7) Delta - Golf
|
31
|
-
(2.8) Delta - Hotel
|
32
|
-
(3) The example network has 3 trains
|
33
|
-
(3.1) Train t1_ae:
|
34
|
-
(3.1.1) Alpha (departure 11:00) - Bravo (arrival 11:45)
|
35
|
-
(3.1.2) Bravo (departure 11:50) - Charlie (arrival 12:30)
|
36
|
-
(3.1.3) Charlie (departure 12:35) - Delta (arrival 13:00)
|
37
|
-
(3.1.4) Delta (departure 13:05) - Echo (arrival 14:00)
|
38
|
-
(3.2) Train t2_ag:
|
39
|
-
(3.2.1) Alpha (departure 13:15) - Foxtrot (arrival 13:45)
|
40
|
-
(3.2.2) Foxtrot (departure 13:50) - Charlie (arrival 14:30)
|
41
|
-
(3.2.3) Charlie (departure 14:35) - Delta (arrival 15:00)
|
42
|
-
(3.2.4) Delta (departure 15:05) - Golf (arrival 15:45)
|
43
|
-
(3.3) Train t3_gh:
|
44
|
-
(3.3.1) Golf (departure 12:30) - Delta (arrival 13:10)
|
45
|
-
(3.3.2) Delta (departure 13:15) - Hotel (arrival 14:30)
|
46
|
-
|
47
|
-
** C. Demo objective
|
48
|
-
|
49
|
-
(1) The user selects start station Alpha
|
50
|
-
Result should be:
|
51
|
-
You arrived at station Alpha
|
52
|
-
(2) The user generates a list of outgoing trains from Alpha
|
53
|
-
Result should be:
|
54
|
-
Train t1_ae: departure 11:00
|
55
|
-
Train t2_ag: departure 13:15
|
56
|
-
(3) The user selects Train t1_ae to board from this station
|
57
|
-
(4) The user generates the train path for Train t1_ae from Alpha
|
58
|
-
Result should be:
|
59
|
-
Alpha (departure 11:00) - Bravo (arrival 11:45)
|
60
|
-
Bravo (departure 11:50) - Charlie (arrival 12:30)
|
61
|
-
Charlie (departure 12:35) - Delta (arrival 13:00)
|
62
|
-
Delta (departure 13:05) - Echo (arrival 14:00)
|
63
|
-
(5) The user selects destination station Delta from this path
|
64
|
-
Result should be:
|
65
|
-
You arrived at station Delta
|
66
|
-
(6) The user generates a list of outgoing trains from Delta
|
67
|
-
Result should be:
|
68
|
-
Train t1_ae: departure 13:05
|
69
|
-
Train t2_ag: departure 15:05
|
70
|
-
Train t3_gh: departure 13:15
|
71
|
-
(7) The user selects Train t3_gh to board from this station
|
72
|
-
(8) The user generates the train path for Train t3_gh from Delta
|
73
|
-
Result should be:
|
74
|
-
Delta (departure 13:15) - Hotel (arrival 14:30)
|
75
|
-
(9) The user selects final destination station Hotel from this path
|
76
|
-
Result should be:
|
77
|
-
You arrived at station Hotel
|
78
|
-
|
79
|
-
** D. Data file
|
80
|
-
See railnet-data.rb
|
81
|
-
|
82
|
-
** E. Application file
|
83
|
-
See railnet-app.rb
|
84
|
-
|
85
|
-
|
86
|
-
** F. Demo session
|
87
|
-
|
88
|
-
~ $> cd ~/private/sandbox/neo-jruby/examples/railnet
|
89
|
-
railnet $> jruby railnet-data.rb
|
90
|
-
railnet $> jirb -r railnet-app
|
91
|
-
irb(main):001:0> alpha = select_station(1)
|
92
|
-
You arrived at station Alpha
|
93
|
-
irb(main):002:0> list_trains(alpha)
|
94
|
-
Train t2_ag: departure: 13:15
|
95
|
-
Train t1_ae: departure: 11:00
|
96
|
-
irb(main):003:0> train_path(alpha, :t1_ae)
|
97
|
-
Alpha #1 (departure: 11:00) - Bravo #2 (arrival: 11:45)
|
98
|
-
Bravo #2 (departure: 11:50) - Charlie #3 (arrival: 12:30)
|
99
|
-
Charlie #3 (departure: 12:35) - Delta #4 (arrival: 13:00)
|
100
|
-
Delta #4 (departure: 13:05) - Echo #5 (arrival: 14:00)
|
101
|
-
irb(main):004:0> delta = select_station(4)
|
102
|
-
You arrived at station Delta
|
103
|
-
irb(main):005:0> list_trains(delta)
|
104
|
-
Train t3_gh: departure: 13:15
|
105
|
-
Train t2_ag: departure: 15:05
|
106
|
-
Train t1_ae: departure: 13:05
|
107
|
-
irb(main):006:0> train_path(delta, :t3_gh)
|
108
|
-
Delta #4 (departure: 13:15) - Hotel #8 (arrival: 14:30)
|
109
|
-
irb(main):007:0> hotel = select_station(8)
|
110
|
-
You arrived at station Hotel
|
111
|
-
irb(main):008:0>
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'neo4j'
|
3
|
-
|
4
|
-
def select_station(id)
|
5
|
-
station = nil
|
6
|
-
Neo4j::Transaction.run do
|
7
|
-
station = Neo4j.load_node(id)
|
8
|
-
puts "You arrived at station #{station[:name]}"
|
9
|
-
end
|
10
|
-
return station
|
11
|
-
end
|
12
|
-
|
13
|
-
def list_trains(station)
|
14
|
-
Neo4j::Transaction.run do
|
15
|
-
station.rels.outgoing.each do |rel|
|
16
|
-
puts "Train #{rel[:train]}: departure: #{rel[:dep]}"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def train_path(station, train)
|
22
|
-
Neo4j::Transaction.run do
|
23
|
-
station.traverse.outgoing(train).depth(:all).each do |station|
|
24
|
-
rel = station.rel(train, dir = :incoming)
|
25
|
-
puts "#{rel.start_node[:name]} ##{rel.start_node.neo_id}" +
|
26
|
-
" (departure: #{rel[:dep]})" +
|
27
|
-
" - #{rel.end_node[:name]} ##{rel.end_node.neo_id}" +
|
28
|
-
" (arrival: #{rel[:arr]})"
|
29
|
-
end;
|
30
|
-
end;
|
31
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'neo4j'
|
3
|
-
|
4
|
-
Neo4j::Transaction.run do
|
5
|
-
|
6
|
-
# Stations
|
7
|
-
alpha = Neo4j::Node.new :name => 'Alpha'
|
8
|
-
bravo = Neo4j::Node.new :name => 'Bravo'
|
9
|
-
charlie = Neo4j::Node.new :name => 'Charlie'
|
10
|
-
delta = Neo4j::Node.new :name => 'Delta'
|
11
|
-
echo = Neo4j::Node.new :name => 'Echo'
|
12
|
-
foxtrot = Neo4j::Node.new :name => 'Foxtrot'
|
13
|
-
golf = Neo4j::Node.new :name => 'Golf'
|
14
|
-
hotel = Neo4j::Node.new :name => 'Hotel'
|
15
|
-
|
16
|
-
# Train t1_ae
|
17
|
-
t1_ab = Neo4j::Relationship.new(:t1_ae, alpha, bravo)
|
18
|
-
t1_bc = Neo4j::Relationship.new(:t1_ae, bravo, charlie)
|
19
|
-
t1_cd = Neo4j::Relationship.new(:t1_ae, charlie, delta)
|
20
|
-
t1_de = Neo4j::Relationship.new(:t1_ae, delta, echo)
|
21
|
-
t1_ab[:dep] = '11:00'; t1_ab[:arr] = '11:45'; t1_ab[:train] = 't1_ae'
|
22
|
-
t1_bc[:dep] = '11:50'; t1_bc[:arr] = '12:30'; t1_bc[:train] = 't1_ae'
|
23
|
-
t1_cd[:dep] = '12:35'; t1_cd[:arr] = '13:00'; t1_cd[:train] = 't1_ae'
|
24
|
-
t1_de[:dep] = '13:05'; t1_de[:arr] = '14:00'; t1_de[:train] = 't1_ae'
|
25
|
-
|
26
|
-
# Train t2_ag
|
27
|
-
t2_af = Neo4j::Relationship.new(:t2_ag, alpha, foxtrot)
|
28
|
-
t2_fc = Neo4j::Relationship.new(:t2_ag, foxtrot, charlie)
|
29
|
-
t2_cd = Neo4j::Relationship.new(:t2_ag, charlie, delta)
|
30
|
-
t2_dg = Neo4j::Relationship.new(:t2_ag, delta, golf)
|
31
|
-
t2_af[:dep] = '13:15'; t2_af[:arr] = '13:45'; t2_af[:train] = 't2_ag'
|
32
|
-
t2_fc[:dep] = '13:50'; t2_fc[:arr] = '14:30'; t2_fc[:train] = 't2_ag'
|
33
|
-
t2_cd[:dep] = '14:35'; t2_cd[:arr] = '15:00'; t2_cd[:train] = 't2_ag'
|
34
|
-
t2_dg[:dep] = '15:05'; t2_dg[:arr] = '15:45'; t2_dg[:train] = 't2_ag'
|
35
|
-
|
36
|
-
# Train t3_gh
|
37
|
-
t3_gd = Neo4j::Relationship.new(:t3_gh, golf, delta)
|
38
|
-
t3_dh = Neo4j::Relationship.new(:t3_gh, delta, hotel)
|
39
|
-
t3_gd[:dep] = '12:30'; t3_gd[:arr] = '13:10'; t3_gd[:train] = 't3_gh'
|
40
|
-
t3_dh[:dep] = '13:15'; t3_dh[:arr] = '14:30'; t3_dh[:train] = 't3_gh'
|
41
|
-
|
42
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
#####################################
|
2
|
-
#
|
3
|
-
# A simple example how to expose neo nodes as REST resources.
|
4
|
-
#
|
5
|
-
# IMPORTANT
|
6
|
-
#
|
7
|
-
# This example requires the latest version from GITHUB of the sinatra gem
|
8
|
-
# and json-jruby (>=1.1.6) (or another compatible json gem)
|
9
|
-
#
|
10
|
-
|
11
|
-
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../../lib")
|
12
|
-
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/..")
|
13
|
-
require 'rubygems'
|
14
|
-
require 'neo4j'
|
15
|
-
require 'neo4j/extensions/rest'
|
16
|
-
|
17
|
-
FileUtils.rm_rf Neo4j::Config[:storage_path] # NEO_STORAGE
|
18
|
-
FileUtils.rm_rf Lucene::Config[:storage_path] unless Lucene::Config[:storage_path].nil?
|
19
|
-
|
20
|
-
|
21
|
-
class Person
|
22
|
-
include Neo4j::NodeMixin
|
23
|
-
# by includeing the following mixin we will expose this node as a RESTful resource
|
24
|
-
include Neo4j::RestMixin
|
25
|
-
property :name
|
26
|
-
has_n :friends
|
27
|
-
index :name
|
28
|
-
end
|
29
|
-
|
30
|
-
Neo4j.start
|
31
|
-
puts "-----------------------"
|
32
|
-
Neo4j::Transaction.run do
|
33
|
-
a = Person.new :name => 'andreas', :foo => 'bar', :fav_number => 14
|
34
|
-
b = Person.new :name => 'kalle'
|
35
|
-
c = Person.new :name => 'anders'
|
36
|
-
a.friends << b
|
37
|
-
a.rels.outgoing(:other) << c
|
38
|
-
puts "Created Nodes at URI:\n\t#{a._uri}\n\t#{b._uri}\n\t#{c._uri}"
|
39
|
-
end
|
40
|
-
|
41
|
-
Neo4j::Rest::RestServer.thread.join
|