isomorfeus-data 1.0.0.zeta10 → 1.0.0.zeta11
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/isomorfeus-data.rb +1 -24
- data/lib/isomorfeus/data/attribute_support.rb +27 -11
- data/lib/isomorfeus/data/generic_class_api.rb +33 -39
- data/lib/isomorfeus/data/generic_instance_api.rb +5 -5
- data/lib/isomorfeus/data/handler/generic.rb +72 -33
- data/lib/isomorfeus/data/version.rb +1 -1
- data/lib/isomorfeus_data/lucid_data/array/mixin.rb +32 -18
- data/lib/isomorfeus_data/lucid_data/collection/mixin.rb +44 -24
- data/lib/isomorfeus_data/lucid_data/composition/mixin.rb +50 -9
- data/lib/isomorfeus_data/lucid_data/edge/mixin.rb +18 -14
- data/lib/isomorfeus_data/lucid_data/edge_collection/mixin.rb +37 -24
- data/lib/isomorfeus_data/lucid_data/graph/finders.rb +18 -18
- data/lib/isomorfeus_data/lucid_data/graph/mixin.rb +98 -23
- data/lib/isomorfeus_data/lucid_data/hash/mixin.rb +43 -24
- data/lib/isomorfeus_data/lucid_data/node/mixin.rb +15 -10
- data/lib/isomorfeus_data/lucid_data/query_result.rb +93 -0
- data/lib/{isomorfeus_data/lucid_data → lucid_arango}/object/base.rb +0 -0
- data/lib/{isomorfeus_data/lucid_data → lucid_arango}/object/mixin.rb +3 -3
- data/lib/{isomorfeus_data/lucid_data → lucid_arango}/remote_object/base.rb +0 -0
- data/lib/{isomorfeus_data/lucid_data → lucid_arango}/remote_object/mixin.rb +0 -0
- metadata +15 -15
- data/lib/isomorfeus/data/props.rb +0 -95
@@ -10,7 +10,7 @@ module LucidData
|
|
10
10
|
base.include(LucidData::Collection::Finders)
|
11
11
|
|
12
12
|
base.instance_exec do
|
13
|
-
def nodes(validate_hash
|
13
|
+
def nodes(validate_hash)
|
14
14
|
@node_conditions = validate_hash
|
15
15
|
end
|
16
16
|
alias document nodes
|
@@ -21,25 +21,33 @@ module LucidData
|
|
21
21
|
alias node nodes
|
22
22
|
|
23
23
|
def node_conditions
|
24
|
-
@node_conditions
|
24
|
+
@node_conditions ||= {}
|
25
25
|
end
|
26
26
|
|
27
27
|
def valid_node?(node)
|
28
|
-
return true unless
|
29
|
-
|
28
|
+
return true unless node_conditions.any?
|
29
|
+
_validate_node(node)
|
30
30
|
rescue
|
31
31
|
false
|
32
32
|
end
|
33
33
|
alias valid_vertex? valid_node?
|
34
34
|
alias valid_document? valid_node?
|
35
|
+
|
36
|
+
def _validate_node(node)
|
37
|
+
Isomorfeus::Data::ElementValidator.new(self.to_s, node, node_conditions).validate!
|
38
|
+
end
|
39
|
+
|
40
|
+
def _validate_nodes(many_nodes)
|
41
|
+
many_nodes.each { |node| _validate_node(node) } if node_conditions.any?
|
42
|
+
end
|
35
43
|
end
|
36
44
|
|
37
45
|
def _validate_node(node)
|
38
|
-
|
46
|
+
self.class._validate_node(node)
|
39
47
|
end
|
40
48
|
|
41
49
|
def _validate_nodes(many_nodes)
|
42
|
-
|
50
|
+
self.class._validate_nodes(many_nodes)
|
43
51
|
end
|
44
52
|
|
45
53
|
def _collection_to_sids(collection)
|
@@ -111,13 +119,12 @@ module LucidData
|
|
111
119
|
@_composition = composition
|
112
120
|
@_changed = false
|
113
121
|
@_changed_collection = nil
|
114
|
-
@
|
115
|
-
@_validate_nodes = @_node_con ? true : false
|
122
|
+
@_validate_nodes = self.class.node_conditions.any?
|
116
123
|
|
117
124
|
loaded = loaded?
|
118
125
|
|
119
126
|
if attributes
|
120
|
-
attributes
|
127
|
+
_validate_attributes(attributes)
|
121
128
|
if loaded
|
122
129
|
raw_attributes = Redux.fetch_by_path(*@_store_path)
|
123
130
|
if `raw_attributes === null`
|
@@ -134,9 +141,7 @@ module LucidData
|
|
134
141
|
|
135
142
|
nodes = documents || nodes || vertices || vertexes
|
136
143
|
if nodes && loaded
|
137
|
-
|
138
|
-
nodes.each { |e| _validate_node(e) }
|
139
|
-
end
|
144
|
+
_validate_nodes(nodes)
|
140
145
|
raw_nodes = _collection_to_sids(nodes)
|
141
146
|
raw_collection = Redux.fetch_by_path(*@_nodes_path)
|
142
147
|
if raw_collection != raw_nodes
|
@@ -453,12 +458,32 @@ module LucidData
|
|
453
458
|
|
454
459
|
base.instance_exec do
|
455
460
|
def load(key:, pub_sub_client: nil, current_user: nil)
|
456
|
-
data = instance_exec(key: key, &@_load_block)
|
457
|
-
revision =
|
458
|
-
|
461
|
+
data = instance_exec(key: key, pub_sub_client: pub_sub_client, current_user: current_user, &@_load_block)
|
462
|
+
revision = data.delete(:revision)
|
463
|
+
attributes = data.delete(:attributes)
|
464
|
+
documents = data.delete(:documents)
|
465
|
+
vertexes = data.delete(:vertexes)
|
466
|
+
vertices = data.delete(:vertices)
|
467
|
+
nodes = data.delete(:nodes)
|
468
|
+
self.new(key: key, revision: revision, attributes: attributes, documents: documents, vertexes: vertexes, vertices: vertices,
|
469
|
+
nodes: nodes)
|
470
|
+
end
|
471
|
+
|
472
|
+
def save(key:, revision: nil, attributes: nil, documents: nil, vertexes: nil, vertices: nil, nodes: nil,
|
473
|
+
pub_sub_client: nil, current_user: nil)
|
474
|
+
val_nodes = documents || nodes || vertexes || vertices
|
475
|
+
_validate_attributes(attributes) if self.class.attribute_conditions.any?
|
476
|
+
_validate_nodes(val_nodes) if self.class.node_conditions.any?
|
477
|
+
data = instance_exec(key: key, revision: revision, attributes: attributes, documents: documents, vertexes: vertexes, vertices: vertices,
|
478
|
+
nodes: nodes, pub_sub_client: pub_sub_client, current_user: current_user, &@_save_block)
|
479
|
+
revision = data.delete(:revision)
|
459
480
|
attributes = data.delete(:attributes)
|
481
|
+
documents = data.delete(:documents)
|
482
|
+
vertexes = data.delete(:vertexes)
|
483
|
+
vertices = data.delete(:vertices)
|
460
484
|
nodes = data.delete(:nodes)
|
461
|
-
self.new(key: key, revision: revision, attributes: attributes,
|
485
|
+
self.new(key: key, revision: revision, attributes: attributes, documents: documents, vertexes: vertexes, vertices: vertices,
|
486
|
+
nodes: nodes)
|
462
487
|
end
|
463
488
|
end
|
464
489
|
|
@@ -471,20 +496,15 @@ module LucidData
|
|
471
496
|
@_composition = composition
|
472
497
|
@_changed = false
|
473
498
|
@_validate_attributes = self.class.attribute_conditions.any?
|
474
|
-
@
|
475
|
-
@_validate_nodes = @_node_con ? true : false
|
499
|
+
@_validate_nodes = self.class.node_conditions.any?
|
476
500
|
|
477
501
|
attributes = {} unless attributes
|
478
|
-
if
|
479
|
-
attributes.each { |a,v| _validate_attribute(a, v) }
|
480
|
-
end
|
502
|
+
_validate_attributes(attributes) if attributes
|
481
503
|
@_raw_attributes = attributes
|
482
504
|
|
483
505
|
nodes = documents || nodes || vertices || vertexes
|
484
506
|
nodes = [] unless nodes
|
485
|
-
if @_validate_nodes
|
486
|
-
nodes.each { |n| _validate_node(n) }
|
487
|
-
end
|
507
|
+
_validate_nodes(nodes) if @_validate_nodes
|
488
508
|
nodes.each { |n| n.collection = self }
|
489
509
|
@_raw_collection = nodes
|
490
510
|
@_sid_to_node_cache = {}
|
@@ -15,20 +15,50 @@ module LucidData
|
|
15
15
|
@parts ||= {}
|
16
16
|
end
|
17
17
|
|
18
|
-
def compose_with(access_name,
|
19
|
-
parts[access_name] =
|
18
|
+
def compose_with(access_name, validate_hash = {})
|
19
|
+
parts[access_name] = validate_hash
|
20
20
|
|
21
21
|
define_method(access_name) do
|
22
22
|
parts[access_name]
|
23
23
|
end
|
24
24
|
|
25
25
|
define_method("#{access_name}=") do |part|
|
26
|
+
part_conditions = self.class.parts[access_name]
|
27
|
+
Isomorfeus::Data::ElementValidator.new(self.name, part, part_conditions).validate!
|
26
28
|
@_changed = true
|
27
29
|
parts[access_name] = part
|
28
30
|
parts[access_name].composition = self
|
29
31
|
parts[access_name]
|
30
32
|
end
|
33
|
+
|
34
|
+
define_singleton_method("valid_#{access_name}?") do |part|
|
35
|
+
_validate(access_name, part)
|
36
|
+
rescue
|
37
|
+
false
|
38
|
+
end
|
31
39
|
end
|
40
|
+
|
41
|
+
def _validate_part(access_name, part)
|
42
|
+
raise "#{self.name}: No such part declared: '#{access_name}'!" unless parts.key?(access_name)
|
43
|
+
Isomorfeus::Data::ElementValidator.new(self.name, part, parts[access_name]).validate!
|
44
|
+
end
|
45
|
+
|
46
|
+
def _validate_parts(many_parts)
|
47
|
+
parts.each_key do |access_name|
|
48
|
+
if parts[access_name].key?(:required) && parts[access_name][:required] && !many_parts.key?(attr)
|
49
|
+
raise "Required part #{access_name} not given!"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
many_parts.each { |access_name, part| _validate_part(access_name, part) } if parts.any?
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def _validate_part(access_name, part)
|
57
|
+
self.class._validate_part(access_name, part)
|
58
|
+
end
|
59
|
+
|
60
|
+
def _validate_parts(many_parts)
|
61
|
+
self.class._validate_parts(many_parts)
|
32
62
|
end
|
33
63
|
|
34
64
|
def changed?
|
@@ -70,7 +100,7 @@ module LucidData
|
|
70
100
|
loaded = loaded?
|
71
101
|
|
72
102
|
if attributes
|
73
|
-
attributes
|
103
|
+
_validate_attributes(attributes)
|
74
104
|
if loaded
|
75
105
|
raw_attributes = Redux.fetch_by_path(*@_store_path)
|
76
106
|
if `raw_attributes === null`
|
@@ -87,6 +117,7 @@ module LucidData
|
|
87
117
|
|
88
118
|
@_parts = {}
|
89
119
|
if parts && loaded
|
120
|
+
_validate_parts(parts)
|
90
121
|
self.class.parts.each_key do |access_name|
|
91
122
|
if parts.key?(access_name)
|
92
123
|
part = parts[access_name]
|
@@ -140,9 +171,20 @@ module LucidData
|
|
140
171
|
|
141
172
|
base.instance_exec do
|
142
173
|
def load(key:, pub_sub_client: nil, current_user: nil)
|
143
|
-
data = instance_exec(key: key, &@_load_block)
|
144
|
-
revision =
|
145
|
-
|
174
|
+
data = instance_exec(key: key, pub_sub_client: pub_sub_client, current_user: current_user, &@_load_block)
|
175
|
+
revision = data.delete(:revision)
|
176
|
+
attributes = data.delete(:attributes)
|
177
|
+
parts = data.delete(:parts)
|
178
|
+
self.new(key: key, revision: revision, parts: parts, attributes: attributes)
|
179
|
+
end
|
180
|
+
|
181
|
+
def save(key:, revision: nil, parts: nil, attributes: nil, pub_sub_client: nil, current_user: nil)
|
182
|
+
attributes = {} unless attributes
|
183
|
+
_validate_attributes(attributes)
|
184
|
+
_validate_parts(parts)
|
185
|
+
data = instance_exec(key: key, revision: revision, parts: parts, attributes: attributes,
|
186
|
+
pub_sub_client: pub_sub_client, current_user: current_user, &@_save_block)
|
187
|
+
revision = data.delete(:revision)
|
146
188
|
attributes = data.delete(:attributes)
|
147
189
|
parts = data.delete(:parts)
|
148
190
|
self.new(key: key, revision: revision, parts: parts, attributes: attributes)
|
@@ -157,12 +199,11 @@ module LucidData
|
|
157
199
|
@_changed = false
|
158
200
|
@_validate_attributes = self.class.attribute_conditions.any?
|
159
201
|
attributes = {} unless attributes
|
160
|
-
if
|
161
|
-
attributes.each { |a,v| _validate_attribute(a, v) }
|
162
|
-
end
|
202
|
+
_validate_attributes(attributes) if attributes.any?
|
163
203
|
@_raw_attributes = attributes
|
164
204
|
|
165
205
|
@_parts = {}
|
206
|
+
_validate_parts(parts)
|
166
207
|
self.class.parts.each_key do |access_name|
|
167
208
|
if parts.key?(access_name)
|
168
209
|
@_parts[access_name] = parts[access_name]
|
@@ -74,7 +74,7 @@ module LucidData
|
|
74
74
|
@_changed = false
|
75
75
|
loaded = loaded?
|
76
76
|
if attributes
|
77
|
-
attributes
|
77
|
+
_validate_attributes(attributes)
|
78
78
|
if loaded
|
79
79
|
raw_attributes = Redux.fetch_by_path(*@_store_path)
|
80
80
|
if `raw_attributes === null`
|
@@ -170,15 +170,22 @@ module LucidData
|
|
170
170
|
|
171
171
|
base.instance_exec do
|
172
172
|
def load(key:, pub_sub_client: nil, current_user: nil)
|
173
|
-
data = instance_exec(key: key, &@_load_block)
|
174
|
-
revision =
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
173
|
+
data = instance_exec(key: key, pub_sub_client: pub_sub_client, current_user: current_user, &@_load_block)
|
174
|
+
revision = data.delete(:revision)
|
175
|
+
from = data.delete(:from)
|
176
|
+
to = data.delete(:to)
|
177
|
+
attributes = data.delete(:attributes)
|
178
|
+
self.new(key: key, revision: revision, from: from, to: to, attributes: attributes)
|
179
|
+
end
|
180
|
+
|
181
|
+
def save(key:, revision: nil, from:, to:, attributes: nil, pub_sub_client: nil, current_user: nil)
|
182
|
+
attributes = {} unless attributes
|
183
|
+
_validate_attributes(attributes)
|
184
|
+
data = instance_exec(key: key, revision: revision, from: from, to: to, attributes: attributes,
|
185
|
+
pub_sub_client: pub_sub_client, current_user: current_user, &@_save_block)
|
186
|
+
revision = data.delete(:revision)
|
187
|
+
from = data.delete(:from)
|
188
|
+
to = data.delete(:to)
|
182
189
|
attributes = data.delete(:attributes)
|
183
190
|
self.new(key: key, revision: revision, from: from, to: to, attributes: attributes)
|
184
191
|
end
|
@@ -192,11 +199,8 @@ module LucidData
|
|
192
199
|
@_composition = composition
|
193
200
|
@_changed = false
|
194
201
|
@_collection = collection
|
195
|
-
@_validate_attributes = self.class.attribute_conditions.any?
|
196
202
|
attributes = {} unless attributes
|
197
|
-
if
|
198
|
-
attributes.each { |a,v| _validate_attribute(a, v) }
|
199
|
-
end
|
203
|
+
_validate_attributes(attributes) if attributes
|
200
204
|
@_raw_attributes = attributes
|
201
205
|
@_changed_from = nil
|
202
206
|
@_changed_to = nil
|
@@ -10,30 +10,38 @@ module LucidData
|
|
10
10
|
base.include(LucidData::EdgeCollection::Finders)
|
11
11
|
|
12
12
|
base.instance_exec do
|
13
|
-
def edges(validate_hash
|
13
|
+
def edges(validate_hash)
|
14
14
|
@edge_conditions = validate_hash
|
15
15
|
end
|
16
16
|
alias links edges
|
17
17
|
|
18
18
|
def edge_conditions
|
19
|
-
@edge_conditions
|
19
|
+
@edge_conditions ||= {}
|
20
20
|
end
|
21
21
|
|
22
22
|
def valid_edge?(edge)
|
23
|
-
return true unless
|
24
|
-
|
23
|
+
return true unless edge_conditions.any?
|
24
|
+
_validate_edge(edge)
|
25
25
|
rescue
|
26
26
|
false
|
27
27
|
end
|
28
28
|
alias valid_link? valid_edge?
|
29
|
+
|
30
|
+
def _validate_edge(edge)
|
31
|
+
Isomorfeus::Data::ElementValidator.new(self.to_s, edge, edge_conditions).validate!
|
32
|
+
end
|
33
|
+
|
34
|
+
def _validate_edges(many_edges)
|
35
|
+
many_edges.each { |edge| _validate_edge(edge) } if edge_conditions.any?
|
36
|
+
end
|
29
37
|
end
|
30
38
|
|
31
39
|
def _validate_edge(edge)
|
32
|
-
|
40
|
+
self.class._validate_edge(edge)
|
33
41
|
end
|
34
42
|
|
35
43
|
def _validate_edges(many_edges)
|
36
|
-
|
44
|
+
self.class._validate_edges(many_edges)
|
37
45
|
end
|
38
46
|
|
39
47
|
def _collection_to_sids(collection)
|
@@ -116,13 +124,12 @@ module LucidData
|
|
116
124
|
@_composition = composition
|
117
125
|
@_node_to_edge_cache = {}
|
118
126
|
@_changed_collection = nil
|
119
|
-
@
|
120
|
-
@_validate_edges = @_edge_con ? true : false
|
127
|
+
@_validate_edges = self.class.edge_conditions.any?
|
121
128
|
|
122
129
|
loaded = loaded?
|
123
130
|
|
124
131
|
if attributes
|
125
|
-
attributes
|
132
|
+
_validate_attributes(attributes)
|
126
133
|
if loaded
|
127
134
|
raw_attributes = Redux.fetch_by_path(*@_store_path)
|
128
135
|
if `raw_attributes === null`
|
@@ -139,9 +146,7 @@ module LucidData
|
|
139
146
|
|
140
147
|
edges = edges || links
|
141
148
|
if edges && loaded
|
142
|
-
|
143
|
-
edges.each { |e| _validate_edges(e) }
|
144
|
-
end
|
149
|
+
_validate_edges(edges)
|
145
150
|
raw_edges = _collection_to_sids(edges)
|
146
151
|
raw_collection = Redux.fetch_by_path(*@_edges_path)
|
147
152
|
if raw_collection != raw_edges
|
@@ -462,12 +467,25 @@ module LucidData
|
|
462
467
|
|
463
468
|
base.instance_exec do
|
464
469
|
def load(key:, pub_sub_client: nil, current_user: nil)
|
465
|
-
data = instance_exec(key: key, &@_load_block)
|
466
|
-
revision =
|
467
|
-
|
470
|
+
data = instance_exec(key: key, pub_sub_client: pub_sub_client, current_user: current_user, &@_load_block)
|
471
|
+
revision = data.delete(:revision)
|
472
|
+
attributes = data.delete(:attributes)
|
473
|
+
edges = data.delete(:edges)
|
474
|
+
links = data.delete(:links)
|
475
|
+
self.new(key: key, revision: revision, attributes: attributes, edges: edges, links: links)
|
476
|
+
end
|
477
|
+
|
478
|
+
def save(key:, revision: nil, attributes: nil, edges: nil, links: nil, pub_sub_client: nil, current_user: nil)
|
479
|
+
val_edges = edges || links
|
480
|
+
_validate_attributes(attributes) if attributes
|
481
|
+
_validate_edges(val_edges)
|
482
|
+
data = instance_exec(key: key, revision: revision, attributes: attributes, edges: edges, links: links,
|
483
|
+
pub_sub_client: pub_sub_client, current_user: current_user, &@_save_block)
|
484
|
+
revision = data.delete(:revision)
|
468
485
|
attributes = data.delete(:attributes)
|
469
486
|
edges = data.delete(:edges)
|
470
|
-
|
487
|
+
links = data.delete(:links)
|
488
|
+
self.new(key: key, revision: revision, attributes: attributes, edges: edges, links: links)
|
471
489
|
end
|
472
490
|
end
|
473
491
|
|
@@ -481,20 +499,15 @@ module LucidData
|
|
481
499
|
@_node_to_edge_cache = {}
|
482
500
|
@_changed = false
|
483
501
|
@_validate_attributes = self.class.attribute_conditions.any?
|
484
|
-
@
|
485
|
-
@_validate_edges = @_edge_con ? true : false
|
502
|
+
@_validate_edges = self.class.edge_conditions.any?
|
486
503
|
|
487
504
|
attributes = {} unless attributes
|
488
|
-
if
|
489
|
-
attributes.each { |a,v| _validate_attribute(a, v) }
|
490
|
-
end
|
505
|
+
_validate_attributes(attributes) if attributes
|
491
506
|
@_raw_attributes = attributes
|
492
507
|
|
493
508
|
edges = edges || links
|
494
509
|
edges = [] unless edges
|
495
|
-
if @_validate_edges
|
496
|
-
edges.each { |e| _validate_edge(e) }
|
497
|
-
end
|
510
|
+
_validate_edges(edges) if @_validate_edges
|
498
511
|
edges.each { |e| e.collection = self }
|
499
512
|
@_raw_collection = edges
|
500
513
|
end
|
@@ -2,7 +2,7 @@ module LucidData
|
|
2
2
|
module Graph
|
3
3
|
module Finders
|
4
4
|
def find_node(attribute_hash = nil, &block)
|
5
|
-
|
5
|
+
node_collections.each_value do |collection|
|
6
6
|
node = collection.find(attribute_hash, &block)
|
7
7
|
return node if node
|
8
8
|
end
|
@@ -13,9 +13,9 @@ module LucidData
|
|
13
13
|
|
14
14
|
def find_nodes(attribute_hash = nil, &block)
|
15
15
|
found_nodes = []
|
16
|
-
|
17
|
-
|
18
|
-
found_nodes.push(*
|
16
|
+
node_collections.each_value do |collection|
|
17
|
+
coll_nodes = collection.find_all(attribute_hash, &block)
|
18
|
+
found_nodes.push(*coll_nodes)
|
19
19
|
end
|
20
20
|
found_nodes
|
21
21
|
end
|
@@ -24,7 +24,7 @@ module LucidData
|
|
24
24
|
alias find_vertices find_nodes
|
25
25
|
|
26
26
|
def find_node_by_key(node_key)
|
27
|
-
|
27
|
+
node_collections.each_value do |collection|
|
28
28
|
node = collection.find_by_key(node_key)
|
29
29
|
return node if node
|
30
30
|
end
|
@@ -34,7 +34,7 @@ module LucidData
|
|
34
34
|
alias find_vertex_by_key find_node_by_key
|
35
35
|
|
36
36
|
def find_node_by_sid(node)
|
37
|
-
|
37
|
+
node_collections.each_value do |collection|
|
38
38
|
node = collection.find_by_sid(node)
|
39
39
|
return node if node
|
40
40
|
end
|
@@ -44,7 +44,7 @@ module LucidData
|
|
44
44
|
alias find_vertex_by_sid find_node_by_sid
|
45
45
|
|
46
46
|
def find_edge(attribute_hash = nil, &block)
|
47
|
-
|
47
|
+
edge_collections.each_value do |collection|
|
48
48
|
edge = collection.find(attribute_hash, &block)
|
49
49
|
return edge if edge
|
50
50
|
end
|
@@ -54,16 +54,16 @@ module LucidData
|
|
54
54
|
|
55
55
|
def find_edges(attribute_hash = nil, &block)
|
56
56
|
found_edges = []
|
57
|
-
|
58
|
-
|
59
|
-
found_edges.push(*
|
57
|
+
edge_collections.each_value do |collection|
|
58
|
+
coll_edges = collection.find_all(attribute_hash, &block)
|
59
|
+
found_edges.push(*coll_edges)
|
60
60
|
end
|
61
61
|
found_edges
|
62
62
|
end
|
63
63
|
alias find_links find_edges
|
64
64
|
|
65
65
|
def find_edge_by_key(edge_key)
|
66
|
-
|
66
|
+
edge_collections.each_value do |collection|
|
67
67
|
edge = collection.find_by_key(edge_key)
|
68
68
|
return edge if edge
|
69
69
|
end
|
@@ -72,7 +72,7 @@ module LucidData
|
|
72
72
|
alias find_link_by_key find_edge_by_key
|
73
73
|
|
74
74
|
def find_edge_by_sid(edge)
|
75
|
-
|
75
|
+
edge_collections.each_value do |collection|
|
76
76
|
edge = collection.find_by_sid(edge)
|
77
77
|
return edge if edge
|
78
78
|
end
|
@@ -81,7 +81,7 @@ module LucidData
|
|
81
81
|
alias find_link_by_key find_edge_by_key
|
82
82
|
|
83
83
|
def find_edge_by_from(node)
|
84
|
-
|
84
|
+
edge_collections.each_value do |collection|
|
85
85
|
edge = collection.find_by_from(node)
|
86
86
|
return edge if edge
|
87
87
|
end
|
@@ -90,7 +90,7 @@ module LucidData
|
|
90
90
|
alias find_link_by_from find_edge_by_from
|
91
91
|
|
92
92
|
def find_edge_by_to(node)
|
93
|
-
|
93
|
+
edge_collections.each_value do |collection|
|
94
94
|
edge = collection.find_by_to(node)
|
95
95
|
return edge if edge
|
96
96
|
end
|
@@ -99,7 +99,7 @@ module LucidData
|
|
99
99
|
alias find_link_by_to find_edge_by_to
|
100
100
|
|
101
101
|
def find_edge_by_target(node)
|
102
|
-
|
102
|
+
edge_collections.each_value do |collection|
|
103
103
|
edge = collection.find_by_target(node)
|
104
104
|
return edge if edge
|
105
105
|
end
|
@@ -109,7 +109,7 @@ module LucidData
|
|
109
109
|
|
110
110
|
def find_edges_by_from(node)
|
111
111
|
found_edges = []
|
112
|
-
|
112
|
+
edge_collections.each_value do |collection|
|
113
113
|
coll_edges = collection.find_all_by_from(node)
|
114
114
|
found_edges.push(*coll_edges)
|
115
115
|
end
|
@@ -119,7 +119,7 @@ module LucidData
|
|
119
119
|
|
120
120
|
def find_edges_by_to(node)
|
121
121
|
found_edges = []
|
122
|
-
|
122
|
+
edge_collections.each_value do |collection|
|
123
123
|
coll_edges = collection.find_all_by_to(node)
|
124
124
|
found_edges.push(*coll_edges)
|
125
125
|
end
|
@@ -129,7 +129,7 @@ module LucidData
|
|
129
129
|
|
130
130
|
def find_edges_by_target(node)
|
131
131
|
found_edges = []
|
132
|
-
|
132
|
+
edge_collections.each_value do |collection|
|
133
133
|
coll_edges = collection.find_all_by_target(node)
|
134
134
|
found_edges.push(*coll_edges)
|
135
135
|
end
|