| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package ArangoDB2::Graph::VertexCollection; |
|
2
|
|
|
|
|
|
|
|
|
3
|
20
|
|
|
20
|
|
83
|
use strict; |
|
|
20
|
|
|
|
|
24
|
|
|
|
20
|
|
|
|
|
645
|
|
|
4
|
20
|
|
|
20
|
|
589
|
use warnings; |
|
|
20
|
|
|
|
|
32
|
|
|
|
20
|
|
|
|
|
611
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
20
|
|
|
|
|
1462
|
use base qw( |
|
7
|
|
|
|
|
|
|
ArangoDB2::Base |
|
8
|
20
|
|
|
20
|
|
84
|
); |
|
|
20
|
|
|
|
|
47
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
20
|
|
|
20
|
|
97
|
use Data::Dumper; |
|
|
20
|
|
|
|
|
23
|
|
|
|
20
|
|
|
|
|
896
|
|
|
11
|
20
|
|
|
20
|
|
86
|
use JSON::XS; |
|
|
20
|
|
|
|
|
21
|
|
|
|
20
|
|
|
|
|
790
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
20
|
|
|
20
|
|
85
|
use ArangoDB2::Graph::Vertex; |
|
|
20
|
|
|
|
|
18
|
|
|
|
20
|
|
|
|
|
8374
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $JSON = JSON::XS->new->utf8; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# create |
|
20
|
|
|
|
|
|
|
# |
|
21
|
|
|
|
|
|
|
# POST /_api/gharial/graph-name/vertex |
|
22
|
|
|
|
|
|
|
sub create |
|
23
|
|
|
|
|
|
|
{ |
|
24
|
0
|
|
|
0
|
1
|
0
|
my($self, $args) = @_; |
|
25
|
|
|
|
|
|
|
# process request args |
|
26
|
0
|
|
|
|
|
0
|
$args = $self->_build_args($args, ['name']); |
|
27
|
|
|
|
|
|
|
# make request |
|
28
|
0
|
0
|
|
|
|
0
|
my $res = $self->arango->http->post( |
|
29
|
|
|
|
|
|
|
$self->api_path('gharial', $self->graph->name, 'vertex'), |
|
30
|
|
|
|
|
|
|
undef, |
|
31
|
|
|
|
|
|
|
$JSON->encode({collection => $args->{name}}), |
|
32
|
|
|
|
|
|
|
) or return; |
|
33
|
|
|
|
|
|
|
# set name |
|
34
|
0
|
|
|
|
|
0
|
$self->name($args->{name}); |
|
35
|
|
|
|
|
|
|
# update parent graph object with response data |
|
36
|
0
|
|
|
|
|
0
|
$self->graph->_build_self($res, ['edgeDefinitions', 'name', 'orphanCollections']); |
|
37
|
|
|
|
|
|
|
# register instance |
|
38
|
0
|
|
|
|
|
0
|
$self->graph->vertexCollections->{$self->name} = $self; |
|
39
|
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
0
|
return $self; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# delete |
|
44
|
|
|
|
|
|
|
# |
|
45
|
|
|
|
|
|
|
# DELETE /_api/gharial/graph-name/vertex/collection-name |
|
46
|
|
|
|
|
|
|
sub delete |
|
47
|
|
|
|
|
|
|
{ |
|
48
|
0
|
|
|
0
|
1
|
0
|
my($self, $args) = @_; |
|
49
|
|
|
|
|
|
|
# process request args |
|
50
|
0
|
|
|
|
|
0
|
$args = $self->_build_args($args, ['dropCollection', 'name']); |
|
51
|
|
|
|
|
|
|
# make request |
|
52
|
0
|
0
|
|
|
|
0
|
my $res = $self->arango->http->delete( |
|
53
|
|
|
|
|
|
|
$self->api_path('gharial', $self->graph->name, 'vertex', delete $args->{name}), |
|
54
|
|
|
|
|
|
|
$args, |
|
55
|
|
|
|
|
|
|
) or return; |
|
56
|
|
|
|
|
|
|
# update parent graph object with response data |
|
57
|
0
|
|
|
|
|
0
|
$self->graph->_build_self($res, ['edgeDefinitions', 'name', 'orphanCollections']); |
|
58
|
|
|
|
|
|
|
# unregister instance |
|
59
|
0
|
|
|
|
|
0
|
delete $self->graph->vertexCollections->{$self->name}; |
|
60
|
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
0
|
return $res; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# dropCollection |
|
65
|
|
|
|
|
|
|
# |
|
66
|
|
|
|
|
|
|
# get/set dropCollection |
|
67
|
0
|
|
|
0
|
1
|
0
|
sub dropCollection { shift->_get_set_bool('dropCollection', @_) } |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# list |
|
70
|
|
|
|
|
|
|
# |
|
71
|
|
|
|
|
|
|
# GET /_api/gharial/graph-name/vertex |
|
72
|
|
|
|
|
|
|
sub list |
|
73
|
|
|
|
|
|
|
{ |
|
74
|
0
|
|
|
0
|
1
|
0
|
my($self) = @_; |
|
75
|
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
0
|
my $res = $self->arango->http->get( |
|
77
|
|
|
|
|
|
|
$self->api_path('gharial', $self->graph->name, 'vertex') |
|
78
|
|
|
|
|
|
|
) or return; |
|
79
|
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
0
|
return $res->{collections}; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# vertex |
|
84
|
|
|
|
|
|
|
# |
|
85
|
|
|
|
|
|
|
# return an ArangoDB2::Graph::Vertex object |
|
86
|
|
|
|
|
|
|
sub vertex |
|
87
|
|
|
|
|
|
|
{ |
|
88
|
1
|
|
|
1
|
1
|
6
|
my($self, $name) = @_; |
|
89
|
|
|
|
|
|
|
|
|
90
|
1
|
50
|
|
|
|
3
|
if (defined $name) { |
|
91
|
0
|
|
0
|
|
|
0
|
return $self->vertices->{$name} ||= ArangoDB2::Graph::Vertex->new( |
|
92
|
|
|
|
|
|
|
$self->arango, |
|
93
|
|
|
|
|
|
|
$self->database, |
|
94
|
|
|
|
|
|
|
$self->graph, |
|
95
|
|
|
|
|
|
|
$self, |
|
96
|
|
|
|
|
|
|
$name, |
|
97
|
|
|
|
|
|
|
); |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
else { |
|
100
|
1
|
|
|
|
|
4
|
return ArangoDB2::Graph::Vertex->new( |
|
101
|
|
|
|
|
|
|
$self->arango, |
|
102
|
|
|
|
|
|
|
$self->database, |
|
103
|
|
|
|
|
|
|
$self->graph, |
|
104
|
|
|
|
|
|
|
$self, |
|
105
|
|
|
|
|
|
|
); |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
# vertices |
|
110
|
|
|
|
|
|
|
# |
|
111
|
|
|
|
|
|
|
# index of ArangoDB2::Graph::Vertex objects by name |
|
112
|
0
|
|
0
|
0
|
1
|
0
|
sub vertices { $_[0]->{vertices} ||= {} } |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
# _class |
|
115
|
|
|
|
|
|
|
# |
|
116
|
|
|
|
|
|
|
# internally treat this as a collection |
|
117
|
1
|
|
|
1
|
|
3
|
sub _class { 'collection' } |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
__END__ |