neo4j_legacy 7.2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +1357 -0
- data/CONTRIBUTORS +8 -0
- data/Gemfile +38 -0
- data/README.md +103 -0
- data/bin/neo4j-jars +33 -0
- data/bin/rake +17 -0
- data/config/locales/en.yml +5 -0
- data/config/neo4j/add_classnames.yml +1 -0
- data/config/neo4j/config.yml +35 -0
- data/lib/active_support/per_thread_registry.rb +1 -0
- data/lib/backports/action_controller/metal/strong_parameters.rb +672 -0
- data/lib/backports/active_model/forbidden_attributes_protection.rb +30 -0
- data/lib/backports/active_support/concern.rb +13 -0
- data/lib/backports/active_support/core_ext/module/attribute_accessors.rb +10 -0
- data/lib/backports/active_support/logger.rb +99 -0
- data/lib/backports/active_support/logger_silence.rb +27 -0
- data/lib/backports/active_support/logger_thread_safe_level.rb +32 -0
- data/lib/backports/active_support/per_thread_registry.rb +60 -0
- data/lib/backports.rb +4 -0
- data/lib/neo4j/active_node/callbacks.rb +8 -0
- data/lib/neo4j/active_node/dependent/association_methods.rb +48 -0
- data/lib/neo4j/active_node/dependent/query_proxy_methods.rb +50 -0
- data/lib/neo4j/active_node/dependent.rb +11 -0
- data/lib/neo4j/active_node/enum.rb +29 -0
- data/lib/neo4j/active_node/has_n/association/rel_factory.rb +61 -0
- data/lib/neo4j/active_node/has_n/association/rel_wrapper.rb +23 -0
- data/lib/neo4j/active_node/has_n/association.rb +280 -0
- data/lib/neo4j/active_node/has_n/association_cypher_methods.rb +108 -0
- data/lib/neo4j/active_node/has_n.rb +532 -0
- data/lib/neo4j/active_node/id_property/accessor.rb +62 -0
- data/lib/neo4j/active_node/id_property.rb +187 -0
- data/lib/neo4j/active_node/initialize.rb +21 -0
- data/lib/neo4j/active_node/labels/index.rb +87 -0
- data/lib/neo4j/active_node/labels/reloading.rb +21 -0
- data/lib/neo4j/active_node/labels.rb +198 -0
- data/lib/neo4j/active_node/node_wrapper.rb +52 -0
- data/lib/neo4j/active_node/orm_adapter.rb +82 -0
- data/lib/neo4j/active_node/persistence.rb +175 -0
- data/lib/neo4j/active_node/property.rb +60 -0
- data/lib/neo4j/active_node/query/query_proxy.rb +361 -0
- data/lib/neo4j/active_node/query/query_proxy_eager_loading.rb +61 -0
- data/lib/neo4j/active_node/query/query_proxy_enumerable.rb +90 -0
- data/lib/neo4j/active_node/query/query_proxy_find_in_batches.rb +19 -0
- data/lib/neo4j/active_node/query/query_proxy_link.rb +117 -0
- data/lib/neo4j/active_node/query/query_proxy_methods.rb +210 -0
- data/lib/neo4j/active_node/query/query_proxy_methods_of_mass_updating.rb +83 -0
- data/lib/neo4j/active_node/query.rb +76 -0
- data/lib/neo4j/active_node/query_methods.rb +65 -0
- data/lib/neo4j/active_node/reflection.rb +86 -0
- data/lib/neo4j/active_node/rels.rb +11 -0
- data/lib/neo4j/active_node/scope.rb +146 -0
- data/lib/neo4j/active_node/unpersisted.rb +48 -0
- data/lib/neo4j/active_node/validations.rb +59 -0
- data/lib/neo4j/active_node.rb +105 -0
- data/lib/neo4j/active_rel/callbacks.rb +15 -0
- data/lib/neo4j/active_rel/initialize.rb +28 -0
- data/lib/neo4j/active_rel/persistence/query_factory.rb +95 -0
- data/lib/neo4j/active_rel/persistence.rb +114 -0
- data/lib/neo4j/active_rel/property.rb +95 -0
- data/lib/neo4j/active_rel/query.rb +95 -0
- data/lib/neo4j/active_rel/rel_wrapper.rb +22 -0
- data/lib/neo4j/active_rel/related_node.rb +83 -0
- data/lib/neo4j/active_rel/types.rb +82 -0
- data/lib/neo4j/active_rel/validations.rb +8 -0
- data/lib/neo4j/active_rel.rb +67 -0
- data/lib/neo4j/class_arguments.rb +39 -0
- data/lib/neo4j/config.rb +124 -0
- data/lib/neo4j/core/query.rb +22 -0
- data/lib/neo4j/errors.rb +28 -0
- data/lib/neo4j/migration.rb +127 -0
- data/lib/neo4j/paginated.rb +27 -0
- data/lib/neo4j/railtie.rb +169 -0
- data/lib/neo4j/schema/operation.rb +91 -0
- data/lib/neo4j/shared/attributes.rb +220 -0
- data/lib/neo4j/shared/callbacks.rb +64 -0
- data/lib/neo4j/shared/cypher.rb +37 -0
- data/lib/neo4j/shared/declared_properties.rb +204 -0
- data/lib/neo4j/shared/declared_property/index.rb +37 -0
- data/lib/neo4j/shared/declared_property.rb +118 -0
- data/lib/neo4j/shared/enum.rb +148 -0
- data/lib/neo4j/shared/filtered_hash.rb +79 -0
- data/lib/neo4j/shared/identity.rb +28 -0
- data/lib/neo4j/shared/initialize.rb +28 -0
- data/lib/neo4j/shared/marshal.rb +23 -0
- data/lib/neo4j/shared/mass_assignment.rb +58 -0
- data/lib/neo4j/shared/permitted_attributes.rb +28 -0
- data/lib/neo4j/shared/persistence.rb +231 -0
- data/lib/neo4j/shared/property.rb +220 -0
- data/lib/neo4j/shared/query_factory.rb +101 -0
- data/lib/neo4j/shared/rel_type_converters.rb +43 -0
- data/lib/neo4j/shared/serialized_properties.rb +30 -0
- data/lib/neo4j/shared/type_converters.rb +418 -0
- data/lib/neo4j/shared/typecasted_attributes.rb +98 -0
- data/lib/neo4j/shared/typecaster.rb +53 -0
- data/lib/neo4j/shared/validations.rb +48 -0
- data/lib/neo4j/shared.rb +51 -0
- data/lib/neo4j/tasks/migration.rake +24 -0
- data/lib/neo4j/timestamps/created.rb +9 -0
- data/lib/neo4j/timestamps/updated.rb +9 -0
- data/lib/neo4j/timestamps.rb +11 -0
- data/lib/neo4j/type_converters.rb +7 -0
- data/lib/neo4j/version.rb +3 -0
- data/lib/neo4j/wrapper.rb +4 -0
- data/lib/neo4j.rb +96 -0
- data/lib/rails/generators/neo4j/model/model_generator.rb +86 -0
- data/lib/rails/generators/neo4j/model/templates/model.erb +15 -0
- data/lib/rails/generators/neo4j_generator.rb +67 -0
- data/neo4j.gemspec +43 -0
- metadata +389 -0
data/CONTRIBUTORS
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
# if ENV['CI']
|
6
|
+
# gem 'neo4j-core', github: 'neo4jrb/neo4j-core', branch: 'master'
|
7
|
+
# gem 'neo4j-rake_tasks', github: 'neo4jrb/neo4j-rake_tasks', branch: 'master'
|
8
|
+
# end
|
9
|
+
|
10
|
+
# gem 'active_attr', github: 'neo4jrb/active_attr', branch: 'performance'
|
11
|
+
# gem 'active_attr', path: '../active_attr'
|
12
|
+
|
13
|
+
gem 'listen', '< 3.1'
|
14
|
+
|
15
|
+
if RUBY_VERSION.to_f < 2.2
|
16
|
+
gem 'activemodel', '~> 3.2'
|
17
|
+
gem 'activesupport', '~> 3.2'
|
18
|
+
gem 'railties', '~> 3.2'
|
19
|
+
end
|
20
|
+
|
21
|
+
group 'test' do
|
22
|
+
gem 'coveralls', require: false
|
23
|
+
if RUBY_VERSION.to_f < 2.0
|
24
|
+
gem 'tins', '< 1.7'
|
25
|
+
gem 'overcommit', '< 0.35.0'
|
26
|
+
else
|
27
|
+
gem 'overcommit'
|
28
|
+
end
|
29
|
+
gem 'codecov', require: false
|
30
|
+
gem 'simplecov', require: false
|
31
|
+
gem 'simplecov-html', require: false
|
32
|
+
gem 'rspec', '~> 3.4'
|
33
|
+
gem 'its'
|
34
|
+
gem 'test-unit'
|
35
|
+
gem 'colored'
|
36
|
+
gem 'dotenv'
|
37
|
+
gem 'timecop'
|
38
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
# Welcome to Neo4j.rb
|
2
|
+
|
3
|
+
## Code Status
|
4
|
+
|
5
|
+
[![Build Status](https://secure.travis-ci.org/neo4jrb/neo4j.png?branch=master)](http://travis-ci.org/neo4jrb/neo4j) [![Coverage Status](https://coveralls.io/repos/neo4jrb/neo4j/badge.png?branch=master)](https://coveralls.io/r/neo4jrb/neo4j?branch=master) [![Code Climate](https://codeclimate.com/github/neo4jrb/neo4j.png)](https://codeclimate.com/github/neo4jrb/neo4j) [![PullReview stats](https://www.pullreview.com/github/neo4jrb/neo4j/badges/master.svg?)](https://www.pullreview.com/github/neo4jrb/neo4j/reviews/master)
|
6
|
+
|
7
|
+
## Issues
|
8
|
+
|
9
|
+
[![Next Release](https://badge.waffle.io/neo4jrb/neo4j.png?label=Next%20Release&title=Next%20Release) ![In Progress](https://badge.waffle.io/neo4jrb/neo4j.png?label=In%20Progress&title=In%20Progress) ![In Master](https://badge.waffle.io/neo4jrb/neo4j.png?label=In%20Master&title=In%20Master)](https://waffle.io/neo4jrb/neo4j)
|
10
|
+
|
11
|
+
[![Post an issue](https://img.shields.io/badge/Bug%3F-Post%20an%20issue!-blue.svg)](https://waffle.io/neo4jrb/neo4j)
|
12
|
+
|
13
|
+
## Get Support
|
14
|
+
|
15
|
+
### Documentation
|
16
|
+
|
17
|
+
All new documentation will be done via our [readthedocs](http://neo4jrb.readthedocs.org) site, though some old documentation has yet to be moved from our [wiki](https://github.com/neo4jrb/neo4j/wiki) (also there is the [neo4j-core wiki](https://github.com/neo4jrb/neo4j-core/wiki))
|
18
|
+
|
19
|
+
### Contact Us
|
20
|
+
|
21
|
+
[![StackOverflow](https://img.shields.io/badge/StackOverflow-Ask%20a%20question!-blue.svg)](http://stackoverflow.com/questions/ask?tags=neo4j.rb+neo4j+ruby) [![Gitter](https://img.shields.io/badge/Gitter-Join%20our%20chat!-blue.svg)](https://gitter.im/neo4jrb/neo4j?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Twitter](https://img.shields.io/badge/Twitter-Tweet%20with%20us!-blue.svg)](https://twitter.com/neo4jrb)
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
# Introduction
|
26
|
+
|
27
|
+
Neo4j.rb is an Active Model compliant Ruby/JRuby wrapper for [the Neo4j graph database](http://www.neo4j.org/). It uses the [neo4j-core](https://github.com/neo4jrb/neo4j-core) and [active_attr](https://github.com/cgriego/active_attr) gems.
|
28
|
+
|
29
|
+
Neo4j is a transactional, open-source graph database. A graph database manages data in a connected data structure, capable of representing any kind of data in a very accessible way. Information is stored in nodes and relationships connecting them, both of which can have arbitrary properties. To learn more visit [What is a Graph Database?](http://neo4j.com/developer/graph-database/)
|
30
|
+
|
31
|
+
With this gem you not only do you get a convenient higher level wrapper around Neo4j, but you have access to a powerful high-level query building interface which lets you take advantage of the power of Neo4j like this:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
# Break down the top countries where friends' favorite beers come from
|
35
|
+
person.friends.favorite_beers.country_of_origin(:country).
|
36
|
+
order('count(country) DESC').
|
37
|
+
pluck(:country, count: 'count(country)')
|
38
|
+
```
|
39
|
+
|
40
|
+
It can be installed in your `Gemfile` with a simple `gem 'neo4j'`
|
41
|
+
|
42
|
+
For a general overview see our website: http://neo4jrb.io/
|
43
|
+
|
44
|
+
Winner of a 2014 Graphie for "Best Community Contribution" at Neo4j's [Graph Connect](http://graphconnect.com) conference!
|
45
|
+
![2014 Graphie](http://i.imgur.com/CkOoTTYm.jpg)
|
46
|
+
|
47
|
+
Neo4j.rb v4.1.0 was released in January of 2015. Its changes are outlined [here](https://github.com/neo4jrb/neo4j/wiki/Neo4j.rb-v4-Introduction) and in the [announcement message](http://neo4jrb.io/blog/2015/01/09/neo4j-rb_v4-1_released.html). It will take a little time before all documentation is updated to reflect the new release but unless otherwise noted, all 3.X documentation is totally valid for v4.
|
48
|
+
|
49
|
+
## Neo4j version support
|
50
|
+
|
51
|
+
| **Neo4j Version** | v2.x | v3.x | >= v4.x |
|
52
|
+
|-------------------|------|-------|---------|
|
53
|
+
| 1.9.x | Yes | No | No |
|
54
|
+
| 2.0.x | No | Yes | No |
|
55
|
+
| 2.1.x | No | Yes | Yes * |
|
56
|
+
| 2.2.x | No | No | Yes |
|
57
|
+
| 2.3.x | No | No | Yes |
|
58
|
+
|
59
|
+
`*` Neo4j.rb >= 4.x doesn't support Neo4j versions before 2.1.5. To use 2.1.x you should upgrade to a version >= 2.1.5
|
60
|
+
|
61
|
+
## Neo4j feature support
|
62
|
+
|
63
|
+
| **Neo4j Feature** | v2.x | v3.x | >= v4.x |
|
64
|
+
|----------------------------|--------|------|---------|
|
65
|
+
| Auth | No | No | Yes |
|
66
|
+
| Remote Cypher | Yes | Yes | Yes |
|
67
|
+
| Transactions | Yes | Yes | Yes |
|
68
|
+
| High Availability | No | Yes | Yes |
|
69
|
+
| Embedded JVM support | Yes | Yes | Yes |
|
70
|
+
|
71
|
+
## Modern (3.x/4.X) Documentation
|
72
|
+
|
73
|
+
* [Website](http://neo4jrb.io/) (for an introduction)
|
74
|
+
* [Wiki](https://github.com/neo4jrb/neo4j/wiki/Neo4j.rb-v4-Introduction)
|
75
|
+
|
76
|
+
## Legacy (2.x) Documentation
|
77
|
+
|
78
|
+
* [README](https://github.com/neo4jrb/neo4j/tree/2.x)
|
79
|
+
* [Wiki](https://github.com/neo4jrb/neo4j/wiki/Neo4j%3A%3ARails-Introduction)
|
80
|
+
|
81
|
+
## Developers
|
82
|
+
|
83
|
+
### Original Author
|
84
|
+
|
85
|
+
* [Andreas Ronge](https://github.com/andreasronge)
|
86
|
+
|
87
|
+
### Current Maintainers
|
88
|
+
|
89
|
+
* [Brian Underwood](https://github.com/cheerfulstoic)
|
90
|
+
* [Chris Grigg](https://github.com/subvertallchris)
|
91
|
+
|
92
|
+
* Consulting support? Contact [Chris](http://subvertallmedia.com/) and/or [Brian](http://www.brian-underwood.codes/)
|
93
|
+
|
94
|
+
## Contributing
|
95
|
+
|
96
|
+
Always welcome! Please review the [guidelines for contributing](CONTRIBUTING.md) to this repository.
|
97
|
+
|
98
|
+
## License
|
99
|
+
|
100
|
+
* Neo4j.rb - MIT, see the [LICENSE](http://github.com/andreasronge/neo4j/tree/master/LICENSE).
|
101
|
+
* Neo4j - Dual free software/commercial license, see [Licensing Guide](http://www.neo4j.org/learn/licensing).
|
102
|
+
|
103
|
+
**Notice:** There are different licenses for the `neo4j-community`, `neo4j-advanced`, and `neo4j-enterprise` jar gems. Only the `neo4j-community` gem is required by default.
|
data/bin/neo4j-jars
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'neo4j'
|
4
|
+
|
5
|
+
if ARGV.length == 0
|
6
|
+
puts <<TEXT
|
7
|
+
A tool for copying jar files needed by the application server, like trinidad
|
8
|
+
It copies all jar files which has been required (neo4j-community, neo4j-advanced or neo4j-enterprise) to the lib folder of the current directory
|
9
|
+
|
10
|
+
Usage: neo4j-jars <community|advanced|enterprise>
|
11
|
+
|
12
|
+
TEXT
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
|
16
|
+
if ARGV.include?('community')
|
17
|
+
require 'neo4j-community' # not really needed
|
18
|
+
elsif ARGV.include?('advanced')
|
19
|
+
require 'neo4j-advanced' # not really needed
|
20
|
+
elsif ARGV.include?('enterprise')
|
21
|
+
require 'neo4j-enterprise' # not really needed
|
22
|
+
else
|
23
|
+
puts 'Expected community, advanced, enterprise'
|
24
|
+
exit(-1)
|
25
|
+
end
|
26
|
+
|
27
|
+
lib_dir = File.join(Dir.pwd, 'lib')
|
28
|
+
fail "Expected a lib folder where to copy the jars file, mkdir #{lib_dir}? " unless File.exist?(lib_dir)
|
29
|
+
|
30
|
+
files = $CLASSPATH.find_all { |x| x =~ /\.jar$/ }.collect { |y| y.sub('file:', '') }
|
31
|
+
files.each { |file| FileUtils.cp(file, lib_dir) }
|
32
|
+
|
33
|
+
puts "copied #{files.size} files to #{lib_dir}"
|
data/bin/rake
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'rake' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'pathname'
|
11
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require 'rubygems'
|
15
|
+
require 'bundler/setup'
|
16
|
+
|
17
|
+
load Gem.bin_path('rake', 'rake')
|
@@ -0,0 +1 @@
|
|
1
|
+
# This file is used as the source for adding _classname properties to nodes and relationships.
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#=== Neo4j.rb configuration settings
|
2
|
+
|
3
|
+
|
4
|
+
# Examples of not using the Neo4j id (neo_id)
|
5
|
+
|
6
|
+
# Generated UUID stored as a neo4j property on my_id
|
7
|
+
#id_property: my_id
|
8
|
+
#id_property_type: :auto
|
9
|
+
#id_property_type_value: :uuid
|
10
|
+
|
11
|
+
# Example, (probably more useful directly on Neo4j::ActiveNode classes instead as a global configuration)
|
12
|
+
#id_property: title_id
|
13
|
+
#id_property_type: :on
|
14
|
+
#id_property_type_value: :some_method
|
15
|
+
|
16
|
+
# TODO
|
17
|
+
# if identity map should be on or not
|
18
|
+
# It may impact the performance. Using the identity map will keep all loaded wrapper node/relationship
|
19
|
+
# object in memory for each thread and transaction - which may speed up or slow down operations.
|
20
|
+
identity_map: false
|
21
|
+
|
22
|
+
# TODO
|
23
|
+
# When using the Neo4j::Model you can let neo4j automatically set timestamps when updating/creating nodes.
|
24
|
+
# If set to true neo4j.rb automatically timestamps create and update operations if the model has properties named created_at/created_on or updated_at/updated_on
|
25
|
+
# (similar to ActiveRecord).
|
26
|
+
timestamps: true
|
27
|
+
|
28
|
+
# Store a property on objects to cache their ActiveNode/ActiveRel class. It prevents each object load from requiring two database queries.
|
29
|
+
# Strings shorter than 44 characters are classified, so this will have almost no impact on disk footprint. See http://docs.neo4j.org/chunked/stable/short-strings.html.
|
30
|
+
# Alternatively, call class method Neo4j::ActiveNode:cache_class to set this on specific models.
|
31
|
+
# By default, this property is called _classname, set as symbol to override.
|
32
|
+
cache_class_names: true
|
33
|
+
# class_name_property: :_classname
|
34
|
+
|
35
|
+
transform_rel_type: :upcase
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'backports/active_support/per_thread_registry'
|