neo4j 2.0.0.alpha.7-java → 2.0.0.alpha.8-java
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +13 -0
- data/Gemfile +3 -0
- data/README.rdoc +6 -5
- data/lib/db/active_tx_log +1 -0
- data/lib/db/index.db +0 -0
- data/lib/db/index/lucene-store.db +0 -0
- data/lib/db/index/lucene.log.active +0 -0
- data/lib/db/index/lucene/node/Person_fulltext/_0.fdt +0 -0
- data/lib/db/index/lucene/node/Person_fulltext/_0.fdx +0 -0
- data/lib/db/index/lucene/node/Person_fulltext/_0.fnm +1 -0
- data/lib/db/index/lucene/node/Person_fulltext/_0.frq +1 -0
- data/lib/db/index/lucene/node/Person_fulltext/_0.nrm +1 -0
- data/lib/db/index/lucene/node/Person_fulltext/_0.prx +0 -0
- data/lib/db/index/lucene/node/Person_fulltext/_0.tii +0 -0
- data/lib/db/index/lucene/node/Person_fulltext/_0.tis +0 -0
- data/lib/db/index/lucene/node/Person_fulltext/segments.gen +0 -0
- data/lib/db/index/lucene/node/Person_fulltext/segments_1 +0 -0
- data/lib/db/lock +0 -0
- data/lib/db/messages.log +304 -0
- 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/generators/neo4j/model/model_generator.rb +4 -7
- data/lib/generators/neo4j/model/templates/model.erb +1 -3
- data/lib/neo4j.rb +2 -1
- data/lib/neo4j/paginated.rb +23 -0
- data/lib/neo4j/rails/accept_id.rb +1 -1
- data/lib/neo4j/rails/attributes.rb +39 -33
- data/lib/neo4j/rails/has_n.rb +14 -1
- data/lib/neo4j/rails/persistence.rb +29 -1
- data/lib/neo4j/rails/relationship_persistence.rb +3 -3
- data/lib/neo4j/rails/relationships/relationships.rb +1 -1
- data/lib/neo4j/rails/transaction.rb +20 -0
- data/lib/neo4j/type_converters/serialize_converter.rb +39 -0
- data/lib/neo4j/version.rb +1 -1
- data/neo4j.gemspec +1 -1
- metadata +43 -3
data/CHANGELOG
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
== 2.0.0.alpha.8 / 2012-04-27
|
2
|
+
* Fix for "relationship to :all assigned twice for single instance" #178
|
3
|
+
* Fix for callback fire more then once (=> performance increase) #172
|
4
|
+
* Support for lucene search on array properties, #118
|
5
|
+
* Support for creating unique entities (get_or_create) #143
|
6
|
+
* Support for specifying has_n/has_one relationship with Strings instead of Class #160
|
7
|
+
* Support for serializer of hash and arrays on properties #185
|
8
|
+
* Fix for Neo4j::Rails::Relationship default property, #195
|
9
|
+
* Added support for pagination, see the neo4j-will_paginate gem
|
10
|
+
* Fixed Rails generators
|
11
|
+
* Added Cypher DSL support for is_a?
|
12
|
+
* Fix for "write_attribute persistes, contrary to AR convention" closes #182
|
13
|
+
|
1
14
|
== 2.0.0.alpha.7 / 2012-04-19
|
2
15
|
* fix for Neo4j::Config bug - did not work from rails to set the db location, closes #191
|
3
16
|
* has_n and has_one method generate class method returning the name of the relationship as a Symbol, closes #170
|
data/Gemfile
CHANGED
@@ -2,6 +2,9 @@ source :gemcutter
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
+
#gem 'neo4j-core', :path => '/home/andreas/projects/neo4j-core'
|
6
|
+
#gem 'neo4j-wrapper', :path => '/home/andreas/projects/neo4j-wrapper'
|
7
|
+
|
5
8
|
group 'development' do
|
6
9
|
gem 'guard'
|
7
10
|
gem 'ruby_gntp', :require => false # GrowlNotify for Mac
|
data/README.rdoc
CHANGED
@@ -11,6 +11,12 @@ It uses two powerful and mature Java libraries:
|
|
11
11
|
|
12
12
|
== Documentation
|
13
13
|
|
14
|
+
==== Version >= 2.0
|
15
|
+
|
16
|
+
* {Github Wiki}[https://github.com/andreasronge/neo4j/wiki]
|
17
|
+
* {YARD}[http://rdoc.info/github/andreasronge/neo4j/master/frames]
|
18
|
+
* RSpecs - There are 2023 RSpecs (478/neo4j-core, 425/neo4j-wrapper and 1120/this gem - 2012 April)
|
19
|
+
|
14
20
|
==== Version < 2.0.alpha.5
|
15
21
|
|
16
22
|
* {Guides and API}[http://neo4j.rubyforge.org/guides/index.html]
|
@@ -18,11 +24,6 @@ It uses two powerful and mature Java libraries:
|
|
18
24
|
* {Blog: Neo4j and Rails 3}[http://blog.jayway.com/2011/03/02/neo4j-rb-1-0-0-and-rails-3/]
|
19
25
|
* {Kvitter Example Application}[https://github.com/andreasronge/kvitter/]
|
20
26
|
|
21
|
-
==== Version >= 2.0
|
22
|
-
|
23
|
-
* {YARD}[http://rdoc.info/github/andreasronge/neo4j/master/frames]
|
24
|
-
* RSpecs - There are 2023 RSpecs (478/neo4j-core, 425/neo4j-wrapper and 1120/this gem - 2012 April)
|
25
|
-
|
26
27
|
=== Presentation Materials and other URLs
|
27
28
|
|
28
29
|
* {JRubyConf 2012 May}[http://jrubyconf.com/#speakers]
|
@@ -0,0 +1 @@
|
|
1
|
+
tm_tx_log.1
|
data/lib/db/index.db
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
����_id_name_ename
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
NRM�|||
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/db/lock
ADDED
File without changes
|
data/lib/db/messages.log
ADDED
@@ -0,0 +1,304 @@
|
|
1
|
+
2012-04-25 06:42:58.885+0000: WARNING! Deprecated configuration options used. See manual for details
|
2
|
+
2012-04-25 06:42:58.888+0000: enable_online_backup has been replaced with online_backup_enabled and online_backup_port
|
3
|
+
2012-04-25 06:42:58.947+0000: Creating new db @ /home/andreas/projects/neo4j/lib/db/neostore
|
4
|
+
2012-04-25 06:42:59.281+0000: Opened [/home/andreas/projects/neo4j/lib/db/nioneo_logical.log.1] clean empty log, version=0, lastTxId=1
|
5
|
+
2012-04-25 06:42:59.296+0000: TM new log: tm_tx_log.1
|
6
|
+
2012-04-25 06:42:59.333+0000: Opened [/home/andreas/projects/neo4j/lib/db/index/lucene.log.1] clean empty log, version=0, lastTxId=1
|
7
|
+
2012-04-25 06:42:59.340+0000: --- STARTUP diagnostics START ---
|
8
|
+
2012-04-25 06:42:59.341+0000: Neo4j Kernel properties:
|
9
|
+
read_only=false
|
10
|
+
neo4j.ext.udc.host=udc.neo4j.org
|
11
|
+
logical_log=/home/andreas/projects/neo4j/lib/db/nioneo_logical.log
|
12
|
+
min_node_cache_size=0
|
13
|
+
intercept_committing_transactions=false
|
14
|
+
node_auto_indexing=false
|
15
|
+
remote_shell_name=shell
|
16
|
+
cache_type=soft
|
17
|
+
intercept_deserialized_transactions=false
|
18
|
+
ha.db=NO
|
19
|
+
use_adaptive_cache=YES
|
20
|
+
lucene_searcher_cache_size=2147483647
|
21
|
+
neo4j.ext.udc.interval=86400000
|
22
|
+
use_memory_mapped_buffers=true
|
23
|
+
ha.coordinators=localhost:2181,localhost:2182,localhost:2183
|
24
|
+
timestamps=YES
|
25
|
+
rebuild_idgenerators_fast=true
|
26
|
+
neostore.propertystore.db.index.keys.mapped_memory=1M
|
27
|
+
max_node_cache_size=1500
|
28
|
+
neostore.propertystore.db.strings.mapped_memory=130M
|
29
|
+
neostore.propertystore.db.arrays.mapped_memory=130M
|
30
|
+
gcr_cache_min_log_interval=60s
|
31
|
+
relationship_grab_size=100
|
32
|
+
relationship_auto_indexing=false
|
33
|
+
remote_shell_read_only=false
|
34
|
+
lucene_writer_cache_size=2147483647
|
35
|
+
storage_path=db
|
36
|
+
node_cache_array_fraction=1.0
|
37
|
+
allow_store_upgrade=false
|
38
|
+
execution_guard_enabled=false
|
39
|
+
relationship_cache_array_fraction=1.0
|
40
|
+
migration_thread=NO
|
41
|
+
remote_logging_host=127.0.0.1
|
42
|
+
store_dir=/home/andreas/projects/neo4j/lib/db
|
43
|
+
remote_logging_port=4560
|
44
|
+
enable_rules=YES
|
45
|
+
gc_monitor_threshold=200ms
|
46
|
+
load_kernel_extensions=true
|
47
|
+
array_block_size=120
|
48
|
+
neostore.relationshipstore.db.mapped_memory=50M
|
49
|
+
dump_configuration=false
|
50
|
+
gc_monitor_wait_time=100ms
|
51
|
+
neostore.nodestore.db.mapped_memory=25M
|
52
|
+
neo4j.ext.udc.first_delay=600000
|
53
|
+
remote_shell_enabled=true
|
54
|
+
min_relationship_cache_size=0
|
55
|
+
max_relationship_cache_size=3500
|
56
|
+
neo4j.ext.udc.reg=unreg
|
57
|
+
remote_shell_port=9332
|
58
|
+
adaptive_cache_heap_ratio=0.77
|
59
|
+
identity_map=NO
|
60
|
+
adaptive_cache_manager_decrease_ratio=1.15
|
61
|
+
ha.server_id=2
|
62
|
+
neo_store=/home/andreas/projects/neo4j/lib/db/neostore
|
63
|
+
adaptive_cache_worker_sleep_time=3000
|
64
|
+
neostore.propertystore.db.index.mapped_memory=1M
|
65
|
+
adaptive_cache_manager_increase_ratio=1.1
|
66
|
+
backup_slave=false
|
67
|
+
neostore.propertystore.db.mapped_memory=90M
|
68
|
+
string_block_size=120
|
69
|
+
grab_file_lock=true
|
70
|
+
remote_logging_enabled=false
|
71
|
+
ha.server=localhost:6002
|
72
|
+
neo4j.ext.udc.enabled=true
|
73
|
+
2012-04-25 06:42:59.345+0000: Diagnostics providers:
|
74
|
+
org.neo4j.kernel.configuration.Config
|
75
|
+
org.neo4j.kernel.info.DiagnosticsManager
|
76
|
+
SYSTEM_MEMORY
|
77
|
+
JAVA_MEMORY
|
78
|
+
OPERATING_SYSTEM
|
79
|
+
JAVA_VIRTUAL_MACHINE
|
80
|
+
CLASSPATH
|
81
|
+
LIBRARY_PATH
|
82
|
+
SYSTEM_PROPERTIES
|
83
|
+
LINUX_SCHEDULERS
|
84
|
+
2012-04-25 06:42:59.346+0000: System memory information:
|
85
|
+
Total Physical memory: 3.87 GB
|
86
|
+
Free Physical memory: 1.99 GB
|
87
|
+
Committed virtual memory: 907.15 MB
|
88
|
+
Total swap space: 4.88 GB
|
89
|
+
Free swap space: 4.88 GB
|
90
|
+
2012-04-25 06:42:59.349+0000: JVM memory information:
|
91
|
+
Free memory: 55.76 MB
|
92
|
+
Total memory: 108.56 MB
|
93
|
+
Max memory: 444.50 MB
|
94
|
+
Garbage Collector: PS Scavenge: [PS Eden Space, PS Survivor Space]
|
95
|
+
Garbage Collector: PS MarkSweep: [PS Eden Space, PS Survivor Space, PS Old Gen, PS Perm Gen]
|
96
|
+
Memory Pool: Code Cache (Non-heap memory): committed=2.63 MB, used=2.52 MB, max=48.00 MB, threshold=0.00 B
|
97
|
+
Memory Pool: PS Eden Space (Heap memory): committed=62.00 MB, used=38.18 MB, max=154.00 MB, threshold=?
|
98
|
+
Memory Pool: PS Survivor Space (Heap memory): committed=5.31 MB, used=5.30 MB, max=5.31 MB, threshold=?
|
99
|
+
Memory Pool: PS Old Gen (Heap memory): committed=41.25 MB, used=9.33 MB, max=333.38 MB, threshold=0.00 B
|
100
|
+
Memory Pool: PS Perm Gen (Non-heap memory): committed=25.81 MB, used=25.69 MB, max=166.00 MB, threshold=0.00 B
|
101
|
+
2012-04-25 06:42:59.357+0000: Operating system information:
|
102
|
+
Operating System: Linux; version: 3.0.0-17-generic; arch: amd64; cpus: 2
|
103
|
+
Max number of file descriptors: 4096
|
104
|
+
Number of open file descriptors: 58
|
105
|
+
Process id: 2694@andreas-dell
|
106
|
+
Byte order: LITTLE_ENDIAN
|
107
|
+
2012-04-25 06:42:59.362+0000: JVM information:
|
108
|
+
VM Name: OpenJDK 64-Bit Server VM
|
109
|
+
VM Vendor: Oracle Corporation
|
110
|
+
VM Version: 21.0-b17
|
111
|
+
JIT compiler: HotSpot 64-Bit Tiered Compilers
|
112
|
+
VM Arguments: [-Djdk.home=, -Djruby.home=/home/andreas/.rvm/rubies/jruby-1.6.7, -Djruby.script=jruby, -Djruby.shell=/bin/sh, -Djffi.boot.library.path=/home/andreas/.rvm/rubies/jruby-1.6.7/lib/native/ppc-Linux:/home/andreas/.rvm/rubies/jruby-1.6.7/lib/native/x86_64-Linux:/home/andreas/.rvm/rubies/jruby-1.6.7/lib/native/i386-Linux, -Xmx500m, -Xss2048k, -Djruby.memory.max=500m, -Djruby.stack.max=2048k, -Xbootclasspath/a:/home/andreas/.rvm/rubies/jruby-1.6.7/lib/jruby.jar]
|
113
|
+
2012-04-25 06:42:59.363+0000: Java classpath:
|
114
|
+
[loader.0] file:/home/andreas/.rvm/gems/jruby-1.6.7@global/gems/json-1.6.5-java/lib/json/ext/parser.jar
|
115
|
+
[loader.2] file:/usr/lib/jvm/java-7-openjdk-common/jre/lib/ext/sunpkcs11.jar
|
116
|
+
[bootstrap] /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/plugin.jar
|
117
|
+
[bootstrap] /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jce.jar
|
118
|
+
[loader.0] file:/home/andreas/.rvm/gems/jruby-1.6.7/gems/neo4j-community-1.7.0-java/lib/neo4j-community/jars/neo4j-kernel-1.7.jar
|
119
|
+
[bootstrap] /home/andreas/.rvm/rubies/jruby-1.6.7/lib/jruby.jar
|
120
|
+
[bootstrap] /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/charsets.jar
|
121
|
+
[loader.2] file:/usr/lib/jvm/java-7-openjdk-common/jre/lib/ext/localedata.jar
|
122
|
+
[bootstrap] /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jsse.jar
|
123
|
+
[loader.0] file:/home/andreas/.rvm/gems/jruby-1.6.7/gems/neo4j-community-1.7.0-java/lib/neo4j-community/jars/neo4j-udc-1.7.jar
|
124
|
+
[bootstrap] /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/sunrsasign.jar
|
125
|
+
[bootstrap] /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rhino.jar
|
126
|
+
[loader.2] file:/usr/lib/jvm/java-7-openjdk-common/jre/lib/ext/dnsns.jar
|
127
|
+
[loader.0] file:/home/andreas/.rvm/gems/jruby-1.6.7/gems/neo4j-community-1.7.0-java/lib/neo4j-community/jars/neo4j-graph-algo-1.7.jar
|
128
|
+
[loader.0] file:/home/andreas/.rvm/gems/jruby-1.6.7/gems/neo4j-community-1.7.0-java/lib/neo4j-community/jars/org.apache.servicemix.bundles.jline-0.9.94_1.jar
|
129
|
+
[loader.0] file:/home/andreas/.rvm/gems/jruby-1.6.7/gems/neo4j-community-1.7.0-java/lib/neo4j-community/jars/lucene-core-3.5.0.jar
|
130
|
+
[loader.0] file:/home/andreas/.rvm/gems/jruby-1.6.7/gems/neo4j-community-1.7.0-java/lib/neo4j-community/jars/neo4j-cypher-1.7.jar
|
131
|
+
[loader.2] file:/usr/lib/x86_64-linux-gnu/jni/libjava-access-bridge-jni.so.0.0.0
|
132
|
+
[loader.0] file:/home/andreas/.rvm/gems/jruby-1.6.7@global/gems/json-1.6.5-java/lib/json/ext/generator.jar
|
133
|
+
[loader.0] file:/home/andreas/.rvm/gems/jruby-1.6.7/gems/neo4j-community-1.7.0-java/lib/neo4j-community/jars/geronimo-jta_1.1_spec-1.1.1.jar
|
134
|
+
[loader.0] file:/home/andreas/.rvm/gems/jruby-1.6.7/gems/neo4j-community-1.7.0-java/lib/neo4j-community/jars/scala-library-2.9.0-1.jar
|
135
|
+
[loader.2] file:/usr/lib/jvm/java-7-openjdk-common/jre/lib/ext/sunjce_provider.jar
|
136
|
+
[bootstrap] /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/netx.jar
|
137
|
+
[bootstrap] /usr/lib/jvm/java-7-openjdk-amd64/jre/classes
|
138
|
+
[loader.2] file:/usr/share/java/gnome-java-bridge.jar
|
139
|
+
[loader.0] file:/home/andreas/.rvm/gems/jruby-1.6.7/gems/neo4j-community-1.7.0-java/lib/neo4j-community/jars/server-api-1.7.jar
|
140
|
+
[bootstrap] /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar
|
141
|
+
[loader.2] file:/usr/lib/jvm/java-7-openjdk-common/jre/lib/ext/pulse-java.jar
|
142
|
+
[loader.0] file:/home/andreas/.rvm/gems/jruby-1.6.7/gems/neo4j-community-1.7.0-java/lib/neo4j-community/jars/neo4j-graph-matching-1.7.jar
|
143
|
+
[loader.0] file:/home/andreas/.rvm/gems/jruby-1.6.7/gems/neo4j-community-1.7.0-java/lib/neo4j-community/jars/neo4j-shell-1.7.jar
|
144
|
+
[bootstrap] /usr/lib/jvm/java-7-openjdk-common/jre/lib/resources.jar
|
145
|
+
[loader.0] file:/home/andreas/.rvm/gems/jruby-1.6.7/gems/neo4j-community-1.7.0-java/lib/neo4j-community/jars/neo4j-jmx-1.7.jar
|
146
|
+
[classpath + loader.1] file:/home/andreas/projects/neo4j/lib/
|
147
|
+
[loader.0] file:/home/andreas/.rvm/gems/jruby-1.6.7/gems/neo4j-community-1.7.0-java/lib/neo4j-community/jars/neo4j-lucene-index-1.7.jar
|
148
|
+
[loader.2] file:/usr/lib/jvm/java-7-openjdk-common/jre/lib/ext/zipfs.jar
|
149
|
+
2012-04-25 06:42:59.367+0000: Library path:
|
150
|
+
/usr/java/packages/lib/amd64
|
151
|
+
/usr/lib/x86_64-linux-gnu/jni
|
152
|
+
/lib/x86_64-linux-gnu
|
153
|
+
/usr/lib/x86_64-linux-gnu
|
154
|
+
/usr/lib/jni
|
155
|
+
/lib
|
156
|
+
/usr/lib
|
157
|
+
2012-04-25 06:42:59.367+0000: System.properties:
|
158
|
+
jruby.home = /home/andreas/.rvm/rubies/jruby-1.6.7
|
159
|
+
sun.boot.library.path = /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64
|
160
|
+
path.separator = :
|
161
|
+
file.encoding.pkg = sun.io
|
162
|
+
user.country = US
|
163
|
+
sun.java.launcher = SUN_STANDARD
|
164
|
+
sun.os.patch.level = unknown
|
165
|
+
user.dir = /home/andreas/projects/neo4j/lib
|
166
|
+
jdk.home =
|
167
|
+
sun.jnu.encoding = UTF-8
|
168
|
+
jruby.memory.max = 500m
|
169
|
+
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
|
170
|
+
jffi.boot.library.path = /home/andreas/.rvm/rubies/jruby-1.6.7/lib/native/ppc-Linux:/home/andreas/.rvm/rubies/jruby-1.6.7/lib/native/x86_64-Linux:/home/andreas/.rvm/rubies/jruby-1.6.7/lib/native/i386-Linux
|
171
|
+
user.home = /home/andreas
|
172
|
+
user.timezone = Europe/Stockholm
|
173
|
+
file.encoding = UTF-8
|
174
|
+
jruby.stack.max = 2048k
|
175
|
+
jruby.script = jruby
|
176
|
+
user.name = andreas
|
177
|
+
jruby.shell = /bin/sh
|
178
|
+
sun.java.command = org/jruby/Main /home/andreas/.rvm/rubies/jruby-1.6.7/bin/irb
|
179
|
+
sun.arch.data.model = 64
|
180
|
+
user.language = en
|
181
|
+
awt.toolkit = sun.awt.X11.XToolkit
|
182
|
+
file.separator = /
|
183
|
+
sun.io.unicode.encoding = UnicodeLittle
|
184
|
+
sun.cpu.endian = little
|
185
|
+
sun.desktop = gnome
|
186
|
+
sun.cpu.isalist =
|
187
|
+
2012-04-25 06:42:59.368+0000: Linux scheduler information:
|
188
|
+
none
|
189
|
+
none
|
190
|
+
none
|
191
|
+
none
|
192
|
+
none
|
193
|
+
none
|
194
|
+
none
|
195
|
+
none
|
196
|
+
none
|
197
|
+
none
|
198
|
+
none
|
199
|
+
none
|
200
|
+
none
|
201
|
+
none
|
202
|
+
none
|
203
|
+
none
|
204
|
+
none
|
205
|
+
none
|
206
|
+
none
|
207
|
+
none
|
208
|
+
none
|
209
|
+
none
|
210
|
+
none
|
211
|
+
none
|
212
|
+
noop deadline [cfq]
|
213
|
+
noop deadline [cfq]
|
214
|
+
2012-04-25 06:42:59.372+0000: --- STARTUP diagnostics END ---
|
215
|
+
2012-04-25 06:42:59.446+0000: Extension org.neo4j.kernel.KernelExtension[kernel jmx] loaded ok
|
216
|
+
2012-04-25 06:42:59.712+0000: Extension org.neo4j.kernel.KernelExtension[shell] loaded ok
|
217
|
+
2012-04-25 06:42:59.714+0000: Extension org.neo4j.kernel.KernelExtension[kernel udc] loaded ok
|
218
|
+
2012-04-25 06:42:59.717+0000: --- STARTUP diagnostics for KernelDiagnostics:Versions START ---
|
219
|
+
2012-04-25 06:42:59.717+0000: Graph Database: org.neo4j.kernel.EmbeddedGraphDatabase StoreId[time:1335336178947, id:-2172206710464518899, store version: 13561656364791302]
|
220
|
+
2012-04-25 06:42:59.717+0000: Kernel version: Neo4j - Graph Database Kernel 1.7
|
221
|
+
2012-04-25 06:42:59.717+0000: Neo4j component versions:
|
222
|
+
2012-04-25 06:42:59.718+0000: Neo4j - Graph Database Kernel 1.7
|
223
|
+
2012-04-25 06:42:59.718+0000: --- STARTUP diagnostics for KernelDiagnostics:Versions END ---
|
224
|
+
2012-04-25 06:42:59.720+0000: --- STARTUP diagnostics for NEO_STORE_VERSIONS START ---
|
225
|
+
2012-04-25 06:42:59.720+0000: Store versions:
|
226
|
+
Store versions:
|
227
|
+
NeoStore v0.A.0
|
228
|
+
NodeStore v0.A.0
|
229
|
+
RelationshipStore v0.A.0
|
230
|
+
RelationshipTypeStore v0.A.0
|
231
|
+
PropertyStore v0.A.0
|
232
|
+
PropertyIndexStore v0.A.0
|
233
|
+
StringPropertyStore v0.A.0
|
234
|
+
ArrayPropertyStore v0.A.0
|
235
|
+
2012-04-25 06:42:59.720+0000: --- STARTUP diagnostics for NEO_STORE_VERSIONS END ---
|
236
|
+
2012-04-25 06:42:59.720+0000: --- STARTUP diagnostics for NEO_STORE_ID_USAGE START ---
|
237
|
+
2012-04-25 06:42:59.720+0000: Id usage:
|
238
|
+
Id usage:
|
239
|
+
NodeStore: used=1 high=0
|
240
|
+
RelationshipStore: used=0 high=-1
|
241
|
+
RelationshipTypeStore: used=0 high=-1
|
242
|
+
PropertyStore: used=0 high=-1
|
243
|
+
PropertyIndexStore: used=0 high=-1
|
244
|
+
StringPropertyStore: used=1 high=0
|
245
|
+
ArrayPropertyStore: used=1 high=0
|
246
|
+
2012-04-25 06:42:59.721+0000: --- STARTUP diagnostics for NEO_STORE_ID_USAGE END ---
|
247
|
+
2012-04-25 06:42:59.721+0000: --- STARTUP diagnostics for KernelDiagnostics:StoreFiles START ---
|
248
|
+
2012-04-25 06:42:59.721+0000: Storage files:
|
249
|
+
neostore.relationshiptypestore.db.names: 38.00 B
|
250
|
+
neostore.id: 9.00 B
|
251
|
+
neostore.relationshiptypestore.db.names.id: 9.00 B
|
252
|
+
neostore.nodestore.db.id: 9.00 B
|
253
|
+
nioneo_logical.log.1: 16.00 B
|
254
|
+
neostore.propertystore.db.index: 0.00 B
|
255
|
+
neostore.propertystore.db.strings.id: 9.00 B
|
256
|
+
nioneo_logical.log.active: 4.00 B
|
257
|
+
neostore.propertystore.db.strings: 128.00 B
|
258
|
+
neostore.relationshiptypestore.db.id: 9.00 B
|
259
|
+
neostore: 54.00 B
|
260
|
+
neostore.nodestore.db: 9.00 B
|
261
|
+
neostore.propertystore.db.index.keys.id: 9.00 B
|
262
|
+
neostore.propertystore.db.arrays.id: 9.00 B
|
263
|
+
messages.log: 12.14 kB
|
264
|
+
neostore.relationshipstore.db.id: 9.00 B
|
265
|
+
neostore.propertystore.db.arrays: 128.00 B
|
266
|
+
neostore.relationshipstore.db: 0.00 B
|
267
|
+
neostore.propertystore.db.index.id: 9.00 B
|
268
|
+
neostore.propertystore.db.id: 9.00 B
|
269
|
+
neostore.propertystore.db: 0.00 B
|
270
|
+
index:
|
271
|
+
lucene-store.db: 40.00 B
|
272
|
+
lucene.log.1: 16.00 B
|
273
|
+
lucene.log.active: 4.00 B
|
274
|
+
- Total: 60.00 B
|
275
|
+
tm_tx_log.1: 0.00 B
|
276
|
+
neostore.relationshiptypestore.db: 0.00 B
|
277
|
+
lock: 0.00 B
|
278
|
+
active_tx_log: 11.00 B
|
279
|
+
neostore.propertystore.db.index.keys: 38.00 B
|
280
|
+
2012-04-25 06:42:59.723+0000: --- STARTUP diagnostics for KernelDiagnostics:StoreFiles END ---
|
281
|
+
2012-04-25 06:42:59.725+0000: Started - database is now available
|
282
|
+
2012-04-25 06:42:59.725+0000: GC Monitor started.
|
283
|
+
2012-04-25 07:42:59.916+0000: GC Monitor: Application threads blocked for an additional 238ms [total block time: 0.238s]
|
284
|
+
2012-04-25 09:43:00.185+0000: GC Monitor: Application threads blocked for an additional 123ms [total block time: 0.361s]
|
285
|
+
2012-04-25 13:16:52.462+0000: GC Monitor: Application threads blocked for an additional 1977426ms [total block time: 1977.787s]
|
286
|
+
2012-04-25 13:17:15.740+0000: GC Monitor: Application threads blocked for an additional 609ms [total block time: 1978.396s]
|
287
|
+
2012-04-25 13:43:00.715+0000: GC Monitor: Application threads blocked for an additional 142ms [total block time: 1978.538s]
|
288
|
+
2012-04-25 14:43:01.047+0000: GC Monitor: Application threads blocked for an additional 248ms [total block time: 1978.786s]
|
289
|
+
2012-04-25 17:43:01.553+0000: GC Monitor: Application threads blocked for an additional 135ms [total block time: 1978.921s]
|
290
|
+
2012-04-26 06:37:25.006+0000: GC Monitor: Application threads blocked for an additional 44031287ms [total block time: 46010.207s]
|
291
|
+
2012-04-26 08:37:26.005+0000: GC Monitor: Application threads blocked for an additional 825ms [total block time: 46011.03s]
|
292
|
+
2012-04-26 09:37:26.201+0000: GC Monitor: Application threads blocked for an additional 112ms [total block time: 46011.145s]
|
293
|
+
2012-04-26 11:37:26.540+0000: GC Monitor: Application threads blocked for an additional 160ms [total block time: 46011.305s]
|
294
|
+
2012-04-26 13:37:26.871+0000: GC Monitor: Application threads blocked for an additional 152ms [total block time: 46011.457s]
|
295
|
+
2012-04-26 15:37:27.191+0000: GC Monitor: Application threads blocked for an additional 115ms [total block time: 46011.57s]
|
296
|
+
2012-04-26 16:37:27.342+0000: GC Monitor: Application threads blocked for an additional 105ms [total block time: 46011.676s]
|
297
|
+
2012-04-26 18:37:27.643+0000: GC Monitor: Application threads blocked for an additional 146ms [total block time: 46011.824s]
|
298
|
+
2012-04-26 19:10:15.054+0000: GC Monitor: Application threads blocked for an additional 927ms [total block time: 46012.754s]
|
299
|
+
2012-04-26 19:37:27.802+0000: GC Monitor: Application threads blocked for an additional 144ms [total block time: 46012.895s]
|
300
|
+
2012-04-26 19:42:40.923+0000: Stopping - database is now unavailable
|
301
|
+
2012-04-26 19:42:40.932+0000: TM shutting down
|
302
|
+
2012-04-26 19:42:40.963+0000: GC Monitor stopped.
|
303
|
+
2012-04-26 19:42:41.226+0000: Closed log /home/andreas/projects/neo4j/lib/db/index/lucene.log
|
304
|
+
2012-04-26 19:42:41.257+0000: Closed log /home/andreas/projects/neo4j/lib/db/nioneo_logical.log
|
data/lib/db/neostore
ADDED
Binary file
|
data/lib/db/neostore.id
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/db/tm_tx_log.1
ADDED
Binary file
|
@@ -54,14 +54,11 @@ class Neo4j::Generators::ModelGenerator < Neo4j::Generators::Base #:nodoc:
|
|
54
54
|
options[:indices]
|
55
55
|
end
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
txt << %Q{
|
62
|
-
index :#{key}}
|
57
|
+
|
58
|
+
def index_fragment(property)
|
59
|
+
if options[:indices].include?(property)
|
60
|
+
", :index => :exact"
|
63
61
|
end
|
64
|
-
txt
|
65
62
|
end
|
66
63
|
|
67
64
|
def parent?
|
@@ -1,9 +1,7 @@
|
|
1
1
|
class <%= class_name %> < <%= parent? ? options[:parent].classify : "Neo4j::Rails::Model" %>
|
2
2
|
<% attributes.each do |attribute| -%>
|
3
|
-
property :<%= attribute.name %><%= ", :type => #{attribute.type_class}" unless attribute.type_class == 'any' %>
|
3
|
+
property :<%= attribute.name %><%= ", :type => #{attribute.type_class}" unless attribute.type_class == 'any' %><%= index_fragment(attribute.name) %>
|
4
4
|
<% end -%>
|
5
|
-
<%= indices_statements if indices? -%>
|
6
|
-
|
7
5
|
<%= has_n_statements if has_n? -%>
|
8
6
|
<%= has_one_statements if has_one? -%>
|
9
7
|
|
data/lib/neo4j.rb
CHANGED
@@ -15,8 +15,9 @@ require 'active_model'
|
|
15
15
|
require 'neo4j-core'
|
16
16
|
require 'neo4j-wrapper'
|
17
17
|
|
18
|
+
require 'neo4j/type_converters/serialize_converter'
|
18
19
|
require 'neo4j/rails/rails'
|
19
|
-
|
20
|
+
require 'neo4j/paginated'
|
20
21
|
|
21
22
|
require 'orm_adapter/adapters/neo4j'
|
22
23
|
Dir["#{File.dirname(__FILE__)}/tasks/**/*.rake"].each { |ext| load ext } if defined?(Rake) && respond_to?(:namespace)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Neo4j
|
2
|
+
|
3
|
+
# The class provides the pagination based on the given source.
|
4
|
+
# The source must be an Enumerable implementing methods drop, first and count (or size).
|
5
|
+
# This can be used to paginage any Enumerable collection and
|
6
|
+
# provides the integration point for other gems, like will_paginate and kaminari.
|
7
|
+
class Paginated
|
8
|
+
include Enumerable
|
9
|
+
attr_reader :items, :total, :current_page
|
10
|
+
|
11
|
+
def initialize(items, total, current_page)
|
12
|
+
@items, @total, @current_page = items, total, current_page
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.create_from(source, page, per_page)
|
16
|
+
partial = source.drop((page-1) * per_page).first(per_page)
|
17
|
+
Paginated.new(partial, source.count, page)
|
18
|
+
end
|
19
|
+
|
20
|
+
delegate :each, :to => :items
|
21
|
+
delegate :size, :[], :to => :items
|
22
|
+
end
|
23
|
+
end
|
@@ -57,7 +57,7 @@ module Neo4j::Rails
|
|
57
57
|
class_eval %Q{
|
58
58
|
def #{association_name}_id=(id)
|
59
59
|
relation_target_class = self.class._decl_rels[:#{association_name}].target_class
|
60
|
-
association_class = relation_target_class <= self.class ? Neo4j::Rails::Model : relation_target_class
|
60
|
+
association_class = (relation_target_class.nil? || relation_target_class <= self.class) ? Neo4j::Rails::Model : relation_target_class
|
61
61
|
self.#{association_name} = id.present? ? association_class.find(id) : nil
|
62
62
|
end
|
63
63
|
}, __FILE__, __LINE__
|
@@ -26,16 +26,16 @@ module Neo4j
|
|
26
26
|
self.attribute_defaults ||= {}
|
27
27
|
|
28
28
|
# save the original [] and []= to use as read/write to Neo4j
|
29
|
-
alias_method :
|
30
|
-
alias_method :
|
29
|
+
alias_method :read_property_from_db, :[]
|
30
|
+
alias_method :write_property_from_db, :[]=
|
31
31
|
|
32
32
|
# wrap the read/write in type conversion
|
33
|
-
alias_method_chain :
|
34
|
-
alias_method_chain :
|
33
|
+
alias_method_chain :read_attribute, :type_conversion
|
34
|
+
alias_method_chain :write_attribute, :type_conversion
|
35
35
|
|
36
36
|
# whenever we refer to [] or []=. use our local properties store
|
37
|
-
alias_method :[], :
|
38
|
-
alias_method :[]=, :
|
37
|
+
alias_method :[], :read_attribute
|
38
|
+
alias_method :[]=, :write_attribute
|
39
39
|
|
40
40
|
def self.inherited(sub_klass)
|
41
41
|
super
|
@@ -188,7 +188,7 @@ module Neo4j
|
|
188
188
|
|
189
189
|
def property_changed?
|
190
190
|
return !@_properties.empty? unless persisted?
|
191
|
-
!!@_properties.keys.find { |k| self.
|
191
|
+
!!@_properties.keys.find { |k| self._java_entity[k] != @_properties[k] }
|
192
192
|
end
|
193
193
|
|
194
194
|
# Return true if method_name is the name of an appropriate attribute
|
@@ -199,22 +199,22 @@ module Neo4j
|
|
199
199
|
|
200
200
|
|
201
201
|
# Wrap the getter in a conversion from Java to Ruby
|
202
|
-
def
|
203
|
-
self.class._converter(property).to_ruby(
|
202
|
+
def read_attribute_with_type_conversion(property)
|
203
|
+
self.class._converter(property).to_ruby(read_attribute_without_type_conversion(property))
|
204
204
|
end
|
205
205
|
|
206
206
|
# Wrap the setter in a conversion from Ruby to Java
|
207
|
-
def
|
207
|
+
def write_attribute_with_type_conversion(property, value)
|
208
208
|
@_properties_before_type_cast[property.to_sym]=value if self.class._decl_props.has_key? property.to_sym
|
209
209
|
conv_value = self.class._converter(property.to_sym).to_java(value)
|
210
|
-
|
210
|
+
write_attribute_without_type_conversion(property, conv_value)
|
211
211
|
end
|
212
212
|
|
213
213
|
|
214
214
|
# The behaviour of []= changes with a Rails Model, where nothing gets written
|
215
215
|
# to Neo4j until the object is saved, during which time all the validations
|
216
216
|
# and callbacks are run to ensure correctness
|
217
|
-
def
|
217
|
+
def write_attribute(key, value)
|
218
218
|
key_s = key.to_s
|
219
219
|
if !@_properties.has_key?(key_s) || @_properties[key_s] != value
|
220
220
|
attribute_will_change!(key_s)
|
@@ -225,12 +225,12 @@ module Neo4j
|
|
225
225
|
|
226
226
|
# Returns the locally stored value for the key or retrieves the value from
|
227
227
|
# the DB if we don't have one
|
228
|
-
def
|
228
|
+
def read_attribute(key)
|
229
229
|
key = key.to_s
|
230
230
|
if @_properties.has_key?(key)
|
231
231
|
@_properties[key]
|
232
232
|
else
|
233
|
-
@_properties[key] = (
|
233
|
+
@_properties[key] = (!new_record? && _java_entity.has_property?(key)) ? read_property_from_db(key) : attribute_defaults[key]
|
234
234
|
end
|
235
235
|
end
|
236
236
|
|
@@ -244,7 +244,8 @@ module Neo4j
|
|
244
244
|
|
245
245
|
# Declares a property.
|
246
246
|
# It support the following hash options:
|
247
|
-
# <tt>:default</tt>,<tt>:null</tt>,<tt>:limit</tt>,<tt>:type</tt>,<tt>:index</tt>,<tt>:converter</tt
|
247
|
+
# <tt>:default</tt>,<tt>:null</tt>,<tt>:limit</tt>,<tt>:type</tt>,<tt>:index</tt>,<tt>:converter</tt>.
|
248
|
+
# Notice that you do not have to declare properties. You can always set and read properties using the <tt>[]</tt> and <tt>[]=</tt> operators.
|
248
249
|
#
|
249
250
|
# @example Set the property type,
|
250
251
|
# class Person < Neo4j::RailsModel
|
@@ -255,11 +256,12 @@ module Neo4j
|
|
255
256
|
# class Person < Neo4j::RailsModel
|
256
257
|
# property :age, :default => 0
|
257
258
|
# end
|
259
|
+
#
|
258
260
|
# @example
|
259
261
|
# class Person < Neo4j::RailsModel
|
262
|
+
# # Property must be there
|
260
263
|
# property :age, :null => false
|
261
264
|
# end
|
262
|
-
# Property must be there
|
263
265
|
#
|
264
266
|
# @example Property has a length limit
|
265
267
|
# class Person < Neo4j::RailsModel
|
@@ -294,6 +296,8 @@ module Neo4j
|
|
294
296
|
# property :name, :converter => MyConverter
|
295
297
|
# end
|
296
298
|
#
|
299
|
+
# @see Neo4j::TypeConverters::SerializeConverter SerializeConverter for using type => :serialize
|
300
|
+
# @see http://rdoc.info/github/andreasronge/neo4j-wrapper/Neo4j/TypeConverters for converters defined in neo4j-wrapper gem (which is included).
|
297
301
|
def property(*args)
|
298
302
|
options = args.extract_options!
|
299
303
|
args.each do |property_sym|
|
@@ -362,20 +366,24 @@ module Neo4j
|
|
362
366
|
end
|
363
367
|
|
364
368
|
|
369
|
+
def _classname
|
370
|
+
self.class.to_s
|
371
|
+
end
|
372
|
+
|
365
373
|
protected
|
366
374
|
|
367
375
|
|
368
376
|
# Ensure any defaults are stored in the DB
|
369
377
|
def write_default_attributes
|
370
378
|
self.class.attribute_defaults.each do |attribute, value|
|
371
|
-
|
379
|
+
write_property_from_db(attribute, Neo4j::TypeConverters.convert(value, attribute, self.class, false)) unless changed_attributes.has_key?(attribute) || _java_entity.has_property?(attribute)
|
372
380
|
end
|
373
381
|
end
|
374
382
|
|
375
383
|
# Write attributes to the Neo4j DB only if they're altered
|
376
384
|
def write_changed_attributes
|
377
385
|
@_properties.each do |attribute, value|
|
378
|
-
|
386
|
+
write_property_from_db(attribute, value) if changed_attributes.has_key?(attribute)
|
379
387
|
end
|
380
388
|
end
|
381
389
|
|
@@ -390,25 +398,27 @@ module Neo4j
|
|
390
398
|
end
|
391
399
|
end
|
392
400
|
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
401
|
+
if ActiveModel::VERSION::STRING < "3.2.0"
|
402
|
+
# THIS IS ONLY NEEDED IN ACTIVEMODEL < 3.2
|
403
|
+
# To get ActiveModel::Dirty to work, we need to be able to call undeclared
|
404
|
+
# properties as though they have get methods
|
405
|
+
def method_missing(method_id, *args, &block)
|
406
|
+
method_name = method_id.to_s
|
407
|
+
if property?(method_name)
|
408
|
+
self[method_name]
|
409
|
+
else
|
410
|
+
super
|
411
|
+
end
|
402
412
|
end
|
403
413
|
end
|
404
414
|
|
415
|
+
|
405
416
|
def _invalid_attribute_name?(attr_name)
|
406
417
|
attr_name.to_s[0] == ?_ && !self.class._decl_props.include?(attr_name.to_sym)
|
407
418
|
end
|
408
419
|
|
409
420
|
|
410
421
|
|
411
|
-
|
412
422
|
# Instantiates objects for all attribute classes that needs more than one constructor parameter. This is done
|
413
423
|
# by calling new on the column type or aggregation type (through composed_of) object with these parameters.
|
414
424
|
# So having the pairs written_on(1) = "2004", written_on(2) = "6", written_on(3) = "24", will instantiate
|
@@ -505,12 +515,8 @@ module Neo4j
|
|
505
515
|
@changed_attributes.clear
|
506
516
|
end
|
507
517
|
|
508
|
-
def _classname
|
509
|
-
self.class.to_s
|
510
|
-
end
|
511
|
-
|
512
518
|
def _classname=(value)
|
513
|
-
|
519
|
+
write_attribute_without_type_conversion("_classname", value)
|
514
520
|
end
|
515
521
|
|
516
522
|
end
|
data/lib/neo4j/rails/has_n.rb
CHANGED
@@ -14,7 +14,7 @@ module Neo4j
|
|
14
14
|
# See also Neo4j::NodeMixin#has_n which only work with persisted relationships.
|
15
15
|
#
|
16
16
|
# @example
|
17
|
-
# class Thing
|
17
|
+
# class Thing < Neo4j::Rails::Model
|
18
18
|
# has_n(:things)
|
19
19
|
# end
|
20
20
|
#
|
@@ -25,6 +25,7 @@ module Neo4j
|
|
25
25
|
# @example declare a to relationship
|
26
26
|
# class Company
|
27
27
|
# has_n(:employees).to(Person)
|
28
|
+
# # alternative - has_n(:employees).to("Person")
|
28
29
|
# end
|
29
30
|
#
|
30
31
|
# c = Company.new
|
@@ -45,6 +46,17 @@ module Neo4j
|
|
45
46
|
# @example advanced traversal, using Neo4j::Core::Traversal
|
46
47
|
# c._outgoing(Company.employees).outgoing(:friends).depth.each{ }
|
47
48
|
#
|
49
|
+
# @example declare incoming
|
50
|
+
# class Person < Neo4j::Rails::Model
|
51
|
+
# has_n(:likes).to(Song)
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# class Song < Neo4j::Rails::Model
|
55
|
+
# has_n(:people_liking_this_song).from(Person.likes) # or from(Person, likes)
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
# Song.people_liking_this_song.build # creates a Person
|
59
|
+
#
|
48
60
|
# @see Neo4j::Rails::Relationships::NodesDSL
|
49
61
|
def has_n(*args)
|
50
62
|
options = args.extract_options!
|
@@ -56,6 +68,7 @@ module Neo4j
|
|
56
68
|
# @example
|
57
69
|
# class Person
|
58
70
|
# has_one(:friend).to(OtherClass)
|
71
|
+
# has_one(:root).from("SomeOtherClassAsString")
|
59
72
|
# end
|
60
73
|
#
|
61
74
|
# @example
|
@@ -102,8 +102,26 @@ module Neo4j
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
+
# Get the indexed entity, creating it (exactly once) if no indexed entity exist.
|
106
|
+
#
|
107
|
+
# @example Creating a Unique node
|
108
|
+
#
|
109
|
+
# class MyNode < Neo4j::Rails::Model
|
110
|
+
# property :email, :index => :exact, :unique => true
|
111
|
+
# end
|
112
|
+
#
|
113
|
+
# node = MyNode.get_or_create(:email =>'jimmy@gmail.com', :name => 'jimmy')
|
114
|
+
#
|
115
|
+
# @see #put_if_absent
|
116
|
+
def get_or_create(*args)
|
117
|
+
props = args.first
|
118
|
+
raise "Can't get or create entity since #{props.inspect} does not included unique key #{props[unique_factory_key]}'" unless props[unique_factory_key]
|
119
|
+
index = index_for_type(_decl_props[unique_factory_key][:index])
|
120
|
+
Neo4j::Core::Index::UniqueFactory.new(unique_factory_key, index) { |*| create!(*args) }.get_or_create(unique_factory_key, props[unique_factory_key])
|
121
|
+
end
|
122
|
+
|
105
123
|
# Same as #create, but raises an error if there is a problem during save.
|
106
|
-
#
|
124
|
+
# @return [Neo4j::Rails::Model, Neo4j::Rails::Relationship]
|
107
125
|
def create!(*args)
|
108
126
|
new(*args).tap do |o|
|
109
127
|
yield o if block_given?
|
@@ -119,6 +137,11 @@ module Neo4j
|
|
119
137
|
end
|
120
138
|
end
|
121
139
|
|
140
|
+
# Returns if the entity is currently being updated or created
|
141
|
+
def create_or_updating?
|
142
|
+
!!@_create_or_updating
|
143
|
+
end
|
144
|
+
|
122
145
|
protected
|
123
146
|
|
124
147
|
def update
|
@@ -128,6 +151,8 @@ module Neo4j
|
|
128
151
|
end
|
129
152
|
|
130
153
|
def create_or_update
|
154
|
+
# since the same model can be created or updated twice from a relationship we have to have this guard
|
155
|
+
@_create_or_updating = true
|
131
156
|
result = persisted? ? update : create
|
132
157
|
unless result != false
|
133
158
|
Neo4j::Rails::Transaction.fail if Neo4j::Rails::Transaction.running?
|
@@ -135,8 +160,11 @@ module Neo4j
|
|
135
160
|
else
|
136
161
|
true
|
137
162
|
end
|
163
|
+
ensure
|
164
|
+
@_create_or_updating = nil
|
138
165
|
end
|
139
166
|
|
167
|
+
|
140
168
|
def set_deleted_properties
|
141
169
|
@_deleted = true
|
142
170
|
end
|
@@ -42,9 +42,9 @@ module Neo4j
|
|
42
42
|
# @see http://rdoc.info/github/andreasronge/neo4j-core/Neo4j/Core/Relationship#other_node-instance_method
|
43
43
|
def other_node(node)
|
44
44
|
if persisted?
|
45
|
-
_java_rel._other_node(node.
|
45
|
+
_java_rel._other_node(node._java_entity)
|
46
46
|
else
|
47
|
-
@_start_node == (node.
|
47
|
+
@_start_node == (node._java_entity || node) ? @_end_node : @_start_node
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -104,7 +104,7 @@ module Neo4j
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def _persist_node(start_or_end_node)
|
107
|
-
(start_or_end_node.new_record? || start_or_end_node.relationships_changed?) ? start_or_end_node.save : true
|
107
|
+
((start_or_end_node.new_record? || start_or_end_node.relationships_changed?) && !start_or_end_node.create_or_updating?) ? start_or_end_node.save : true
|
108
108
|
end
|
109
109
|
|
110
110
|
end
|
@@ -73,7 +73,7 @@ module Neo4j
|
|
73
73
|
end
|
74
74
|
|
75
75
|
# Allow to access persisted and unpersisted relationships - like the #outgoing and #incoming method.
|
76
|
-
# To only find all the persisted relationship, node.
|
76
|
+
# To only find all the persisted relationship, node._java_entity.rels
|
77
77
|
#
|
78
78
|
# @example
|
79
79
|
# node.outgoing(:foo) << node2
|
@@ -11,6 +11,26 @@ module Neo4j
|
|
11
11
|
# ...
|
12
12
|
# end
|
13
13
|
class Transaction
|
14
|
+
|
15
|
+
# Acquires a write lock for entity for this transaction. The lock (returned from this method) can be released manually, but if not it's released automatically when the transaction finishes.
|
16
|
+
# There is no implementation for this here because it's an java method
|
17
|
+
#
|
18
|
+
# @param [Neo4j::Relationship, Neo4j::Node] java_entity the entity to acquire a lock for. If another transaction currently holds a write lock to that entity this call will wait until it's released.
|
19
|
+
# @return [Java::OrgNeo4jGraphdb::Lock] a Lock which optionally can be used to release this lock earlier than when the transaction finishes. If not released (with Lock.release() it's going to be released with the transaction finishes.
|
20
|
+
# @see http://api.neo4j.org/current/org/neo4j/graphdb/Transaction.html#acquireWriteLock(Java::OrgNeo4jGraphdb::PropertyContainer)
|
21
|
+
# @see http://api.neo4j.org/current/org/neo4j/graphdb/Lock.html
|
22
|
+
def acquire_write_lock(java_entity)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Acquires a read lock for entity for this transaction. The lock (returned from this method) can be released manually, but if not it's released automatically when the transaction finishes.
|
26
|
+
# There is no implementation for this here because it's an java method
|
27
|
+
# @param [Neo4j::Relationship, Neo4j::Node] java_entity the entity to acquire a lock for. If another transaction currently hold a write lock to that entity this call will wait until it's released.
|
28
|
+
# @return [Java::OrgNeo4jGraphdb::Lock] a Lock which optionally can be used to release this lock earlier than when the transaction finishes. If not released (with Lock.release() it's going to be released with the transaction finishes.
|
29
|
+
# @see http://api.neo4j.org/current/org/neo4j/graphdb/Transaction.html#acquireReadLock(Java::OrgNeo4jGraphdb::PropertyContainer)
|
30
|
+
# @see http://api.neo4j.org/current/org/neo4j/graphdb/Lock.html
|
31
|
+
def acquire_read_lock(java_entity)
|
32
|
+
end
|
33
|
+
|
14
34
|
class << self
|
15
35
|
def current
|
16
36
|
Thread.current[:neo4j_transaction]
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#require "activesupport/lib/active_support/core_ext/hash/keys.rb"
|
2
|
+
|
3
|
+
module Neo4j
|
4
|
+
module TypeConverters
|
5
|
+
# Serialize using YAML
|
6
|
+
#
|
7
|
+
# @example Usage from Neo4j::Rails::Model
|
8
|
+
# class Person < Neo4j::Rails::Model
|
9
|
+
# property :stuff, :type => :serialize
|
10
|
+
# end
|
11
|
+
# Person.new(:stuff => {:complex => :things})
|
12
|
+
#
|
13
|
+
# @see http://rdoc.info/github/andreasronge/neo4j-wrapper/Neo4j/TypeConverters for converters defined in neo4j-wrapper gem (which is included).
|
14
|
+
class SerializeConverter
|
15
|
+
# serializes to sting
|
16
|
+
class << self
|
17
|
+
|
18
|
+
def convert?(type)
|
19
|
+
type == :serialize
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_java(value)
|
23
|
+
return nil unless value
|
24
|
+
YAML.dump(value)
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_ruby(value)
|
28
|
+
# from db, to object
|
29
|
+
return nil unless value
|
30
|
+
YAML.load(value)
|
31
|
+
end
|
32
|
+
|
33
|
+
def index_as
|
34
|
+
String
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/neo4j/version.rb
CHANGED
data/neo4j.gemspec
CHANGED
@@ -32,5 +32,5 @@ It comes included with the Apache Lucene document database.
|
|
32
32
|
s.add_dependency('orm_adapter', ">= 0.0.3")
|
33
33
|
s.add_dependency("activemodel", ">= 3.0.0", "< 3.3")
|
34
34
|
s.add_dependency("railties", ">= 3.0.0", "< 3.3")
|
35
|
-
s.add_dependency("neo4j-wrapper", '0.0.
|
35
|
+
s.add_dependency("neo4j-wrapper", '0.0.11')
|
36
36
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: neo4j
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 6
|
5
|
-
version: 2.0.0.alpha.
|
5
|
+
version: 2.0.0.alpha.8
|
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-27 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: orm_adapter
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - "="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.0.
|
62
|
+
version: 0.0.11
|
63
63
|
type: :runtime
|
64
64
|
version_requirements: *id004
|
65
65
|
description: |
|
@@ -93,7 +93,9 @@ files:
|
|
93
93
|
- lib/tasks/upgrade_v2/upgrade_v2.rake
|
94
94
|
- lib/tasks/upgrade_v2/lib/upgrade_v2.rb
|
95
95
|
- lib/orm_adapter/adapters/neo4j.rb
|
96
|
+
- lib/neo4j/paginated.rb
|
96
97
|
- lib/neo4j/version.rb
|
98
|
+
- lib/neo4j/type_converters/serialize_converter.rb
|
97
99
|
- lib/neo4j/rails/attributes.rb
|
98
100
|
- lib/neo4j/rails/rack_middleware.rb
|
99
101
|
- lib/neo4j/rails/model.rb
|
@@ -124,6 +126,44 @@ files:
|
|
124
126
|
- lib/neo4j/rails/validations/associated.rb
|
125
127
|
- lib/neo4j/rails/validations/uniqueness.rb
|
126
128
|
- lib/neo4j/rails/validations/non_nil.rb
|
129
|
+
- lib/db/neostore.relationshiptypestore.db.names
|
130
|
+
- lib/db/neostore.id
|
131
|
+
- lib/db/neostore.relationshiptypestore.db.names.id
|
132
|
+
- lib/db/neostore.nodestore.db.id
|
133
|
+
- lib/db/neostore.propertystore.db.index
|
134
|
+
- lib/db/neostore.propertystore.db.strings.id
|
135
|
+
- lib/db/nioneo_logical.log.active
|
136
|
+
- lib/db/neostore.propertystore.db.strings
|
137
|
+
- lib/db/neostore.relationshiptypestore.db.id
|
138
|
+
- lib/db/neostore
|
139
|
+
- lib/db/neostore.nodestore.db
|
140
|
+
- lib/db/neostore.propertystore.db.index.keys.id
|
141
|
+
- lib/db/neostore.propertystore.db.arrays.id
|
142
|
+
- lib/db/messages.log
|
143
|
+
- lib/db/neostore.relationshipstore.db.id
|
144
|
+
- lib/db/neostore.propertystore.db.arrays
|
145
|
+
- lib/db/neostore.relationshipstore.db
|
146
|
+
- lib/db/neostore.propertystore.db.index.id
|
147
|
+
- lib/db/neostore.propertystore.db.id
|
148
|
+
- lib/db/index.db
|
149
|
+
- lib/db/neostore.propertystore.db
|
150
|
+
- lib/db/tm_tx_log.1
|
151
|
+
- lib/db/neostore.relationshiptypestore.db
|
152
|
+
- lib/db/lock
|
153
|
+
- lib/db/active_tx_log
|
154
|
+
- lib/db/neostore.propertystore.db.index.keys
|
155
|
+
- lib/db/index/lucene-store.db
|
156
|
+
- lib/db/index/lucene.log.active
|
157
|
+
- lib/db/index/lucene/node/Person_fulltext/_0.fdx
|
158
|
+
- lib/db/index/lucene/node/Person_fulltext/segments.gen
|
159
|
+
- lib/db/index/lucene/node/Person_fulltext/_0.frq
|
160
|
+
- lib/db/index/lucene/node/Person_fulltext/_0.nrm
|
161
|
+
- lib/db/index/lucene/node/Person_fulltext/_0.fdt
|
162
|
+
- lib/db/index/lucene/node/Person_fulltext/_0.tis
|
163
|
+
- lib/db/index/lucene/node/Person_fulltext/_0.tii
|
164
|
+
- lib/db/index/lucene/node/Person_fulltext/segments_1
|
165
|
+
- lib/db/index/lucene/node/Person_fulltext/_0.prx
|
166
|
+
- lib/db/index/lucene/node/Person_fulltext/_0.fnm
|
127
167
|
- config/locales/en.yml
|
128
168
|
- config/neo4j/config.yml
|
129
169
|
- README.rdoc
|