/usr/share/perl5/AtteanX/Plan/SPARQLBGP.pm is in libatteanx-store-sparql-perl 0.010-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 | =head1 NAME
AtteanX::Plan::SPARQLBGP - Plan for efficient evaluation of SPARQL BGPs on remote endpoints
=head1 SYNOPSIS
This is typically only constructed by planning hacks deep in the code,
but might look like:
use v5.14;
use AtteanX::Plan::SPARQLBGP;
my $new_bgp_plan = AtteanX::Plan::SPARQLBGP->new(children => [$some_quads],
distinct => 0,
ordered => []);
=head1 DESCRIPTION
This plan class implements compiling basic graph patterns that can be
joined remotely on a SPARQL endpoint.
=head2 Attributes and methods
Consumes L<Attean::API::QueryTree>, L<Attean::API::Plan> and
L<Attean::API::UnionScopeVariablesPlan>, and introduces nothing
new. The most notable attribute is:
=over
=item C<< children >>
which takes an arrayref of L<Attean::Plan::Quad> objects to be
included in the Basic Graph pattern that will be evaluated against the
model.
=back
=head1 OTHER DETAILS
For author, copyright and other details, see L<AtteanX::Store::SPARQL>.
=cut
package AtteanX::Plan::SPARQLBGP;
use v5.14;
use warnings;
our $AUTHORITY = 'cpan:KJETILK';
our $VERSION = '0.010';
use Moo;
use Scalar::Util qw(blessed);
with 'Attean::API::QueryTree',
'Attean::API::Plan',
'Attean::API::UnionScopeVariablesPlan',
'MooX::Log::Any';
sub plan_as_string {
my $self = shift;
return 'SPARQLBGP';
}
sub impl {
my $self = shift;
my $model = shift;
my $sparql = 'SELECT * WHERE {';
foreach my $child (@{$self->children}) {
my @terms = $child->values;
my $pattern = Attean::TriplePattern->new(@terms[0..2]);
$sparql .= "\n " . $pattern->as_sparql . ' . ';
}
$sparql .= "\n}\n";
$self->log->debug("Using query:\n$sparql");
return sub {
return $model->get_sparql($sparql)
}
}
1;
|