This file is indexed.

/usr/share/perl5/Test/Attean/MutableQuadStore.pm is in libattean-perl 0.017-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package Test::Attean::MutableQuadStore;

use v5.14;
use warnings;
use Test::Roo::Role;
use Test::Moose;
use Attean;
use Attean::RDF;

requires 'create_store';      # create_store( quads => \@quads )
with 'Test::Attean::StoreCleanup';

test 'mutablequadstore add_quad' => sub {
    my $self	= shift;
    my $q1		= quad(iri('s'), iri('p'), iri('o'), iri('g'));
    my $q2		= quad(iri('x'), iri('y'), iri('z'), iri('g'));
    my $q3		= quad(iri('x'), iri('y'), iri('z'), iri('g2'));
    
    my $store	= $self->create_store(quads => []);
    my $size	= 0;
    for my $q ($q1, $q2, $q3) {
    	$store->add_quad($q);
    	is($store->size, ++$size, "size $size");
    }
	$self->cleanup_store($store);
};

test 'mutablequadstore remove_quad' => sub {
    my $self	= shift;
    my $q1		= quad(iri('s'), iri('p'), iri('o'), iri('g'));
    my $q2		= quad(iri('x'), iri('y'), iri('z'), iri('g'));
    my $q3		= quad(iri('x'), iri('y'), iri('z'), iri('g2'));
    
    my $store	= $self->create_store(quads => [$q3, $q2, $q1]);
    my $size	= 3;
    for my $q ($q1, $q2, $q3) {
    	is($store->size, $size, "size $size");
    	$store->remove_quad($q);
    	$size--;
    }
	$store->remove_quad($q2);
	is($store->size, 0, "size $size");
	$self->cleanup_store($store);
};

test 'mutablequadstore create_graph' => sub {
    my $self	= shift;
    my $store	= $self->create_store(quads => []);
    
    my $count	= 0;
    foreach my $g (iri('g1'), iri('g2'), iri('g3')) {
		$store->create_graph($g);
		my @graphs	= sort map { $_->value } $store->get_graphs->elements;
		my $graphs	= scalar(@graphs);
		ok($graphs == 0 or $graphs == ++$count);
    }

	$store->create_graph(iri('g2'));
	my @graphs	= sort map { $_->value } $store->get_graphs->elements;
	my $graphs	= scalar(@graphs);
	ok($graphs == 0 or $graphs == $count);
	$self->cleanup_store($store);
};

test 'mutablequadstore drop_graph' => sub {
	# drop_graph removes all the quads in a specific graph and removes the
	# graph from the list of graphs returned as an iterator from
	# $store->get_graphs
    my $self	= shift;
    my $q1		= quad(iri('s'), iri('p'), iri('o'), iri('g'));
    my $q2		= quad(iri('x'), iri('y'), iri('z'), iri('g'));
    my $q3		= quad(iri('x'), iri('y'), iri('z'), iri('g2'));
    
    {
		my $store	= $self->create_store(quads => [$q1, $q2, $q3]);
		$store->drop_graph(iri('g'));
		is($store->size, 1);
		my @graphs	= sort map { $_->value } $store->get_graphs->elements;
		is_deeply(\@graphs, ['g2']);
		$self->cleanup_store($store);
	}
    {
		my $store	= $self->create_store(quads => [$q1, $q2, $q3]);
		$store->drop_graph(iri('g2'));
		is($store->size, 2);
		my @graphs	= sort map { $_->value } $store->get_graphs->elements;
		is_deeply(\@graphs, ['g']);
		$self->cleanup_store($store);
	}
};

test 'mutablequadstore clear_graph' => sub {
	# clear_graph removes all the quads in a specific graph
	# depending on whether the implementation supports empty graphs,
	# the cleared graph may or may not disappear from the list of graphs
	# returned as an iterator from $store->get_graphs
    my $self	= shift;
    my $q1		= quad(iri('s'), iri('p'), iri('o'), iri('g'));
    my $q2		= quad(iri('x'), iri('y'), iri('z'), iri('g'));
    my $q3		= quad(iri('x'), iri('y'), iri('z'), iri('g2'));
    
    {
		my $store	= $self->create_store(quads => [$q1, $q2, $q3]);
		$store->clear_graph(iri('g'));
		is($store->size, 1);
		my @graphs	= sort map { $_->value } $store->get_graphs->elements;
		my $graphs	= scalar(@graphs);
		ok($graphs == 1 or $graphs == 2);
		$self->cleanup_store($store);
	}
    {
		my $store	= $self->create_store(quads => [$q1, $q2, $q3]);
		$store->clear_graph(iri('g2'));
		is($store->size, 2);
		my @graphs	= sort map { $_->value } $store->get_graphs->elements;
		my $graphs	= scalar(@graphs);
		ok($graphs == 1 or $graphs == 2);
		$self->cleanup_store($store);
	}
};

1;