line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
50
|
|
|
50
|
|
699
|
use v5.14; |
|
50
|
|
|
|
|
156
|
|
2
|
50
|
|
|
50
|
|
244
|
use warnings; |
|
50
|
|
|
|
|
96
|
|
|
50
|
|
|
|
|
2194
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Attean::QuadModel - RDF model backed by a quad-store |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 VERSION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
This document describes Attean::QuadModel version 0.033 |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use v5.14; |
15
|
|
|
|
|
|
|
use Attean; |
16
|
|
|
|
|
|
|
my $model = Attean::QuadModel->new( store => $store ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
The Attean::QuadModel class represents a model that is backed by a single |
21
|
|
|
|
|
|
|
L<Attean::API::QuadStore|Attean::API::Store> object. |
22
|
|
|
|
|
|
|
It conforms to the L<Attean::API::Model> role. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
The Attean::QuadModel constructor requires one named argument: |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=over 4 |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=item store |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
A L<Attean::API::QuadStore|Attean::API::Store> object representing the backing |
31
|
|
|
|
|
|
|
quad-store. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=back |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 METHODS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=over 4 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
use Moo; |
42
|
50
|
|
|
50
|
|
311
|
use Scalar::Util qw(reftype); |
|
50
|
|
|
|
|
114
|
|
|
50
|
|
|
|
|
279
|
|
43
|
50
|
|
|
50
|
|
15359
|
use namespace::clean; |
|
50
|
|
|
|
|
116
|
|
|
50
|
|
|
|
|
2386
|
|
44
|
50
|
|
|
50
|
|
290
|
|
|
50
|
|
|
|
|
123
|
|
|
50
|
|
|
|
|
409
|
|
45
|
|
|
|
|
|
|
has 'store' => ( |
46
|
|
|
|
|
|
|
is => 'ro', |
47
|
|
|
|
|
|
|
does => 'Attean::API::QuadStore', |
48
|
|
|
|
|
|
|
required => 1, |
49
|
|
|
|
|
|
|
handles => [qw(size count_quads count_quads_estimate get_graphs holds)], |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item C<< get_quads ( $subject, $predicate, $object, $graph ) >> |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Returns an L<Attean::API::Iterator> for quads in the model that match the |
55
|
|
|
|
|
|
|
supplied C<< $subject >>, C<< $predicate >>, C<< $object >>, and C<< $graph >>. |
56
|
|
|
|
|
|
|
Any of these terms may be undefined or a L<Attean::API::Variable> object, in |
57
|
|
|
|
|
|
|
which case that term will be considered as a wildcard for the purposes of |
58
|
|
|
|
|
|
|
matching. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
The returned iterator conforms to both L<Attean::API::Iterator> and |
61
|
|
|
|
|
|
|
L<Attean::API::QuadIterator>. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my $self = shift; |
66
|
|
|
|
|
|
|
my @nodes = @_[0..3]; |
67
|
89
|
|
|
89
|
1
|
1355
|
foreach my $i (0..3) { |
68
|
89
|
|
|
|
|
291
|
my $t = $nodes[$i]; |
69
|
89
|
|
|
|
|
249
|
if (not(ref($t)) or reftype($t) ne 'ARRAY') { |
70
|
356
|
|
|
|
|
436
|
$nodes[$i] = [$t]; |
71
|
356
|
100
|
100
|
|
|
1215
|
} |
72
|
345
|
|
|
|
|
637
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my @iters; |
75
|
|
|
|
|
|
|
foreach my $s (@{ $nodes[0] }) { |
76
|
89
|
|
|
|
|
143
|
foreach my $p (@{ $nodes[1] }) { |
77
|
89
|
|
|
|
|
178
|
foreach my $o (@{ $nodes[2] }) { |
|
89
|
|
|
|
|
215
|
|
78
|
89
|
|
|
|
|
127
|
foreach my $g (@{ $nodes[3] }) { |
|
89
|
|
|
|
|
176
|
|
79
|
91
|
|
|
|
|
205
|
push(@iters, $self->store->get_quads($s, $p, $o, $g)); |
|
91
|
|
|
|
|
164
|
|
80
|
91
|
|
|
|
|
128
|
} |
|
91
|
|
|
|
|
162
|
|
81
|
95
|
|
|
|
|
2383
|
} |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
if (scalar(@iters) == 0) { |
86
|
|
|
|
|
|
|
return Attean::ListIterator->new(values => [], item_type => 'Attean::API::Quad'); |
87
|
89
|
50
|
|
|
|
3493
|
} elsif (scalar(@iters) == 1) { |
|
|
100
|
|
|
|
|
|
88
|
0
|
|
|
|
|
0
|
return shift(@iters); |
89
|
|
|
|
|
|
|
} else { |
90
|
87
|
|
|
|
|
502
|
return Attean::IteratorSequence->new( iterators => \@iters, item_type => $iters[0]->item_type ); |
91
|
|
|
|
|
|
|
} |
92
|
2
|
|
|
|
|
102
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item C<< plans_for_algebra( $algebra, $model, $active_graphs, $default_graphs ) >> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Delegates to the underlying store if the store consumes Attean::API::CostPlanner. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
my $self = shift; |
101
|
|
|
|
|
|
|
if ($self->store->does('Attean::API::CostPlanner')) { |
102
|
|
|
|
|
|
|
return $self->store->plans_for_algebra(@_); |
103
|
130
|
|
|
130
|
1
|
192
|
} |
104
|
130
|
50
|
|
|
|
393
|
return; |
105
|
130
|
|
|
|
|
1753
|
} |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
=item C<< cost_for_plan( $plan ) >> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Delegates to the underlying store if the store consumes Attean::API::CostPlanner. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
my $self = shift; |
114
|
|
|
|
|
|
|
if ($self->store->does('Attean::API::CostPlanner')) { |
115
|
|
|
|
|
|
|
return $self->store->cost_for_plan(@_); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
return; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
with 'Attean::API::Model'; |
121
|
|
|
|
|
|
|
with 'Attean::API::CostPlanner'; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
use Moo; |
126
|
|
|
|
|
|
|
extends 'Attean::QuadModel'; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
has 'store' => ( |
129
|
|
|
|
|
|
|
is => 'ro', |
130
|
50
|
|
|
50
|
|
44244
|
does => 'Attean::API::MutableQuadStore', |
|
50
|
|
|
|
|
109
|
|
|
50
|
|
|
|
|
201
|
|
131
|
|
|
|
|
|
|
required => 1, |
132
|
|
|
|
|
|
|
handles => [qw(size count_quads count_quads_estimate add_quad remove_quad get_graphs create_graph drop_graph clear_graph add_iter)], |
133
|
|
|
|
|
|
|
); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
with 'Attean::API::MutableModel'; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
1; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=back |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 BUGS |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Please report any bugs or feature requests to through the GitHub web interface |
146
|
|
|
|
|
|
|
at L<https://github.com/kasei/attean/issues>. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 SEE ALSO |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 AUTHOR |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Gregory Todd Williams C<< <gwilliams@cpan.org> >> |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 COPYRIGHT |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Copyright (c) 2014--2022 Gregory Todd Williams. |
159
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under |
160
|
|
|
|
|
|
|
the same terms as Perl itself. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=cut |