arangorb 1.4.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ArangoRB.gemspec +20 -18
- data/Gemfile +3 -0
- data/README.md +1079 -908
- data/lib/AQL.rb +155 -0
- data/lib/Batch.rb +97 -0
- data/lib/Cache.rb +71 -0
- data/lib/Collection.rb +852 -0
- data/lib/Database.rb +417 -0
- data/lib/Document.rb +346 -0
- data/lib/Edge.rb +104 -0
- data/lib/Error.rb +125 -0
- data/lib/Foxx.rb +277 -0
- data/lib/Graph.rb +325 -0
- data/lib/Index.rb +126 -0
- data/lib/Replication.rb +235 -0
- data/lib/Request.rb +143 -0
- data/lib/Server.rb +466 -0
- data/lib/Task.rb +120 -0
- data/lib/Transaction.rb +115 -0
- data/lib/Traversal.rb +224 -0
- data/lib/User.rb +197 -0
- data/lib/Vertex.rb +127 -0
- data/lib/View.rb +151 -0
- data/lib/arangorb.rb +23 -15
- data/lib/helpers/Error.rb +28 -0
- data/lib/helpers/Return.rb +53 -0
- metadata +64 -45
- data/lib/ArangoRB_AQL.rb +0 -181
- data/lib/ArangoRB_Cache.rb +0 -174
- data/lib/ArangoRB_Col.rb +0 -526
- data/lib/ArangoRB_DB.rb +0 -363
- data/lib/ArangoRB_Doc.rb +0 -319
- data/lib/ArangoRB_Edg.rb +0 -184
- data/lib/ArangoRB_Gra.rb +0 -201
- data/lib/ArangoRB_Index.rb +0 -135
- data/lib/ArangoRB_Replication.rb +0 -261
- data/lib/ArangoRB_Ser.rb +0 -446
- data/lib/ArangoRB_Task.rb +0 -129
- data/lib/ArangoRB_Tra.rb +0 -169
- data/lib/ArangoRB_Tran.rb +0 -68
- data/lib/ArangoRB_User.rb +0 -157
- data/lib/ArangoRB_Ver.rb +0 -162
- data/spec/arangoRB_helper.rb +0 -4
- data/spec/arangoRestart_helper.rb +0 -14
- data/spec/arangorb-1.3.0.gem +0 -0
- data/spec/lib/0.1.0/arangoAQL_helper.rb +0 -64
- data/spec/lib/0.1.0/arangoC_helper.rb +0 -170
- data/spec/lib/0.1.0/arangoDB_helper.rb +0 -119
- data/spec/lib/0.1.0/arangoDoc_helper.rb +0 -79
- data/spec/lib/0.1.0/arangoE_helper.rb +0 -50
- data/spec/lib/0.1.0/arangoG_helper.rb +0 -78
- data/spec/lib/0.1.0/arangoS_helper.rb +0 -37
- data/spec/lib/0.1.0/arangoT_helper.rb +0 -48
- data/spec/lib/0.1.0/arangoV_helper.rb +0 -65
- data/spec/lib/1.0.0/arangoC_helper.rb +0 -73
- data/spec/lib/1.0.0/arangoDB_helper.rb +0 -48
- data/spec/lib/1.0.0/arangoI_helper.rb +0 -43
- data/spec/lib/1.0.0/arangoS_helper.rb +0 -192
- data/spec/lib/1.0.0/arangoTa_helper.rb +0 -49
- data/spec/lib/1.0.0/arangoTr_helper.rb +0 -15
- data/spec/lib/1.0.0/arangoU_helper.rb +0 -72
- data/spec/lib/1.1.0/arangoRB_helper.rb +0 -144
- data/spec/lib/1.1.0/arangoRB_walks_helper.rb +0 -19
- data/spec/lib/1.2.0/arangoCache_helper.rb +0 -66
- data/spec/lib/1.3.0/arangoHash_helper.rb +0 -30
- data/spec/lib/arangoRB_0.1.0_helper.rb +0 -9
- data/spec/lib/arangoRB_1.0.0_helper.rb +0 -6
- data/spec/lib/arangoRB_1.1.0_helper.rb +0 -2
- data/spec/lib/arangoRB_1.2.0_helper.rb +0 -2
- data/spec/spec_helper.rb +0 -42
data/lib/Task.rb
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
# === TASK ===
|
2
|
+
|
3
|
+
module Arango
|
4
|
+
class Task
|
5
|
+
include Arango::Helper_Error
|
6
|
+
include Arango::Helper_Return
|
7
|
+
include Arango::Database_Return
|
8
|
+
|
9
|
+
def self.new(*args)
|
10
|
+
hash = args[0]
|
11
|
+
super unless hash.is_a?(Hash)
|
12
|
+
database = hash[:database]
|
13
|
+
if database.is_a?(Arango::Database) && database.server.active_cache && !hash[:id].nil?
|
14
|
+
cache_name = "#{database.name}/#{hash[:id]}"
|
15
|
+
cached = database.server.cache.cache.dig(:task, cache_name)
|
16
|
+
if cached.nil?
|
17
|
+
hash[:cache_name] = cache_name
|
18
|
+
return super
|
19
|
+
else
|
20
|
+
body = hash[:body] || {}
|
21
|
+
[:name, :type, :period, :command, :params, :created].each{|k| body[k] ||= hash[k]}
|
22
|
+
cached.assign_attributes(body)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(id: nil, name: nil, type: nil, period: nil, command: nil,
|
29
|
+
params: nil, created: nil, body: {}, database:, cache_name: nil)
|
30
|
+
assign_database(database)
|
31
|
+
unless cache_name.nil?
|
32
|
+
@cache_name = cache_name
|
33
|
+
@server.cache.save(:task, cache_name, self)
|
34
|
+
end
|
35
|
+
[:id, :name, :type, :period, :command, :params, :created].each do |k|
|
36
|
+
body[k] ||= binding.local_variable_get(k)
|
37
|
+
end
|
38
|
+
assign_attributes(body)
|
39
|
+
end
|
40
|
+
|
41
|
+
# === DEFINE ===
|
42
|
+
|
43
|
+
attr_reader :server, :body, :database, :cache_name
|
44
|
+
attr_accessor :id, :name, :type, :period, :created,
|
45
|
+
:command, :params, :offset
|
46
|
+
|
47
|
+
def body=(result)
|
48
|
+
@body = result
|
49
|
+
@id = result[:id] || @id
|
50
|
+
@name = result[:name] || @name
|
51
|
+
@type = result[:type] || @type
|
52
|
+
@period = result[:period] || @period
|
53
|
+
@command = result[:command] || @command
|
54
|
+
@params = result[:params] || @params
|
55
|
+
@offset = result[:offset] || @offset
|
56
|
+
@created = result[:created] || @created
|
57
|
+
if @server.active_cache && @cache_name.nil?
|
58
|
+
@cache_name = "#{@database.name}/#{@id}"
|
59
|
+
@server.cache.save(:task, @cache_name, self)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
alias assign_attributes body=
|
63
|
+
|
64
|
+
# === TO HASH ===
|
65
|
+
|
66
|
+
def to_h
|
67
|
+
{
|
68
|
+
"id": @id,
|
69
|
+
"name": @name,
|
70
|
+
"type": @type,
|
71
|
+
"period": @period,
|
72
|
+
"command": @command,
|
73
|
+
"params": @params,
|
74
|
+
"created": @created,
|
75
|
+
"cache_name": @cache_name,
|
76
|
+
"database": @database.name
|
77
|
+
}.delete_if{|k,v| v.nil?}
|
78
|
+
end
|
79
|
+
|
80
|
+
# == RETRIEVE
|
81
|
+
|
82
|
+
def retrieve
|
83
|
+
result = @database.request("GET", "_api/tasks/#{@id}")
|
84
|
+
return return_element(result)
|
85
|
+
end
|
86
|
+
|
87
|
+
def create(command: @command, period: @period, offset: @offset, params: @params)
|
88
|
+
body = {
|
89
|
+
"id": @id,
|
90
|
+
"name": @name,
|
91
|
+
"command": command,
|
92
|
+
"period": period,
|
93
|
+
"offset": offset,
|
94
|
+
"params": params,
|
95
|
+
"database": @database.name
|
96
|
+
}
|
97
|
+
result = @database.request("POST", "_api/tasks", body: body)
|
98
|
+
return return_element(result)
|
99
|
+
end
|
100
|
+
|
101
|
+
def update(command: @command, period: @period, offset: @offset,
|
102
|
+
params: @params)
|
103
|
+
body = {
|
104
|
+
"id": @id,
|
105
|
+
"name": @name,
|
106
|
+
"command": command,
|
107
|
+
"period": period,
|
108
|
+
"offset": offset,
|
109
|
+
"params": params
|
110
|
+
}
|
111
|
+
result = @database.request("PUT", "_api/tasks/#{@id}", body: body)
|
112
|
+
return return_element(result)
|
113
|
+
end
|
114
|
+
|
115
|
+
def destroy
|
116
|
+
result = @server.request("DELETE", "_api/tasks/#{@id}")
|
117
|
+
return return_directly?(result) ? result : true
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
data/lib/Transaction.rb
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
# === TRANSACTION ===
|
2
|
+
|
3
|
+
module Arango
|
4
|
+
class Transaction
|
5
|
+
include Arango::Helper_Error
|
6
|
+
include Arango::Helper_Return
|
7
|
+
include Arango::Database_Return
|
8
|
+
|
9
|
+
def initialize(database:, action:, write: [], read: [], params: nil,
|
10
|
+
maxTransactionSize: nil, lockTimeout: nil, waitForSync: nil, intermediateCommitCount: nil, intermedateCommitSize: nil)
|
11
|
+
assign_database(database)
|
12
|
+
@action = action
|
13
|
+
@write = return_write_or_read(write)
|
14
|
+
@read = return_write_or_read(read)
|
15
|
+
@params = params
|
16
|
+
@maxTransactionSize = maxTransactionSize
|
17
|
+
@lockTimeout = lockTimeout
|
18
|
+
@waitForSync = waitForSync
|
19
|
+
@intermediateCommitCount = intermediateCommitCount
|
20
|
+
@intermedateCommitSize = intermedateCommitSize
|
21
|
+
@result = nil
|
22
|
+
end
|
23
|
+
|
24
|
+
# === DEFINE ===
|
25
|
+
|
26
|
+
attr_reader :read, :write, :result, :server, :database
|
27
|
+
attr_accessor :action, :params, :maxTransactionSize,
|
28
|
+
:lockTimeout, :waitForSync, :intermediateCommitCount,
|
29
|
+
:intermedateCommitSize
|
30
|
+
|
31
|
+
def write=(write)
|
32
|
+
@write = return_write_or_read(write)
|
33
|
+
end
|
34
|
+
|
35
|
+
def addWrite(write)
|
36
|
+
write = return_write_or_read(write)
|
37
|
+
@write ||= []
|
38
|
+
@write << write
|
39
|
+
end
|
40
|
+
|
41
|
+
def read=(read)
|
42
|
+
@read = return_write_or_read(read)
|
43
|
+
end
|
44
|
+
|
45
|
+
def addRead(read)
|
46
|
+
read = return_write_or_read(read)
|
47
|
+
@read ||= []
|
48
|
+
@read << read
|
49
|
+
end
|
50
|
+
|
51
|
+
def return_write_or_read(value)
|
52
|
+
case value
|
53
|
+
when Array
|
54
|
+
return value.map{|x| return_collection(x)}
|
55
|
+
when String, Arango::Collection
|
56
|
+
return [return_collection(value)]
|
57
|
+
when NilClass
|
58
|
+
return []
|
59
|
+
else
|
60
|
+
raise Arango::Error.new err: :read_or_write_should_be_string_or_collections, data: {"wrong_value": value, "wrong_class": value.class}
|
61
|
+
end
|
62
|
+
end
|
63
|
+
private :return_write_or_read
|
64
|
+
|
65
|
+
def return_collection(collection, type=nil)
|
66
|
+
satisfy_class?(collection, [Arango::Collection, String])
|
67
|
+
case collection
|
68
|
+
when Arango::Collection
|
69
|
+
return collection
|
70
|
+
when String
|
71
|
+
return Arango::Collection.new(name: collection, database: @database)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
private :return_collection
|
75
|
+
|
76
|
+
# === TO HASH ===
|
77
|
+
|
78
|
+
def to_h
|
79
|
+
{
|
80
|
+
"action": @action,
|
81
|
+
"result": @result,
|
82
|
+
"params": @params,
|
83
|
+
"read": @read.map{|x| x.name},
|
84
|
+
"write": @write.map{|x| x.name},
|
85
|
+
"database": @database.name
|
86
|
+
}.delete_if{|k,v| v.nil?}
|
87
|
+
end
|
88
|
+
|
89
|
+
# === EXECUTE ===
|
90
|
+
|
91
|
+
def execute(action: @action, params: @params,
|
92
|
+
maxTransactionSize: @maxTransactionSize,
|
93
|
+
lockTimeout: @lockTimeout, waitForSync: @waitForSync,
|
94
|
+
intermediateCommitCount: @intermediateCommitCount,
|
95
|
+
intermedateCommitSize: @intermedateCommitSize)
|
96
|
+
body = {
|
97
|
+
"collections": {
|
98
|
+
"read": @read.map{|x| x.name},
|
99
|
+
"write": @write.map{|x| x.name}
|
100
|
+
},
|
101
|
+
"action": action,
|
102
|
+
"params": params,
|
103
|
+
"lockTimeout": lockTimeout,
|
104
|
+
"waitForSync": waitForSync,
|
105
|
+
"maxTransactionSize": maxTransactionSize,
|
106
|
+
"intermediateCommitCount": intermediateCommitCount,
|
107
|
+
"intermedateCommitSize": intermedateCommitSize
|
108
|
+
}
|
109
|
+
result = @database.request("POST", "_api/transaction", body: body)
|
110
|
+
return result if @server.async != false
|
111
|
+
@result = result[:result]
|
112
|
+
return return_directly?(result) ? result : result[:result]
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
data/lib/Traversal.rb
ADDED
@@ -0,0 +1,224 @@
|
|
1
|
+
# === TRAVERSAL ===
|
2
|
+
|
3
|
+
module Arango
|
4
|
+
class Traversal
|
5
|
+
include Arango::Helper_Error
|
6
|
+
include Arango::Helper_Return
|
7
|
+
include Arango::Database_Return
|
8
|
+
|
9
|
+
def initialize(body: {}, edgeCollection: nil,
|
10
|
+
sort: nil, direction: nil, minDepth: nil,
|
11
|
+
vertex:, visitor: nil, itemOrder: nil, strategy: nil,
|
12
|
+
filter: nil, init: nil, maxIterations: nil, maxDepth: nil,
|
13
|
+
uniqueness: nil, order: nil, expander: nil)
|
14
|
+
satisfy_category?(direction, ["outbound", "inbound", "any", nil])
|
15
|
+
satisfy_category?(itemOrder, ["forward", "backward", nil])
|
16
|
+
satisfy_category?(strategy, ["depthfirst", "breadthfirst", nil])
|
17
|
+
satisfy_category?(order, ["preorder", "postorder", "preorder-expander", nil])
|
18
|
+
body[:sort] ||= sort
|
19
|
+
body[:direction] ||= direction
|
20
|
+
body[:maxDepth] ||= maxDepth
|
21
|
+
body[:minDepth] ||= minDepth
|
22
|
+
body[:startVertex] ||= vertex
|
23
|
+
body[:visitor] ||= visitor
|
24
|
+
body[:itemOrder] ||= itemOrder
|
25
|
+
body[:strategy] ||= strategy
|
26
|
+
body[:filter] ||= filter
|
27
|
+
body[:init] ||= init
|
28
|
+
body[:maxiterations] ||= maxIterations
|
29
|
+
body[:uniqueness] ||= uniqueness
|
30
|
+
body[:order] ||= order
|
31
|
+
body[:expander] ||= expander
|
32
|
+
body[:edgeCollection] ||= edgeCollection
|
33
|
+
assign_body(body)
|
34
|
+
@vertices = nil
|
35
|
+
@paths = nil
|
36
|
+
end
|
37
|
+
|
38
|
+
# === DEFINE ===
|
39
|
+
|
40
|
+
attr_accessor :sort, :maxDepth, :minDepth, :visitor, :filter, :init, :maxiterations, :uniqueness, :expander
|
41
|
+
attr_reader :vertices, :paths, :direction, :itemOrder,
|
42
|
+
:strategy, :order, :database, :server, :vertex, :edgeCollection, :graph, :body, :collection
|
43
|
+
alias startVertex vertex
|
44
|
+
|
45
|
+
def body=(body)
|
46
|
+
@body = body
|
47
|
+
@sort = body[:sort] || @sort
|
48
|
+
@direction = body[:direction] || @direction
|
49
|
+
@maxDepth = body[:maxDepth] || @maxDepth
|
50
|
+
@minDepth = body[:minDepth] || @minDepth
|
51
|
+
return_vertex(body[:startVertex] || @vertex)
|
52
|
+
@visitor = body[:visitor] || @visitor
|
53
|
+
@itemOrder = body[:itemOrder] || @itemOrder
|
54
|
+
@strategy = body[:strategy] || @strategy
|
55
|
+
@filter = body[:filter] || @filter
|
56
|
+
@init = body[:init] || @init
|
57
|
+
@maxIterations = body[:maxiterations] || @maxIterations
|
58
|
+
@uniqueness = body[:uniqueness] || @uniqueness
|
59
|
+
@order = body[:order] || @order
|
60
|
+
@expander = body[:expander] || @expander
|
61
|
+
return_edgeCollection(body[:edgeCollection] || @edgeCollection)
|
62
|
+
end
|
63
|
+
alias assign_body body=
|
64
|
+
|
65
|
+
def direction=(direction)
|
66
|
+
satisfy_category?(direction, ["outbound", "inbound", "any", nil])
|
67
|
+
@direction = direction
|
68
|
+
end
|
69
|
+
|
70
|
+
def itemOrder=(itemOrder)
|
71
|
+
satisfy_category?(itemOrder, ["forward", "backward", nil])
|
72
|
+
@itemOrder = itemOrder
|
73
|
+
end
|
74
|
+
|
75
|
+
def strategy=(strategy)
|
76
|
+
satisfy_category?(strategy, ["depthfirst", "breadthfirst", nil])
|
77
|
+
@strategy = strategy
|
78
|
+
end
|
79
|
+
|
80
|
+
def order=(order)
|
81
|
+
satisfy_category?(order, ["preorder", "postorder", "preorder-expander", nil])
|
82
|
+
@order = order
|
83
|
+
end
|
84
|
+
|
85
|
+
def startVertex=(vertex)
|
86
|
+
case vertex
|
87
|
+
when Arango::Edge
|
88
|
+
when Arango::Document, Arango::Vertex
|
89
|
+
@vertex = vertex
|
90
|
+
@collection = @vertex.collection
|
91
|
+
@database = @collection.database
|
92
|
+
@graph = @collection.graph
|
93
|
+
@server = @database.server
|
94
|
+
return
|
95
|
+
when String
|
96
|
+
if @database.nil?
|
97
|
+
raise Arango::Error.new err: :database_undefined_for_traversal
|
98
|
+
elsif vertex.include? "/"
|
99
|
+
val = vertex.split("/")
|
100
|
+
@collection = Arango::Collection.new(database: @database, name: val[0])
|
101
|
+
@vertex = Arango::Document.new(collection: @collection, name: val[1])
|
102
|
+
return
|
103
|
+
end
|
104
|
+
end
|
105
|
+
raise Arango::Error.new err: :wrong_start_vertex_type
|
106
|
+
end
|
107
|
+
alias vertex= startVertex=
|
108
|
+
alias return_vertex startVertex=
|
109
|
+
|
110
|
+
def edgeCollection=(collection)
|
111
|
+
return nil if collection.nil?
|
112
|
+
satisfy_class?(collection, [Arango::Collection, String])
|
113
|
+
case collection
|
114
|
+
when Arango::Collection
|
115
|
+
if collection.type != :edge
|
116
|
+
raise Arango::Error.new err: :edge_collection_should_be_of_type_edge
|
117
|
+
end
|
118
|
+
@edgeCollection = collection
|
119
|
+
when String
|
120
|
+
collection_instance = Arango::Collection.new(name: edgedef[:collection],
|
121
|
+
database: @database, type: :edge, graph: @graph)
|
122
|
+
@edgeCollection = collection_instance
|
123
|
+
end
|
124
|
+
end
|
125
|
+
alias return_edgeCollection edgeCollection=
|
126
|
+
|
127
|
+
alias vertex= startVertex=
|
128
|
+
alias vertex startVertex
|
129
|
+
alias max maxDepth
|
130
|
+
alias max= maxDepth=
|
131
|
+
alias min minDepth
|
132
|
+
alias min= minDepth=
|
133
|
+
|
134
|
+
def in
|
135
|
+
@direction = "inbound"
|
136
|
+
end
|
137
|
+
|
138
|
+
def out
|
139
|
+
@direction = "outbound"
|
140
|
+
end
|
141
|
+
|
142
|
+
def any
|
143
|
+
@direction = "any"
|
144
|
+
end
|
145
|
+
|
146
|
+
# === TO HASH ===
|
147
|
+
|
148
|
+
def to_h
|
149
|
+
{
|
150
|
+
"sort": @sort,
|
151
|
+
"direction": @direction,
|
152
|
+
"maxDepth": @maxDepth,
|
153
|
+
"minDepth": @minDepth,
|
154
|
+
"visitor": @visitor,
|
155
|
+
"itemOrder": @itemOrder,
|
156
|
+
"strategy": @strategy,
|
157
|
+
"filter": @filter,
|
158
|
+
"init": @init,
|
159
|
+
"maxiterations": @maxiterations,
|
160
|
+
"uniqueness": @uniqueness,
|
161
|
+
"order": @order,
|
162
|
+
"expander": @expander,
|
163
|
+
"vertices": @vertices&.map{|x| x.id},
|
164
|
+
"paths": @paths&.map do |x|
|
165
|
+
{
|
166
|
+
"edges": x[:edges]&.map{|e| e.id},
|
167
|
+
"vertices": x[:vertices]&.map{|v| v.id}
|
168
|
+
}
|
169
|
+
end,
|
170
|
+
"idCache": @idCache,
|
171
|
+
"startVertex": @vertex&.id,
|
172
|
+
"graph": @graph&.name,
|
173
|
+
"edgeCollection": @edgeCollection&.name,
|
174
|
+
"database": @database.name
|
175
|
+
}.delete_if{|k,v| v.nil?}
|
176
|
+
end
|
177
|
+
|
178
|
+
# === EXECUTE ===
|
179
|
+
|
180
|
+
def execute
|
181
|
+
body = {
|
182
|
+
"sort": @sort,
|
183
|
+
"direction": @direction,
|
184
|
+
"maxDepth": @maxDepth,
|
185
|
+
"minDepth": @minDepth,
|
186
|
+
"startVertex": @vertex&.id,
|
187
|
+
"visitor": @visitor,
|
188
|
+
"itemOrder": @itemOrder,
|
189
|
+
"strategy": @strategy,
|
190
|
+
"filter": @filter,
|
191
|
+
"init": @init,
|
192
|
+
"maxiterations": @maxiterations,
|
193
|
+
"uniqueness": @uniqueness,
|
194
|
+
"order": @order,
|
195
|
+
"graphName": @graph&.name,
|
196
|
+
"expander": @expander,
|
197
|
+
"edgeCollection": @edgeCollection&.name
|
198
|
+
}
|
199
|
+
result = @database.request("POST", "_api/traversal", body: body)
|
200
|
+
return result if @server.async != false
|
201
|
+
@vertices = result[:result][:visited][:vertices].map do |x|
|
202
|
+
collection = Arango::Collection.new(name: x[:_id].split("/")[0],
|
203
|
+
database: @database)
|
204
|
+
Arango::Document.new(name: x[:_key], collection: collection, body: x)
|
205
|
+
end
|
206
|
+
@paths = result[:result][:visited][:paths].map do |x|
|
207
|
+
{
|
208
|
+
"edges": x[:edges].map do |e|
|
209
|
+
collection_edge = Arango::Collection.new(name: e[:_id].split("/")[0],
|
210
|
+
database: @database, type: :edge)
|
211
|
+
Arango::Document.new(name: e[:_key], collection: collection_edge,
|
212
|
+
body: e, from: e[:_from], to: e[:_to])
|
213
|
+
end,
|
214
|
+
"vertices": x[:vertices].map do |v|
|
215
|
+
collection_vertex = Arango::Collection.new(name: v[:_id].split("/")[0],
|
216
|
+
database: @database)
|
217
|
+
Arango::Document.new(name: v[:_key], collection: collection_vertex, body: v)
|
218
|
+
end
|
219
|
+
}
|
220
|
+
end
|
221
|
+
return return_directly?(result) ? result : self
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|