| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use v5.14; |
|
3
|
1
|
|
|
1
|
|
676
|
use warnings; |
|
|
1
|
|
|
|
|
4
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use Test::Roo::Role; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
34
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use Test::Moose; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
8
|
|
|
6
|
1
|
|
|
1
|
|
1090
|
use Attean; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
8
|
|
|
7
|
1
|
|
|
1
|
|
604
|
use Attean::RDF; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
8
|
|
|
8
|
1
|
|
|
1
|
|
5
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
9
|
|
|
9
|
|
|
|
|
|
|
requires 'create_store'; # create_store( quads => \@quads ) |
|
10
|
|
|
|
|
|
|
with 'Test::Attean::StoreCleanup'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
test 'mutablequadstore add_quad' => sub { |
|
13
|
|
|
|
|
|
|
my $self = shift; |
|
14
|
|
|
|
|
|
|
my $q1 = quad(iri('s'), iri('p'), iri('o'), iri('g')); |
|
15
|
|
|
|
|
|
|
my $q2 = quad(iri('x'), iri('y'), iri('z'), iri('g')); |
|
16
|
|
|
|
|
|
|
my $q3 = quad(iri('x'), iri('y'), iri('z'), iri('g2')); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $store = $self->create_store(quads => []); |
|
19
|
|
|
|
|
|
|
my $size = 0; |
|
20
|
|
|
|
|
|
|
for my $q ($q1, $q2, $q3) { |
|
21
|
|
|
|
|
|
|
$store->add_quad($q); |
|
22
|
|
|
|
|
|
|
is($store->size, ++$size, "size $size"); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
$self->cleanup_store($store); |
|
25
|
|
|
|
|
|
|
}; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
test 'mutablequadstore remove_quad' => sub { |
|
28
|
|
|
|
|
|
|
my $self = shift; |
|
29
|
|
|
|
|
|
|
my $q1 = quad(iri('s'), iri('p'), iri('o'), iri('g')); |
|
30
|
|
|
|
|
|
|
my $q2 = quad(iri('x'), iri('y'), iri('z'), iri('g')); |
|
31
|
|
|
|
|
|
|
my $q3 = quad(iri('x'), iri('y'), iri('z'), iri('g2')); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $store = $self->create_store(quads => [$q3, $q2, $q1]); |
|
34
|
|
|
|
|
|
|
my $size = 3; |
|
35
|
|
|
|
|
|
|
for my $q ($q1, $q2, $q3) { |
|
36
|
|
|
|
|
|
|
is($store->size, $size, "size $size"); |
|
37
|
|
|
|
|
|
|
$store->remove_quad($q); |
|
38
|
|
|
|
|
|
|
$size--; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
$store->remove_quad($q2); |
|
41
|
|
|
|
|
|
|
is($store->size, 0, "size $size"); |
|
42
|
|
|
|
|
|
|
$self->cleanup_store($store); |
|
43
|
|
|
|
|
|
|
}; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
test 'mutablequadstore create_graph' => sub { |
|
46
|
|
|
|
|
|
|
my $self = shift; |
|
47
|
|
|
|
|
|
|
my $store = $self->create_store(quads => []); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $count = 0; |
|
50
|
|
|
|
|
|
|
foreach my $g (iri('g1'), iri('g2'), iri('g3')) { |
|
51
|
|
|
|
|
|
|
$store->create_graph($g); |
|
52
|
|
|
|
|
|
|
my @graphs = sort map { $_->value } $store->get_graphs->elements; |
|
53
|
|
|
|
|
|
|
my $graphs = scalar(@graphs); |
|
54
|
|
|
|
|
|
|
ok($graphs == 0 or $graphs == ++$count); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
$store->create_graph(iri('g2')); |
|
58
|
|
|
|
|
|
|
my @graphs = sort map { $_->value } $store->get_graphs->elements; |
|
59
|
|
|
|
|
|
|
my $graphs = scalar(@graphs); |
|
60
|
|
|
|
|
|
|
ok($graphs == 0 or $graphs == $count); |
|
61
|
|
|
|
|
|
|
$self->cleanup_store($store); |
|
62
|
|
|
|
|
|
|
}; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
test 'mutablequadstore drop_graph' => sub { |
|
65
|
|
|
|
|
|
|
# drop_graph removes all the quads in a specific graph and removes the |
|
66
|
|
|
|
|
|
|
# graph from the list of graphs returned as an iterator from |
|
67
|
|
|
|
|
|
|
# $store->get_graphs |
|
68
|
|
|
|
|
|
|
my $self = shift; |
|
69
|
|
|
|
|
|
|
my $q1 = quad(iri('s'), iri('p'), iri('o'), iri('g')); |
|
70
|
|
|
|
|
|
|
my $q2 = quad(iri('x'), iri('y'), iri('z'), iri('g')); |
|
71
|
|
|
|
|
|
|
my $q3 = quad(iri('x'), iri('y'), iri('z'), iri('g2')); |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
{ |
|
74
|
|
|
|
|
|
|
my $store = $self->create_store(quads => [$q1, $q2, $q3]); |
|
75
|
|
|
|
|
|
|
$store->drop_graph(iri('g')); |
|
76
|
|
|
|
|
|
|
is($store->size, 1); |
|
77
|
|
|
|
|
|
|
my @graphs = sort map { $_->value } $store->get_graphs->elements; |
|
78
|
|
|
|
|
|
|
is_deeply(\@graphs, ['g2']); |
|
79
|
|
|
|
|
|
|
$self->cleanup_store($store); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
{ |
|
82
|
|
|
|
|
|
|
my $store = $self->create_store(quads => [$q1, $q2, $q3]); |
|
83
|
|
|
|
|
|
|
$store->drop_graph(iri('g2')); |
|
84
|
|
|
|
|
|
|
is($store->size, 2); |
|
85
|
|
|
|
|
|
|
my @graphs = sort map { $_->value } $store->get_graphs->elements; |
|
86
|
|
|
|
|
|
|
is_deeply(\@graphs, ['g']); |
|
87
|
|
|
|
|
|
|
$self->cleanup_store($store); |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
}; |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
test 'mutablequadstore clear_graph' => sub { |
|
92
|
|
|
|
|
|
|
# clear_graph removes all the quads in a specific graph |
|
93
|
|
|
|
|
|
|
# depending on whether the implementation supports empty graphs, |
|
94
|
|
|
|
|
|
|
# the cleared graph may or may not disappear from the list of graphs |
|
95
|
|
|
|
|
|
|
# returned as an iterator from $store->get_graphs |
|
96
|
|
|
|
|
|
|
my $self = shift; |
|
97
|
|
|
|
|
|
|
my $q1 = quad(iri('s'), iri('p'), iri('o'), iri('g')); |
|
98
|
|
|
|
|
|
|
my $q2 = quad(iri('x'), iri('y'), iri('z'), iri('g')); |
|
99
|
|
|
|
|
|
|
my $q3 = quad(iri('x'), iri('y'), iri('z'), iri('g2')); |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
{ |
|
102
|
|
|
|
|
|
|
my $store = $self->create_store(quads => [$q1, $q2, $q3]); |
|
103
|
|
|
|
|
|
|
$store->clear_graph(iri('g')); |
|
104
|
|
|
|
|
|
|
is($store->size, 1); |
|
105
|
|
|
|
|
|
|
my @graphs = sort map { $_->value } $store->get_graphs->elements; |
|
106
|
|
|
|
|
|
|
my $graphs = scalar(@graphs); |
|
107
|
|
|
|
|
|
|
ok($graphs == 1 or $graphs == 2); |
|
108
|
|
|
|
|
|
|
$self->cleanup_store($store); |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
{ |
|
111
|
|
|
|
|
|
|
my $store = $self->create_store(quads => [$q1, $q2, $q3]); |
|
112
|
|
|
|
|
|
|
$store->clear_graph(iri('g2')); |
|
113
|
|
|
|
|
|
|
is($store->size, 2); |
|
114
|
|
|
|
|
|
|
my @graphs = sort map { $_->value } $store->get_graphs->elements; |
|
115
|
|
|
|
|
|
|
my $graphs = scalar(@graphs); |
|
116
|
|
|
|
|
|
|
ok($graphs == 1 or $graphs == 2); |
|
117
|
|
|
|
|
|
|
$self->cleanup_store($store); |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
}; |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |