neo4j-wrapper 0.0.2-java → 0.0.3-java
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/neo4j/node_mixin.rb +3 -22
- data/lib/neo4j/relationship_mixin.rb +2 -19
- data/lib/neo4j-wrapper/class_methods.rb +36 -0
- data/lib/neo4j-wrapper/rule/functions/{count.rb → size.rb} +2 -2
- data/lib/neo4j-wrapper/rule/rule.rb +9 -1
- data/lib/neo4j-wrapper/rule/rule_node.rb +1 -1
- data/lib/neo4j-wrapper/version.rb +1 -1
- data/lib/neo4j-wrapper.rb +1 -1
- data/neo4j-wrapper.gemspec +1 -1
- metadata +4 -57
- data/lib/db/active_tx_log +0 -1
- data/lib/db/index/lucene/node/Person_exact/_0.fdt +0 -0
- data/lib/db/index/lucene/node/Person_exact/_0.fdx +0 -0
- data/lib/db/index/lucene/node/Person_exact/_0.fnm +0 -1
- data/lib/db/index/lucene/node/Person_exact/_0.frq +0 -0
- data/lib/db/index/lucene/node/Person_exact/_0.nrm +0 -1
- data/lib/db/index/lucene/node/Person_exact/_0.prx +0 -0
- data/lib/db/index/lucene/node/Person_exact/_0.tii +0 -0
- data/lib/db/index/lucene/node/Person_exact/_0.tis +0 -0
- data/lib/db/index/lucene/node/Person_exact/_1.fdt +0 -0
- data/lib/db/index/lucene/node/Person_exact/_1.fdx +0 -0
- data/lib/db/index/lucene/node/Person_exact/_1.fnm +0 -1
- data/lib/db/index/lucene/node/Person_exact/_1.frq +0 -0
- data/lib/db/index/lucene/node/Person_exact/_1.nrm +0 -1
- data/lib/db/index/lucene/node/Person_exact/_1.prx +0 -0
- data/lib/db/index/lucene/node/Person_exact/_1.tii +0 -0
- data/lib/db/index/lucene/node/Person_exact/_1.tis +0 -0
- data/lib/db/index/lucene/node/Person_exact/_2.fdt +0 -0
- data/lib/db/index/lucene/node/Person_exact/_2.fdx +0 -0
- data/lib/db/index/lucene/node/Person_exact/_2.fnm +0 -1
- data/lib/db/index/lucene/node/Person_exact/_2.frq +0 -0
- data/lib/db/index/lucene/node/Person_exact/_2.nrm +0 -1
- data/lib/db/index/lucene/node/Person_exact/_2.prx +0 -0
- data/lib/db/index/lucene/node/Person_exact/_2.tii +0 -0
- data/lib/db/index/lucene/node/Person_exact/_2.tis +0 -0
- data/lib/db/index/lucene/node/Person_exact/segments.gen +0 -0
- data/lib/db/index/lucene/node/Person_exact/segments_3 +0 -0
- data/lib/db/index/lucene-store.db +0 -0
- data/lib/db/index/lucene.log.active +0 -0
- data/lib/db/index.db +0 -0
- data/lib/db/messages.log +0 -826
- data/lib/db/neostore +0 -0
- data/lib/db/neostore.id +0 -0
- data/lib/db/neostore.nodestore.db +0 -0
- data/lib/db/neostore.nodestore.db.id +0 -0
- data/lib/db/neostore.propertystore.db +0 -0
- data/lib/db/neostore.propertystore.db.arrays +0 -0
- data/lib/db/neostore.propertystore.db.arrays.id +0 -0
- data/lib/db/neostore.propertystore.db.id +0 -0
- data/lib/db/neostore.propertystore.db.index +0 -0
- data/lib/db/neostore.propertystore.db.index.id +0 -0
- data/lib/db/neostore.propertystore.db.index.keys +0 -0
- data/lib/db/neostore.propertystore.db.index.keys.id +0 -0
- data/lib/db/neostore.propertystore.db.strings +0 -0
- data/lib/db/neostore.propertystore.db.strings.id +0 -0
- data/lib/db/neostore.relationshipstore.db +0 -0
- data/lib/db/neostore.relationshipstore.db.id +0 -0
- data/lib/db/neostore.relationshiptypestore.db +0 -0
- data/lib/db/neostore.relationshiptypestore.db.id +0 -0
- data/lib/db/neostore.relationshiptypestore.db.names +0 -0
- data/lib/db/neostore.relationshiptypestore.db.names.id +0 -0
- data/lib/db/nioneo_logical.log.active +0 -0
- data/lib/db/tm_tx_log.1 +0 -0
data/lib/neo4j/node_mixin.rb
CHANGED
@@ -41,33 +41,14 @@ module Neo4j
|
|
41
41
|
klass.extend Neo4j::Core::Index::ClassMethods
|
42
42
|
klass.extend Neo4j::Wrapper::Find
|
43
43
|
klass.extend Neo4j::Wrapper::Rule::ClassMethods
|
44
|
-
|
45
44
|
klass.send(:include, Neo4j::Wrapper::Rule::Functions)
|
46
|
-
|
47
|
-
|
48
|
-
klass.node_indexer do
|
49
|
-
index_names :exact => "#{klass._index_name}_exact", :fulltext => "#{klass._index_name}_fulltext"
|
50
|
-
trigger_on :_classname => klass.to_s
|
51
|
-
prefix_index_name &klass.method(:index_prefix)
|
52
|
-
end
|
45
|
+
klass.setup_node_index
|
53
46
|
|
54
47
|
def klass.inherited(sub_klass)
|
55
|
-
|
56
|
-
base_class = self
|
57
|
-
|
58
|
-
# make the base class trigger on the sub class nodes
|
59
|
-
base_class._indexer.config.trigger_on :_classname => sub_klass.to_s
|
60
|
-
|
61
|
-
sub_klass.inherit_rules_from self
|
62
|
-
|
63
|
-
sub_klass.node_indexer do
|
64
|
-
inherit_from base_class
|
65
|
-
index_names :exact => "#{sub_klass._index_name}_exact", :fulltext => "#{sub_klass._index_name}_fulltext"
|
66
|
-
trigger_on :_classname => sub_klass.to_s
|
67
|
-
prefix_index_name &sub_klass.method(:index_prefix)
|
68
|
-
end
|
48
|
+
setup_neo4j_subclass(sub_klass)
|
69
49
|
super
|
70
50
|
end
|
51
|
+
|
71
52
|
super
|
72
53
|
end
|
73
54
|
|
@@ -31,27 +31,10 @@ module Neo4j
|
|
31
31
|
klass.extend Neo4j::Wrapper::Property::ClassMethods
|
32
32
|
klass.extend Neo4j::Core::Index::ClassMethods
|
33
33
|
klass.extend Neo4j::Wrapper::Find
|
34
|
-
|
35
|
-
index_name = klass.to_s.gsub("::", '_')
|
36
|
-
|
37
|
-
klass.rel_indexer do
|
38
|
-
index_names :exact => "#{index_name}_exact", :fulltext => "#{index_name}_fulltext"
|
39
|
-
trigger_on :_classname => klass.to_s
|
40
|
-
end
|
34
|
+
klass.setup_rel_index
|
41
35
|
|
42
36
|
def klass.inherited(sub_klass)
|
43
|
-
|
44
|
-
index_name = sub_klass.to_s.gsub("::", '_')
|
45
|
-
base_class = self
|
46
|
-
|
47
|
-
# make the base class trigger on the sub class nodes
|
48
|
-
base_class._indexer.config.trigger_on :_classname => sub_klass.to_s
|
49
|
-
|
50
|
-
sub_klass.rel_indexer do
|
51
|
-
inherit_from base_class
|
52
|
-
index_names :exact => "#{index_name}_exact", :fulltext => "#{index_name}_fulltext"
|
53
|
-
trigger_on :_classname => sub_klass.to_s
|
54
|
-
end
|
37
|
+
setup_neo4j_subclass(sub_klass)
|
55
38
|
super
|
56
39
|
end
|
57
40
|
|
@@ -10,6 +10,42 @@ module Neo4j
|
|
10
10
|
wrapped_node
|
11
11
|
end
|
12
12
|
|
13
|
+
def setup_neo4j_subclass(sub_klass)
|
14
|
+
return if self.to_s == sub_klass.to_s
|
15
|
+
# make the base class trigger on the sub class nodes
|
16
|
+
_indexer.config.trigger_on :_classname => sub_klass.to_s
|
17
|
+
|
18
|
+
sub_klass.inherit_rules_from(self) if sub_klass.respond_to?(:inherit_rules_from)
|
19
|
+
|
20
|
+
if sub_klass.ancestors.include?(Neo4j::NodeMixin)
|
21
|
+
setup_node_index(sub_klass)
|
22
|
+
else
|
23
|
+
setup_rel_index(sub_klass)
|
24
|
+
end
|
25
|
+
|
26
|
+
superclass.setup_neo4j_subclass(sub_klass) if superclass.respond_to?(:setup_neo4j_subclass)
|
27
|
+
end
|
28
|
+
|
29
|
+
def setup_node_index(sub_klass=self)
|
30
|
+
base_class = self
|
31
|
+
sub_klass.node_indexer do
|
32
|
+
inherit_from base_class unless base_class == sub_klass
|
33
|
+
index_names :exact => "#{sub_klass._index_name}_exact", :fulltext => "#{sub_klass._index_name}_fulltext"
|
34
|
+
trigger_on :_classname => sub_klass.to_s
|
35
|
+
prefix_index_name &sub_klass.method(:index_prefix)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def setup_rel_index(sub_klass=self)
|
40
|
+
base_class = self
|
41
|
+
sub_klass.rel_indexer do
|
42
|
+
inherit_from base_class unless base_class == sub_klass
|
43
|
+
index_names :exact => "#{sub_klass}_exact", :fulltext => "#{sub_klass}_fulltext"
|
44
|
+
trigger_on :_classname => sub_klass.to_s
|
45
|
+
prefix_index_name &sub_klass.method(:index_prefix)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
13
49
|
# Creates an alias to the original new method: <tt>orig_new</tt>
|
14
50
|
# @private
|
15
51
|
def self.extended(klass)
|
@@ -4,7 +4,7 @@ module Neo4j
|
|
4
4
|
module Functions
|
5
5
|
|
6
6
|
# A function for counting number of nodes of a given class.
|
7
|
-
class
|
7
|
+
class Size < Function
|
8
8
|
def initialize
|
9
9
|
@property = '_classname'
|
10
10
|
@@lock ||= Java::java.lang.Object.new
|
@@ -39,7 +39,7 @@ module Neo4j
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def self.function_name
|
42
|
-
:
|
42
|
+
:size
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -17,7 +17,15 @@ module Neo4j
|
|
17
17
|
@triggers = [@triggers] if @triggers && !@triggers.respond_to?(:each)
|
18
18
|
@functions = [@functions] if @functions && !@functions.respond_to?(:each)
|
19
19
|
@filter = block
|
20
|
-
@bulk_update =
|
20
|
+
@bulk_update = bulk_update
|
21
|
+
end
|
22
|
+
|
23
|
+
def bulk_update
|
24
|
+
return false if @filter
|
25
|
+
return true if @functions.nil?
|
26
|
+
# only one function allowed for bulk update
|
27
|
+
return false if @functions.size != 1
|
28
|
+
@functions.first.class.function_name == :size
|
21
29
|
end
|
22
30
|
|
23
31
|
def to_s
|
@@ -193,7 +193,7 @@ module Neo4j
|
|
193
193
|
def classes_changed(total)
|
194
194
|
@rules.each do |rule|
|
195
195
|
if rule.bulk_update?
|
196
|
-
rule.functions.first.classes_changed(rule.rule_name, rule_node, total)
|
196
|
+
rule.functions && rule.functions.first.classes_changed(rule.rule_name, rule_node, total)
|
197
197
|
total.added.each { |node| connect(rule.rule_name, node) }
|
198
198
|
total.deleted.each { |node| break_connection(rule.rule_name, node) }
|
199
199
|
end
|
data/lib/neo4j-wrapper.rb
CHANGED
@@ -28,7 +28,7 @@ require 'neo4j-wrapper/rule/event_listener'
|
|
28
28
|
require 'neo4j-wrapper/rule/rule'
|
29
29
|
require 'neo4j-wrapper/rule/rule_node'
|
30
30
|
require 'neo4j-wrapper/rule/functions/function'
|
31
|
-
require 'neo4j-wrapper/rule/functions/
|
31
|
+
require 'neo4j-wrapper/rule/functions/size'
|
32
32
|
require 'neo4j-wrapper/rule/functions/sum'
|
33
33
|
|
34
34
|
require 'neo4j/type_converters/type_converters'
|
data/neo4j-wrapper.gemspec
CHANGED
@@ -27,5 +27,5 @@ It comes included with the Apache Lucene document database.
|
|
27
27
|
s.extra_rdoc_files = %w( README.rdoc )
|
28
28
|
s.rdoc_options = ["--quiet", "--title", "Neo4j.rb", "--line-numbers", "--main", "README.rdoc", "--inline-source"]
|
29
29
|
|
30
|
-
s.add_dependency("neo4j-core", "0.0.
|
30
|
+
s.add_dependency("neo4j-core", "0.0.7")
|
31
31
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: neo4j-wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Andreas Ronge
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-04-
|
13
|
+
date: 2012-04-08 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: neo4j-core
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - "="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.
|
23
|
+
version: 0.0.7
|
24
24
|
type: :runtime
|
25
25
|
version_requirements: *id001
|
26
26
|
description: |
|
@@ -60,66 +60,13 @@ files:
|
|
60
60
|
- lib/neo4j-wrapper/rule/class_methods.rb
|
61
61
|
- lib/neo4j-wrapper/rule/event_listener.rb
|
62
62
|
- lib/neo4j-wrapper/rule/functions/function.rb
|
63
|
-
- lib/neo4j-wrapper/rule/functions/
|
63
|
+
- lib/neo4j-wrapper/rule/functions/size.rb
|
64
64
|
- lib/neo4j-wrapper/rule/functions/sum.rb
|
65
65
|
- lib/neo4j-wrapper/rule/neo4j_core_ext/traverser.rb
|
66
66
|
- lib/neo4j/identity_map.rb
|
67
67
|
- lib/neo4j/node_mixin.rb
|
68
68
|
- lib/neo4j/relationship_mixin.rb
|
69
69
|
- lib/neo4j/type_converters/type_converters.rb
|
70
|
-
- lib/db/neostore.relationshiptypestore.db.names
|
71
|
-
- lib/db/neostore.id
|
72
|
-
- lib/db/neostore.relationshiptypestore.db.names.id
|
73
|
-
- lib/db/neostore.nodestore.db.id
|
74
|
-
- lib/db/neostore.propertystore.db.index
|
75
|
-
- lib/db/neostore.propertystore.db.strings.id
|
76
|
-
- lib/db/nioneo_logical.log.active
|
77
|
-
- lib/db/neostore.propertystore.db.strings
|
78
|
-
- lib/db/neostore.relationshiptypestore.db.id
|
79
|
-
- lib/db/neostore
|
80
|
-
- lib/db/neostore.nodestore.db
|
81
|
-
- lib/db/neostore.propertystore.db.index.keys.id
|
82
|
-
- lib/db/neostore.propertystore.db.arrays.id
|
83
|
-
- lib/db/messages.log
|
84
|
-
- lib/db/neostore.relationshipstore.db.id
|
85
|
-
- lib/db/neostore.propertystore.db.arrays
|
86
|
-
- lib/db/neostore.relationshipstore.db
|
87
|
-
- lib/db/neostore.propertystore.db.index.id
|
88
|
-
- lib/db/neostore.propertystore.db.id
|
89
|
-
- lib/db/index.db
|
90
|
-
- lib/db/neostore.propertystore.db
|
91
|
-
- lib/db/tm_tx_log.1
|
92
|
-
- lib/db/neostore.relationshiptypestore.db
|
93
|
-
- lib/db/active_tx_log
|
94
|
-
- lib/db/neostore.propertystore.db.index.keys
|
95
|
-
- lib/db/index/lucene-store.db
|
96
|
-
- lib/db/index/lucene.log.active
|
97
|
-
- lib/db/index/lucene/node/Person_exact/_1.prx
|
98
|
-
- lib/db/index/lucene/node/Person_exact/_1.tii
|
99
|
-
- lib/db/index/lucene/node/Person_exact/_0.fdx
|
100
|
-
- lib/db/index/lucene/node/Person_exact/segments.gen
|
101
|
-
- lib/db/index/lucene/node/Person_exact/_0.frq
|
102
|
-
- lib/db/index/lucene/node/Person_exact/_2.tii
|
103
|
-
- lib/db/index/lucene/node/Person_exact/_1.nrm
|
104
|
-
- lib/db/index/lucene/node/Person_exact/_0.nrm
|
105
|
-
- lib/db/index/lucene/node/Person_exact/_1.tis
|
106
|
-
- lib/db/index/lucene/node/Person_exact/_2.frq
|
107
|
-
- lib/db/index/lucene/node/Person_exact/_2.nrm
|
108
|
-
- lib/db/index/lucene/node/Person_exact/_2.fdt
|
109
|
-
- lib/db/index/lucene/node/Person_exact/_0.fdt
|
110
|
-
- lib/db/index/lucene/node/Person_exact/_0.tis
|
111
|
-
- lib/db/index/lucene/node/Person_exact/_1.fnm
|
112
|
-
- lib/db/index/lucene/node/Person_exact/_1.frq
|
113
|
-
- lib/db/index/lucene/node/Person_exact/_0.tii
|
114
|
-
- lib/db/index/lucene/node/Person_exact/_2.tis
|
115
|
-
- lib/db/index/lucene/node/Person_exact/_2.prx
|
116
|
-
- lib/db/index/lucene/node/Person_exact/_2.fdx
|
117
|
-
- lib/db/index/lucene/node/Person_exact/_0.prx
|
118
|
-
- lib/db/index/lucene/node/Person_exact/_2.fnm
|
119
|
-
- lib/db/index/lucene/node/Person_exact/_1.fdt
|
120
|
-
- lib/db/index/lucene/node/Person_exact/_0.fnm
|
121
|
-
- lib/db/index/lucene/node/Person_exact/_1.fdx
|
122
|
-
- lib/db/index/lucene/node/Person_exact/segments_3
|
123
70
|
- README.rdoc
|
124
71
|
- Gemfile
|
125
72
|
- neo4j-wrapper.gemspec
|
data/lib/db/active_tx_log
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
tm_tx_log.1
|
Binary file
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
����_id_ageQ
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
NRM�|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
����_id_ageQ
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
NRM�|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
����_id_ageQ
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
NRM�|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/db/index.db
DELETED
Binary file
|