| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package ArangoDB2::Graph::EdgeDefinition; |
|
2
|
|
|
|
|
|
|
|
|
3
|
21
|
|
|
21
|
|
80
|
use strict; |
|
|
21
|
|
|
|
|
22
|
|
|
|
21
|
|
|
|
|
640
|
|
|
4
|
21
|
|
|
21
|
|
78
|
use warnings; |
|
|
21
|
|
|
|
|
27
|
|
|
|
21
|
|
|
|
|
489
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
21
|
|
|
|
|
1304
|
use base qw( |
|
7
|
|
|
|
|
|
|
ArangoDB2::Base |
|
8
|
21
|
|
|
21
|
|
78
|
); |
|
|
21
|
|
|
|
|
29
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
21
|
|
|
21
|
|
99
|
use Data::Dumper; |
|
|
21
|
|
|
|
|
19
|
|
|
|
21
|
|
|
|
|
851
|
|
|
11
|
21
|
|
|
21
|
|
81
|
use JSON::XS; |
|
|
21
|
|
|
|
|
23
|
|
|
|
21
|
|
|
|
|
769
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
21
|
|
|
21
|
|
7105
|
use ArangoDB2::Graph::Edge; |
|
|
21
|
|
|
|
|
35
|
|
|
|
21
|
|
|
|
|
11481
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $JSON = JSON::XS->new->utf8; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# create |
|
20
|
|
|
|
|
|
|
# |
|
21
|
|
|
|
|
|
|
# POST /_api/gharial/graph-name/edge |
|
22
|
|
|
|
|
|
|
sub create |
|
23
|
|
|
|
|
|
|
{ |
|
24
|
0
|
|
|
0
|
1
|
0
|
my($self, $args) = @_; |
|
25
|
|
|
|
|
|
|
# process request args |
|
26
|
0
|
|
|
|
|
0
|
$args = $self->_build_args($args, ['from', 'name', 'to']); |
|
27
|
|
|
|
|
|
|
# copy name to collection |
|
28
|
0
|
|
|
|
|
0
|
my $name = $args->{collection} = delete $args->{name}; |
|
29
|
|
|
|
|
|
|
# make request |
|
30
|
0
|
0
|
|
|
|
0
|
my $res = $self->arango->http->post( |
|
31
|
|
|
|
|
|
|
$self->api_path('gharial', $self->graph->name, 'edge'), |
|
32
|
|
|
|
|
|
|
undef, |
|
33
|
|
|
|
|
|
|
$JSON->encode($args), |
|
34
|
|
|
|
|
|
|
) or return; |
|
35
|
|
|
|
|
|
|
# set name |
|
36
|
0
|
|
|
|
|
0
|
$self->name($name); |
|
37
|
|
|
|
|
|
|
# update parent graph object with response data |
|
38
|
0
|
|
|
|
|
0
|
$self->graph->_build_self($res, ['edgeDefinitions', 'name', 'orphanCollections']); |
|
39
|
|
|
|
|
|
|
# register instance |
|
40
|
0
|
|
|
|
|
0
|
$self->graph->edgeDefinitionRegister->{$self->name} = $self; |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
0
|
return $self; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# delete |
|
46
|
|
|
|
|
|
|
# |
|
47
|
|
|
|
|
|
|
# DELETE /_api/gharial/graph-name/vertex/collection-name |
|
48
|
|
|
|
|
|
|
sub delete |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
0
|
|
|
0
|
1
|
0
|
my($self, $args) = @_; |
|
51
|
|
|
|
|
|
|
# process request args |
|
52
|
0
|
|
|
|
|
0
|
$args = $self->_build_args($args, ['dropCollection', 'name']); |
|
53
|
|
|
|
|
|
|
# make request |
|
54
|
0
|
0
|
|
|
|
0
|
my $res = $self->arango->http->delete( |
|
55
|
|
|
|
|
|
|
$self->api_path('gharial', $self->graph->name, 'edge', delete $args->{name}), |
|
56
|
|
|
|
|
|
|
$args, |
|
57
|
|
|
|
|
|
|
) or return; |
|
58
|
|
|
|
|
|
|
# update parent graph object with response data |
|
59
|
0
|
|
|
|
|
0
|
$self->graph->_build_self($res, ['edgeDefinitions', 'name', 'orphanCollections']); |
|
60
|
|
|
|
|
|
|
# unregister instance |
|
61
|
0
|
|
|
|
|
0
|
delete $self->graph->edgeDefinitionRegister->{$self->name}; |
|
62
|
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
0
|
return $res; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# dropCollection |
|
67
|
|
|
|
|
|
|
# |
|
68
|
|
|
|
|
|
|
# get/set dropCollection |
|
69
|
0
|
|
|
0
|
1
|
0
|
sub dropCollection { shift->_get_set_bool('dropCollection', @_) } |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# edge |
|
72
|
|
|
|
|
|
|
# |
|
73
|
|
|
|
|
|
|
# return an ArangoDB2::Graph::Edge object |
|
74
|
|
|
|
|
|
|
sub edge |
|
75
|
|
|
|
|
|
|
{ |
|
76
|
1
|
|
|
1
|
1
|
7
|
my($self, $name) = @_; |
|
77
|
|
|
|
|
|
|
|
|
78
|
1
|
50
|
|
|
|
4
|
if (defined $name) { |
|
79
|
0
|
|
0
|
|
|
0
|
return $self->edges->{$name} ||= ArangoDB2::Graph::Edge->new( |
|
80
|
|
|
|
|
|
|
$self->arango, |
|
81
|
|
|
|
|
|
|
$self->database, |
|
82
|
|
|
|
|
|
|
$self->graph, |
|
83
|
|
|
|
|
|
|
$self, |
|
84
|
|
|
|
|
|
|
$name, |
|
85
|
|
|
|
|
|
|
); |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
else { |
|
88
|
1
|
|
|
|
|
8
|
return ArangoDB2::Graph::Edge->new( |
|
89
|
|
|
|
|
|
|
$self->arango, |
|
90
|
|
|
|
|
|
|
$self->database, |
|
91
|
|
|
|
|
|
|
$self->graph, |
|
92
|
|
|
|
|
|
|
$self, |
|
93
|
|
|
|
|
|
|
); |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# edges |
|
98
|
|
|
|
|
|
|
# |
|
99
|
|
|
|
|
|
|
# index of ArangoDB2::Graph::Edge objects by name |
|
100
|
0
|
|
0
|
0
|
1
|
0
|
sub edges { $_[0]->{edges} ||= {} } |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# from |
|
103
|
|
|
|
|
|
|
# |
|
104
|
|
|
|
|
|
|
# get/set from (collection/name) |
|
105
|
0
|
|
|
0
|
1
|
0
|
sub from { shift->_get_set('from', @_) }; |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# list |
|
108
|
|
|
|
|
|
|
# |
|
109
|
|
|
|
|
|
|
# GET /_api/gharial/graph-name/edge |
|
110
|
|
|
|
|
|
|
sub list |
|
111
|
|
|
|
|
|
|
{ |
|
112
|
0
|
|
|
0
|
1
|
0
|
my($self) = @_; |
|
113
|
|
|
|
|
|
|
|
|
114
|
0
|
0
|
|
|
|
0
|
my $res = $self->arango->http->get( |
|
115
|
|
|
|
|
|
|
$self->api_path('gharial', $self->graph->name, 'edge') |
|
116
|
|
|
|
|
|
|
) or return; |
|
117
|
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
0
|
return $res->{collections}; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
# replace |
|
122
|
|
|
|
|
|
|
# |
|
123
|
|
|
|
|
|
|
# PUT /_api/gharial/graph-name/edge/definition-name |
|
124
|
|
|
|
|
|
|
sub replace |
|
125
|
|
|
|
|
|
|
{ |
|
126
|
0
|
|
|
0
|
1
|
0
|
my($self, $args) = @_; |
|
127
|
|
|
|
|
|
|
# process request args |
|
128
|
0
|
|
|
|
|
0
|
$args = $self->_build_args($args, ['from', 'name', 'to']); |
|
129
|
|
|
|
|
|
|
# copy name to collection |
|
130
|
0
|
|
|
|
|
0
|
my $name = $args->{collection} = delete $args->{name}; |
|
131
|
|
|
|
|
|
|
# make request |
|
132
|
0
|
0
|
|
|
|
0
|
my $res = $self->arango->http->put( |
|
133
|
|
|
|
|
|
|
$self->api_path('gharial', $self->graph->name, 'edge', $self->name), |
|
134
|
|
|
|
|
|
|
undef, |
|
135
|
|
|
|
|
|
|
$JSON->encode($args), |
|
136
|
|
|
|
|
|
|
) or return; |
|
137
|
|
|
|
|
|
|
# set name |
|
138
|
0
|
|
|
|
|
0
|
$self->name($name); |
|
139
|
|
|
|
|
|
|
# update parent graph object with response data |
|
140
|
0
|
|
|
|
|
0
|
$self->graph->_build_self($res, ['edgeDefinitions', 'name', 'orphanCollections']); |
|
141
|
|
|
|
|
|
|
# register instance |
|
142
|
0
|
|
|
|
|
0
|
$self->graph->edgeDefinitionRegister->{$self->name} = $self; |
|
143
|
|
|
|
|
|
|
|
|
144
|
0
|
|
|
|
|
0
|
return $self; |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
# to |
|
148
|
|
|
|
|
|
|
# |
|
149
|
|
|
|
|
|
|
# get/set from (collection/name) |
|
150
|
0
|
|
|
0
|
1
|
0
|
sub to { shift->_get_set('to', @_) }; |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
# _class |
|
153
|
|
|
|
|
|
|
# |
|
154
|
|
|
|
|
|
|
# internally we treat this as a collection |
|
155
|
1
|
|
|
1
|
|
7
|
sub _class { 'collection' } |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
1; |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
__END__ |