line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package RDF::AllegroGraph::Server3; |
2
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
95990
|
use strict; |
|
15
|
|
|
|
|
40
|
|
|
15
|
|
|
|
|
528
|
|
4
|
15
|
|
|
15
|
|
75
|
use warnings; |
|
15
|
|
|
|
|
43
|
|
|
15
|
|
|
|
|
429
|
|
5
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
76
|
use base qw(RDF::AllegroGraph::Server); |
|
15
|
|
|
|
|
27
|
|
|
15
|
|
|
|
|
2325
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=pod |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
RDF::AllegroGraph::Server3 - AllegroGraph server handle for the AGv3 series |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# same interface as RDF::AllegroGraph::Server |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
15
|
|
|
15
|
|
9112
|
use JSON; |
|
15
|
|
|
|
|
136314
|
|
|
15
|
|
|
|
|
109
|
|
21
|
15
|
|
|
15
|
|
3628
|
use Data::Dumper; |
|
15
|
|
|
|
|
8793
|
|
|
15
|
|
|
|
|
979
|
|
22
|
|
|
|
|
|
|
|
23
|
15
|
|
|
15
|
|
11396
|
use RDF::AllegroGraph::Catalog3; |
|
15
|
|
|
|
|
47
|
|
|
15
|
|
|
|
|
6384
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=pod |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 INTERFACE |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 Methods |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=over |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub catalogs { |
36
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
37
|
0
|
|
|
|
|
|
my $resp = $self->{ua}->get ($self->{ADDRESS} . '/catalogs'); |
38
|
0
|
0
|
|
|
|
|
die "protocol error: ".$resp->status_line unless $resp->is_success; |
39
|
0
|
|
|
|
|
|
my $cats = from_json ($resp->content); |
40
|
|
|
|
|
|
|
# warn Dumper $cats; |
41
|
|
|
|
|
|
|
return |
42
|
0
|
0
|
|
|
|
|
map { $_ => RDF::AllegroGraph::Catalog3->new (NAME => $_, SERVER => $self) } |
|
0
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
map { s|^/catalogs|| && $_ } |
44
|
|
|
|
|
|
|
@$cats; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub ping { |
48
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
49
|
0
|
0
|
|
|
|
|
$self->catalogs and return 1; # even if there are no catalogs, we survived the call |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub models { |
53
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
54
|
0
|
|
|
|
|
|
my %cats = $self->catalogs; # find all catalogs |
55
|
|
|
|
|
|
|
return |
56
|
0
|
|
|
|
|
|
map { $_->id => $_ } # generate a hash, because the id is a good key |
|
0
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
map { $_->repositories } # generate from the catalog all its repos |
58
|
|
|
|
|
|
|
values %cats; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub model { |
62
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
63
|
0
|
|
|
|
|
|
my $id = shift; |
64
|
0
|
|
|
|
|
|
my %options = @_; |
65
|
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
my ($catid, $repoid) = ($id =~ q|(/.+?)(/.+)|) or die "id must be of the form /something/else"; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my %catalogs = $self->catalogs; |
69
|
0
|
0
|
|
|
|
|
die "no catalog '$catid'" unless $catalogs{$catid}; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return $catalogs{$catid}->repository ($id, $options{mode}); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=back |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AUTHOR |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Robert Barta, C<< >> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Copyright 20(0[9]|11) Robert Barta, all rights reserved. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl |
85
|
|
|
|
|
|
|
itself. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
L |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |