neo4j-http 1.0.2 → 1.0.3.then
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.
- checksums.yaml +4 -4
- data/lib/neo4j/http/node.rb +2 -1
- data/lib/neo4j/http/object_wrapper.rb +2 -3
- data/lib/neo4j/http/relationship.rb +4 -0
- data/lib/neo4j/http/relationship_client.rb +24 -2
- data/lib/neo4j/http/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c6361dc6d81de2e607be371cfdd59fa838152dc7ed68e560635801784e2b3ba
|
4
|
+
data.tar.gz: 6bc360768784964956d83a41f3f4e12ec4f8f8e028121f2b7541d1aa37acc723
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06a57ce8467c37b95db9752ba39e1e5535bca5e71edfdb858d5b62fc1516310260d365594b859399211061c446fc8a2d7cc5f4fee36085f29f0fbf2d44730630
|
7
|
+
data.tar.gz: 9205861cdcc7517bdd544cd89c34ce37f20d9243745c3938b56127686438a0aeb26a8a057117af25971a04a7c70dab4c957be0ba195880ed29f23e027bcb221f
|
data/lib/neo4j/http/node.rb
CHANGED
@@ -4,8 +4,9 @@ module Neo4j
|
|
4
4
|
module Http
|
5
5
|
class Node < ObjectWrapper
|
6
6
|
DEFAULT_PRIMARY_KEY_NAME = "uuid"
|
7
|
-
def initialize(label:,
|
7
|
+
def initialize(label:, primary_key_name: DEFAULT_PRIMARY_KEY_NAME, **attributes)
|
8
8
|
super
|
9
|
+
@key_value = @attributes.delete(key_name)
|
9
10
|
end
|
10
11
|
end
|
11
12
|
end
|
@@ -9,11 +9,10 @@ module Neo4j
|
|
9
9
|
:label,
|
10
10
|
:original_attributes
|
11
11
|
|
12
|
-
def initialize(label:,
|
12
|
+
def initialize(label:, primary_key_name: nil, **attributes)
|
13
13
|
@original_attributes = (attributes || {}).with_indifferent_access
|
14
14
|
@attributes = original_attributes.dup.with_indifferent_access
|
15
|
-
@key_name =
|
16
|
-
@key_value = @attributes.delete(key_name)
|
15
|
+
@key_name = primary_key_name
|
17
16
|
@label = label
|
18
17
|
end
|
19
18
|
|
@@ -43,7 +43,7 @@ module Neo4j
|
|
43
43
|
results&.first
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
46
|
+
def find_relationships(from:, relationship:, to:)
|
47
47
|
from_match_clause = build_match_selector(:from, from)
|
48
48
|
to_match_clause = build_match_selector(:to, to)
|
49
49
|
relationship_clause = build_match_selector(:relationship, relationship)
|
@@ -52,13 +52,17 @@ module Neo4j
|
|
52
52
|
RETURN from, to, relationship
|
53
53
|
CYPHER
|
54
54
|
|
55
|
-
|
55
|
+
@cypher_client.execute_cypher(
|
56
56
|
cypher,
|
57
57
|
from: from,
|
58
58
|
to: to,
|
59
59
|
relationship: relationship,
|
60
60
|
access_mode: "READ"
|
61
61
|
)
|
62
|
+
end
|
63
|
+
|
64
|
+
def find_relationship(from:, relationship:, to:)
|
65
|
+
results = find_relationships(from: from, to: to, relationship: relationship)
|
62
66
|
results&.first
|
63
67
|
end
|
64
68
|
|
@@ -72,6 +76,7 @@ module Neo4j
|
|
72
76
|
from_selector = build_match_selector(:from, from)
|
73
77
|
to_selector = build_match_selector(:to, to)
|
74
78
|
relationship_selector = build_match_selector(:relationship, relationship)
|
79
|
+
|
75
80
|
cypher = <<-CYPHER
|
76
81
|
MATCH (#{from_selector}) - [#{relationship_selector}] - (#{to_selector})
|
77
82
|
WITH from, to, relationship
|
@@ -82,6 +87,23 @@ module Neo4j
|
|
82
87
|
results = @cypher_client.execute_cypher(cypher, from: from, to: to)
|
83
88
|
results&.first
|
84
89
|
end
|
90
|
+
|
91
|
+
def delete_relationship_on_primary_key(relationship:)
|
92
|
+
# protection against mass deletion of relationships
|
93
|
+
return if relationship.key_name.nil?
|
94
|
+
|
95
|
+
relationship_selector = build_match_selector(:relationship, relationship)
|
96
|
+
|
97
|
+
cypher = <<-CYPHER
|
98
|
+
MATCH () - [#{relationship_selector}] - ()
|
99
|
+
WITH relationship
|
100
|
+
DELETE relationship
|
101
|
+
RETURN relationship
|
102
|
+
CYPHER
|
103
|
+
|
104
|
+
results = @cypher_client.execute_cypher(cypher, relationship: relationship)
|
105
|
+
results&.first
|
106
|
+
end
|
85
107
|
end
|
86
108
|
end
|
87
109
|
end
|
data/lib/neo4j/http/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neo4j-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3.then
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Stawarz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -121,9 +121,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: 2.3.0
|
122
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
|
-
- - "
|
124
|
+
- - ">"
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version:
|
126
|
+
version: 1.3.1
|
127
127
|
requirements: []
|
128
128
|
rubygems_version: 3.3.11
|
129
129
|
signing_key:
|