neo4j-core 3.0.0.alpha.7 → 3.0.0.alpha.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/README.md +10 -0
- data/lib/neo4j/label.rb +33 -0
- data/lib/neo4j-core/version.rb +1 -1
- data/lib/neo4j-embedded/embedded_label.rb +1 -1
- data/lib/neo4j-server/cypher_label.rb +1 -1
- data/lib/neo4j-server/cypher_session.rb +1 -1
- data/neo4j-core.gemspec +2 -1
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25b0be124fa4f41c0d4fd9326c5711ca7d094ce6
|
4
|
+
data.tar.gz: a2aefe6c77b194f4296ae74efed3365b2bdb1aa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 131b612496659cfc56fac4d950621e4e9ce0227a910c35b502e9234507df67485e75840abe918caf9a36da1fa306ac41db5a51787393daf9ef98881ce952b65f
|
7
|
+
data.tar.gz: e36089a513af01b0651c97494fa16efb7ebc490253f5fb2991185445b1b83e93564d6890e5858e4c36e6da4b4e3866e47db803d0d1ca0b492224f87130be92e4
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -120,6 +120,16 @@ Add index on a label
|
|
120
120
|
red.indexes # => {:property_keys => [[:age]]}
|
121
121
|
```
|
122
122
|
|
123
|
+
Constraints
|
124
|
+
|
125
|
+
Only unique constraint and single property is supported (yet).
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
label = Neo4j::Label.create(:person)
|
129
|
+
label.create_constraint(:name, type: :unique)
|
130
|
+
label.drop_constraint(:name, type: :unique)
|
131
|
+
```
|
132
|
+
|
123
133
|
### Creating Nodes
|
124
134
|
|
125
135
|
```ruby
|
data/lib/neo4j/label.rb
CHANGED
@@ -22,6 +22,39 @@ module Neo4j
|
|
22
22
|
raise 'not implemented'
|
23
23
|
end
|
24
24
|
|
25
|
+
# Creates a neo4j constraint on a property
|
26
|
+
# See http://docs.neo4j.org/chunked/stable/query-constraints.html
|
27
|
+
# @example
|
28
|
+
# label = Neo4j::Label.create(:person, session)
|
29
|
+
# label.create_constraint(:name, {type: :unique}, session)
|
30
|
+
#
|
31
|
+
def create_constraint(property, constraints, session = Neo4j::Session.current)
|
32
|
+
cypher = case constraints[:type]
|
33
|
+
when :unique
|
34
|
+
"CREATE CONSTRAINT ON (n:`#{name}`) ASSERT n.`#{property}` IS UNIQUE"
|
35
|
+
else
|
36
|
+
raise "Not supported constrain #{constraints.inspect} for property #{property} (expected :type => :unique)"
|
37
|
+
end
|
38
|
+
session._query_or_fail(cypher)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Drops a neo4j constraint on a property
|
42
|
+
# See http://docs.neo4j.org/chunked/stable/query-constraints.html
|
43
|
+
# @example
|
44
|
+
# label = Neo4j::Label.create(:person, session)
|
45
|
+
# label.create_constraint(:name, {type: :unique}, session)
|
46
|
+
# label.drop_constraint(:name, {type: :unique}, session)
|
47
|
+
#
|
48
|
+
def drop_constraint(property, constraint, session = Neo4j::Session.current)
|
49
|
+
cypher = case constraint[:type]
|
50
|
+
when :unique
|
51
|
+
"DROP CONSTRAINT ON (n:`#{name}`) ASSERT n.`#{property}` IS UNIQUE"
|
52
|
+
else
|
53
|
+
raise "Not supported constrain #{constraint.inspect}"
|
54
|
+
end
|
55
|
+
session._query_or_fail(cypher)
|
56
|
+
end
|
57
|
+
|
25
58
|
class << self
|
26
59
|
include Neo4j::Core::CypherTranslator
|
27
60
|
|
data/lib/neo4j-core/version.rb
CHANGED
@@ -2,7 +2,7 @@ module Neo4j::Server
|
|
2
2
|
|
3
3
|
# Plugin
|
4
4
|
Neo4j::Session.register_db(:server_db) do |endpoint_url|
|
5
|
-
response = HTTParty.get(endpoint_url)
|
5
|
+
response = HTTParty.get(endpoint_url || 'http://localhost:7474')
|
6
6
|
raise "Server not available on #{endpoint_url} (response code #{response.code})" unless response.code == 200
|
7
7
|
root_data = JSON.parse(response.body)
|
8
8
|
Neo4j::Server::CypherSession.new(root_data['data'])
|
data/neo4j-core.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.summary = "A graph database for JRuby"
|
16
16
|
s.description = <<-EOF
|
17
17
|
You can think of Neo4j as a high-performance graph engine with all the features of a mature and robust database.
|
18
|
-
The programmer works with an object-oriented, flexible network structure rather than with strict and static tables
|
18
|
+
The programmer works with an object-oriented, flexible network structure rather than with strict and static tables
|
19
19
|
yet enjoys all the benefits of a fully transactional, enterprise-strength database.
|
20
20
|
It comes included with the Apache Lucene document database.
|
21
21
|
EOF
|
@@ -29,6 +29,7 @@ It comes included with the Apache Lucene document database.
|
|
29
29
|
# Not released yet
|
30
30
|
s.add_dependency("httparty")
|
31
31
|
s.add_dependency("json")
|
32
|
+
s.add_dependency("os")
|
32
33
|
s.add_dependency("neo4j-cypher")
|
33
34
|
|
34
35
|
if RUBY_PLATFORM =~ /java/
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neo4j-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.alpha.
|
4
|
+
version: 3.0.0.alpha.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Ronge
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: os
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: neo4j-cypher
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,11 +66,11 @@ dependencies:
|
|
52
66
|
- - '>='
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
|
-
description:
|
56
|
-
features of a mature and robust database
|
57
|
-
flexible network structure rather than with strict and static tables
|
58
|
-
all the benefits of a fully transactional, enterprise-strength database
|
59
|
-
included with the Apache Lucene document database
|
69
|
+
description: |
|
70
|
+
You can think of Neo4j as a high-performance graph engine with all the features of a mature and robust database.
|
71
|
+
The programmer works with an object-oriented, flexible network structure rather than with strict and static tables
|
72
|
+
yet enjoys all the benefits of a fully transactional, enterprise-strength database.
|
73
|
+
It comes included with the Apache Lucene document database.
|
60
74
|
email: andreas.ronge@gmail.com
|
61
75
|
executables: []
|
62
76
|
extensions: []
|