This file is indexed.

/usr/share/perl5/AtteanX/Store/SimpleTripleStore.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
=head1 NAME

AtteanX::Store::SimpleTripleStore - SimpleTripleStore, unindexed, in-memory RDF store

=head1 VERSION

This document describes AtteanX::Store::SimpleTripleStore version 0.017

=head1 SYNOPSIS

 use AtteanX::Store::SimpleTripleStore;

=head1 DESCRIPTION

AtteanX::Store::SimpleTripleStore provides an in-memory triple-store.

=cut

use v5.14;
use warnings;

package AtteanX::Store::SimpleTripleStore 0.017 {
	use Moo;
	use Type::Tiny::Role;
	use Types::Standard qw(Int ArrayRef HashRef ConsumerOf InstanceOf);
	use Encode;
	use Set::Scalar;
	use Digest::SHA;
	use List::Util qw(first);
	use Scalar::Util qw(refaddr reftype blessed);
	use namespace::clean;

	with 'Attean::API::MutableTripleStore';

	my @pos_names	= Attean::API::Quad->variables;

=head1 METHODS

Beyond the methods documented below, this class inherits methods from the
L<Attean::API::QuadStore> class.

=over 4

=item C<< new ( triples => \@triples ) >>

Returns a new memory-backed storage object.

=cut

	has triples => (is => 'rw', isa => ArrayRef[ConsumerOf['Attean::API::Triple']], default => sub { [] });

=item C<< get_triples ( $subject, $predicate, $object ) >>

Returns a stream object of all statements matching the specified subject,
predicate and objects. Any of the arguments may be undef to match any value.

=cut

	sub get_triples {
		my $self	= shift;
		my @nodes	= @_;
		my %bound;
		foreach my $pos (0 .. 2) {
			my $n	= $nodes[ $pos ];
			if (blessed($n) and $n->does('Attean::API::Variable')) {
				$n	= undef;
				$nodes[$pos]	= undef;
			}
			if (blessed($n)) {
				$bound{ $pos_names[$pos] }	= $n;
			}
		}
		
		my $triples	= $self->triples;
		my $iter	= Attean::ListIterator->new( values => $triples, item_type => 'Attean::API::Triple' );
		return $iter->grep(sub {
			my $q	= shift;
			foreach my $key (keys %bound) {
				my $term	= $q->$key();
				unless ($term->equals( $bound{$key} )) {
					return 0;
				}
			}
			return 1;
		});
		return $iter;
	}
	
=item C<< add_triple( $t ) >>

=cut

	sub add_triple {
		my $self	= shift;
		my $t		= shift;
		push(@{ $self->triples }, $t);
	}
	
=item C<< remove_triple( $t ) >>

=cut

	sub remove_triple {
		my $self	= shift;
		my $t		= shift;
		my @remove;
		my $triples	= $self->triples;
		foreach my $i (0 .. $#{ $triples }) {
			my $u	= $triples->[$i];
			if ($u->as_string eq $t->as_string) {
				push(@remove, $i);
			}
		}
		while (scalar(@remove)) {
			my $i	= pop(@remove);
			splice(@$triples, $i, 1, ());
		}
	}
}

1;

__END__

=back

=head1 BUGS

Please report any bugs or feature requests to through the GitHub web interface
at L<https://github.com/kasei/perlrdf2/issues>.

=head1 AUTHOR

Gregory Todd Williams  C<< <gwilliams@cpan.org> >>

=head1 COPYRIGHT

Copyright (c) 2014--2016 Gregory Todd Williams. This
program is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.

=cut