| line | stmt | bran | cond | sub | pod | time | code | 
| 1 | 50 |  |  | 50 |  | 562 | use v5.14; | 
|  | 50 |  |  |  |  | 178 |  | 
| 2 | 50 |  |  | 50 |  | 254 | use warnings; | 
|  | 50 |  |  |  |  | 101 |  | 
|  | 50 |  |  |  |  | 1138 |  | 
| 3 | 50 |  |  | 50 |  | 267 | use utf8; | 
|  | 50 |  |  |  |  | 122 |  | 
|  | 50 |  |  |  |  | 459 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | =head1 NAME | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | Attean::Algebra - Representation of SPARQL algebra operators | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | =head1 VERSION | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | This document describes Attean::Algebra version 0.032 | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | use v5.14; | 
| 16 |  |  |  |  |  |  | use Attean; | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | This is a utility package that defines all the Attean query algebra classes | 
| 21 |  |  |  |  |  |  | in the Attean::Algebra namespace: | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | =over 4 | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | =cut | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 50 |  |  | 50 |  | 1526 | use Attean::API::Query; | 
|  | 50 |  |  |  |  | 113 |  | 
|  | 50 |  |  |  |  | 2261 |  | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 30 | 50 |  |  | 50 |  | 372 | use AtteanX::SPARQL::Token; | 
|  | 50 |  |  |  |  | 132 |  | 
|  | 50 |  |  |  |  | 8613 |  | 
| 31 | 50 |  |  | 50 |  | 361 | use Types::Standard qw(Bool ArrayRef HashRef ConsumerOf); | 
|  | 50 |  |  |  |  | 157 |  | 
|  | 50 |  |  |  |  | 1424 |  | 
| 32 | 50 |  |  | 50 |  | 283 | use Moo; | 
|  | 50 |  |  |  |  | 108 |  | 
|  | 50 |  |  |  |  | 428 |  | 
| 33 | 50 |  |  | 50 |  | 37586 | use namespace::clean; | 
|  | 50 |  |  |  |  | 117 |  | 
|  | 50 |  |  |  |  | 273 |  | 
| 34 | 50 |  |  | 50 |  | 16601 |  | 
|  | 50 |  |  |  |  | 130 |  | 
|  | 50 |  |  |  |  | 352 |  | 
| 35 |  |  |  |  |  |  | has 'dataset' => (is => 'ro', isa => HashRef[ArrayRef[ConsumerOf['Attean::API::Term']]], default => sub { +{} }); | 
| 36 |  |  |  |  |  |  | has 'subquery' => (is => 'ro', isa => Bool, default => 0); | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | my $self	= shift; | 
| 41 |  |  |  |  |  |  | my $name	= $self->subquery ? 'SubQuery' : 'Query'; | 
| 42 | 9 |  |  | 9 | 0 | 31 |  | 
| 43 | 9 | 50 |  |  |  | 51 | my %dataset	= %{ $self->dataset }; | 
| 44 |  |  |  |  |  |  | my @default	= @{ $dataset{ default } || [] }; | 
| 45 | 9 |  |  |  |  | 20 | my @named	= @{ $dataset{ named } || [] }; | 
|  | 9 |  |  |  |  | 47 |  | 
| 46 | 9 | 50 |  |  |  | 22 | my $has_dataset	= (scalar(@default) + scalar(@named)); | 
|  | 9 |  |  |  |  | 59 |  | 
| 47 | 9 | 50 |  |  |  | 22 |  | 
|  | 9 |  |  |  |  | 41 |  | 
| 48 | 9 |  |  |  |  | 26 | my $s	= $name; | 
| 49 |  |  |  |  |  |  | if ($has_dataset) { | 
| 50 | 9 |  |  |  |  | 16 | my @parts; | 
| 51 | 9 | 50 |  |  |  | 25 | if (scalar(@default)) { | 
| 52 | 0 |  |  |  |  | 0 | push(@parts, 'Default graph(s): ' . join(', ', map { chomp; $_ } map { $_->as_sparql } @default)); | 
| 53 | 0 | 0 |  |  |  | 0 | } | 
| 54 | 0 |  |  |  |  | 0 | if (scalar(@named)) { | 
|  | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 55 |  |  |  |  |  |  | push(@parts, 'Named graph(s): ' . join(', ', map { chomp; $_ } map { $_->as_sparql } @named)); | 
| 56 | 0 | 0 |  |  |  | 0 | } | 
| 57 | 0 |  |  |  |  | 0 | $s	.= ' { ' . join('; ', @parts) . ' }'; | 
|  | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 58 |  |  |  |  |  |  | } | 
| 59 | 0 |  |  |  |  | 0 | return $s; | 
| 60 |  |  |  |  |  |  | } | 
| 61 | 9 |  |  |  |  | 37 |  | 
| 62 |  |  |  |  |  |  | my $self	= shift; | 
| 63 |  |  |  |  |  |  | my $child	= $self->child; | 
| 64 |  |  |  |  |  |  | my $l		= AtteanX::SPARQL::Token->lbrace; | 
| 65 | 8 |  |  | 8 | 0 | 192 | my $r		= AtteanX::SPARQL::Token->rbrace; | 
| 66 | 8 |  |  |  |  | 49 | my $from		= AtteanX::SPARQL::Token->keyword('FROM'); | 
| 67 | 8 |  |  |  |  | 61 | my $named		= AtteanX::SPARQL::Token->keyword('NAMED'); | 
| 68 | 8 |  |  |  |  | 530 |  | 
| 69 | 8 |  |  |  |  | 354 | my %dataset	= %{ $self->dataset }; | 
| 70 | 8 |  |  |  |  | 322 | my @default	= @{ $dataset{ default } || [] }; | 
| 71 |  |  |  |  |  |  | my @named	= @{ $dataset{ named } || [] }; | 
| 72 | 8 |  |  |  |  | 312 | my $has_dataset	= (scalar(@default) + scalar(@named)); | 
|  | 8 |  |  |  |  | 63 |  | 
| 73 | 8 | 100 |  |  |  | 26 | if ($child->does('Attean::API::SPARQLQuerySerializable')) { | 
|  | 8 |  |  |  |  | 55 |  | 
| 74 | 8 | 100 |  |  |  | 17 | if ($self->subquery) { | 
|  | 8 |  |  |  |  | 43 |  | 
| 75 | 8 |  |  |  |  | 24 | my @tokens; | 
| 76 | 8 | 100 |  |  |  | 47 | push(@tokens, $l); | 
| 77 | 7 | 50 |  |  |  | 156 | push(@tokens, $child->sparql_tokens->elements); | 
| 78 | 0 |  |  |  |  | 0 | push(@tokens, $r); | 
| 79 | 0 |  |  |  |  | 0 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 80 | 0 |  |  |  |  | 0 | } else { | 
| 81 | 0 |  |  |  |  | 0 | my %args; | 
| 82 | 0 |  |  |  |  | 0 | if ($has_dataset) { | 
| 83 |  |  |  |  |  |  | $args{dataset}	= $self->dataset; | 
| 84 | 7 |  |  |  |  | 22 | } | 
| 85 | 7 | 100 |  |  |  | 28 | return $child->query_tokens(%args); | 
| 86 | 4 |  |  |  |  | 16 | } | 
| 87 |  |  |  |  |  |  | } else { | 
| 88 | 7 |  |  |  |  | 39 | my $sel		= AtteanX::SPARQL::Token->keyword('SELECT'); | 
| 89 |  |  |  |  |  |  | my $star	= AtteanX::SPARQL::Token->star; | 
| 90 |  |  |  |  |  |  | my $where	= AtteanX::SPARQL::Token->keyword('WHERE'); | 
| 91 | 1 |  |  |  |  | 32 |  | 
| 92 | 1 |  |  |  |  | 47 | my @tokens; | 
| 93 | 1 |  |  |  |  | 43 | if ($self->subquery) { | 
| 94 |  |  |  |  |  |  | push(@tokens, $l); | 
| 95 | 1 |  |  |  |  | 38 | } | 
| 96 | 1 | 50 |  |  |  | 7 | push(@tokens, $sel, $star); | 
| 97 | 0 |  |  |  |  | 0 | if ($has_dataset) { | 
| 98 |  |  |  |  |  |  | foreach my $i (sort { $a->as_string cmp $b->as_string } @default) { | 
| 99 | 1 |  |  |  |  | 3 | push(@tokens, $from); | 
| 100 | 1 | 50 |  |  |  | 4 | push(@tokens, $i->sparql_tokens->elements); | 
| 101 | 0 |  |  |  |  | 0 | } | 
|  | 0 |  |  |  |  | 0 |  | 
| 102 | 0 |  |  |  |  | 0 | foreach my $i (sort { $a->as_string cmp $b->as_string } @named) { | 
| 103 | 0 |  |  |  |  | 0 | push(@tokens, $from); | 
| 104 |  |  |  |  |  |  | push(@tokens, $named); | 
| 105 | 0 |  |  |  |  | 0 | push(@tokens, $i->sparql_tokens->elements); | 
|  | 0 |  |  |  |  | 0 |  | 
| 106 | 0 |  |  |  |  | 0 | } | 
| 107 | 0 |  |  |  |  | 0 | } | 
| 108 | 0 |  |  |  |  | 0 | push(@tokens, $where); | 
| 109 |  |  |  |  |  |  | push(@tokens, $l); | 
| 110 |  |  |  |  |  |  | push(@tokens, $child->sparql_tokens->elements); | 
| 111 | 1 |  |  |  |  | 4 | push(@tokens, $r); | 
| 112 | 1 |  |  |  |  | 2 | if ($self->subquery) { | 
| 113 | 1 |  |  |  |  | 7 | push(@tokens, $r); | 
| 114 | 1 |  |  |  |  | 4 | } | 
| 115 | 1 | 50 |  |  |  | 10 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 116 | 0 |  |  |  |  | 0 | } | 
| 117 |  |  |  |  |  |  | } | 
| 118 | 1 |  |  |  |  | 19 | } | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 121 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 122 |  |  |  |  |  |  | use Types::Standard qw(Bool); | 
| 123 |  |  |  |  |  |  | use Moo; | 
| 124 | 50 |  |  | 50 |  | 170231 | use namespace::clean; | 
|  | 50 |  |  |  |  | 114 |  | 
|  | 50 |  |  |  |  | 6801 |  | 
| 125 | 50 |  |  | 50 |  | 303 |  | 
|  | 50 |  |  |  |  | 106 |  | 
|  | 50 |  |  |  |  | 985 |  | 
| 126 | 50 |  |  | 50 |  | 244 | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | 
|  | 50 |  |  |  |  | 107 |  | 
|  | 50 |  |  |  |  | 281 |  | 
| 127 | 50 |  |  | 50 |  | 21983 |  | 
|  | 50 |  |  |  |  | 133 |  | 
|  | 50 |  |  |  |  | 252 |  | 
| 128 | 50 |  |  | 50 |  | 16078 |  | 
|  | 50 |  |  |  |  | 158 |  | 
|  | 50 |  |  |  |  | 252 |  | 
| 129 |  |  |  |  |  |  | my $self	= shift; | 
| 130 |  |  |  |  |  |  | my $child	= $self->child; | 
| 131 |  |  |  |  |  |  | return $child->sparql_tokens; | 
| 132 | 3 |  |  | 3 | 0 | 16 | } | 
| 133 |  |  |  |  |  |  | } | 
| 134 |  |  |  |  |  |  |  | 
| 135 | 6 |  |  | 6 | 0 | 24 | =item * L<Attean::Algebra::Sequence> | 
| 136 | 6 |  |  |  |  | 42 |  | 
| 137 | 6 |  |  |  |  | 36 | =cut | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 140 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 141 |  |  |  |  |  |  | use Moo; | 
| 142 |  |  |  |  |  |  | use namespace::clean; | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::QueryTree'; | 
| 145 |  |  |  |  |  |  |  | 
| 146 | 50 |  |  | 50 |  | 132117 | my $self	= shift; | 
|  | 50 |  |  |  |  | 121 |  | 
|  | 50 |  |  |  |  | 6600 |  | 
| 147 | 50 |  |  | 50 |  | 296 | return scalar(@{ $self->children }); | 
|  | 50 |  |  |  |  | 111 |  | 
|  | 50 |  |  |  |  | 1023 |  | 
| 148 | 50 |  |  | 50 |  | 302 | } | 
|  | 50 |  |  |  |  | 119 |  | 
|  | 50 |  |  |  |  | 321 |  | 
| 149 | 50 |  |  | 50 |  | 15366 |  | 
|  | 50 |  |  |  |  | 112 |  | 
|  | 50 |  |  |  |  | 231 |  | 
| 150 |  |  |  |  |  |  |  | 
| 151 |  |  |  |  |  |  | my $self	= shift; | 
| 152 |  |  |  |  |  |  | my $semi	= AtteanX::SPARQL::Token->semicolon; | 
| 153 |  |  |  |  |  |  |  | 
| 154 | 0 |  |  | 0 | 0 | 0 | my @tokens; | 
| 155 | 0 |  |  |  |  | 0 | foreach my $t (@{ $self->children }) { | 
|  | 0 |  |  |  |  | 0 |  | 
| 156 |  |  |  |  |  |  | push(@tokens, $t->sparql_tokens->elements); | 
| 157 |  |  |  |  |  |  | push(@tokens, $semi); | 
| 158 | 1 |  |  | 1 | 0 | 5 | } | 
| 159 |  |  |  |  |  |  | pop(@tokens); # remove last SEMICOLON token | 
| 160 |  |  |  |  |  |  | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 161 | 1 |  |  | 1 | 0 | 3 | } | 
| 162 | 1 |  |  |  |  | 6 | } | 
| 163 |  |  |  |  |  |  |  | 
| 164 | 1 |  |  |  |  | 55 | =item * L<Attean::Algebra::Join> | 
| 165 | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 166 | 2 |  |  |  |  | 9 | =cut | 
| 167 | 2 |  |  |  |  | 9 |  | 
| 168 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 169 | 1 |  |  |  |  | 4 | use AtteanX::SPARQL::Token; | 
| 170 | 1 |  |  |  |  | 21 | use Moo; | 
| 171 |  |  |  |  |  |  | use namespace::clean; | 
| 172 |  |  |  |  |  |  |  | 
| 173 |  |  |  |  |  |  | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::QueryTree'; | 
| 174 |  |  |  |  |  |  |  | 
| 175 |  |  |  |  |  |  |  | 
| 176 |  |  |  |  |  |  | my $self	= shift; | 
| 177 |  |  |  |  |  |  | my $l	= AtteanX::SPARQL::Token->lbrace; | 
| 178 |  |  |  |  |  |  | my $r	= AtteanX::SPARQL::Token->rbrace; | 
| 179 | 50 |  |  | 50 |  | 136641 |  | 
|  | 50 |  |  |  |  | 125 |  | 
|  | 50 |  |  |  |  | 6566 |  | 
| 180 | 50 |  |  | 50 |  | 344 | my @tokens; | 
|  | 50 |  |  |  |  | 109 |  | 
|  | 50 |  |  |  |  | 814 |  | 
| 181 | 50 |  |  | 50 |  | 212 | push(@tokens, $l); | 
|  | 50 |  |  |  |  | 105 |  | 
|  | 50 |  |  |  |  | 234 |  | 
| 182 | 50 |  |  | 50 |  | 15833 | foreach my $t (@{ $self->children }) { | 
|  | 50 |  |  |  |  | 123 |  | 
|  | 50 |  |  |  |  | 242 |  | 
| 183 |  |  |  |  |  |  | push(@tokens, $t->sparql_subtokens->elements); | 
| 184 |  |  |  |  |  |  | } | 
| 185 |  |  |  |  |  |  | push(@tokens, $r); | 
| 186 | 2 |  |  | 2 | 0 | 8 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 187 |  |  |  |  |  |  | } | 
| 188 |  |  |  |  |  |  | } | 
| 189 | 5 |  |  | 5 | 0 | 20 |  | 
| 190 | 5 |  |  |  |  | 25 | =item * L<Attean::Algebra::LeftJoin> | 
| 191 | 5 |  |  |  |  | 289 |  | 
| 192 |  |  |  |  |  |  | =cut | 
| 193 | 5 |  |  |  |  | 200 |  | 
| 194 | 5 |  |  |  |  | 10 | use AtteanX::SPARQL::Constants; | 
| 195 | 5 |  |  |  |  | 8 | use AtteanX::SPARQL::Token; | 
|  | 5 |  |  |  |  | 20 |  | 
| 196 | 8 |  |  |  |  | 37 | use Moo; | 
| 197 |  |  |  |  |  |  | use Types::Standard qw(ConsumerOf); | 
| 198 | 5 |  |  |  |  | 12 | use namespace::clean; | 
| 199 | 5 |  |  |  |  | 75 |  | 
| 200 |  |  |  |  |  |  | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::BinaryQueryTree'; | 
| 201 |  |  |  |  |  |  |  | 
| 202 |  |  |  |  |  |  | has 'expression' => (is => 'ro', isa => ConsumerOf['Attean::API::Expression'], required => 1, default => sub { Attean::ValueExpression->new( value => Attean::Literal->true ) }); | 
| 203 |  |  |  |  |  |  | my $self	= shift; | 
| 204 |  |  |  |  |  |  | return sprintf('LeftJoin { %s }', $self->expression->as_string); | 
| 205 |  |  |  |  |  |  | } | 
| 206 |  |  |  |  |  |  | my $self	= shift; | 
| 207 |  |  |  |  |  |  | my $opt	= AtteanX::SPARQL::Token->keyword('OPTIONAL'); | 
| 208 | 50 |  |  | 50 |  | 133725 | my $l	= AtteanX::SPARQL::Token->lbrace; | 
|  | 50 |  |  |  |  | 150 |  | 
|  | 50 |  |  |  |  | 6427 |  | 
| 209 | 50 |  |  | 50 |  | 321 | my $r	= AtteanX::SPARQL::Token->rbrace; | 
|  | 50 |  |  |  |  | 107 |  | 
|  | 50 |  |  |  |  | 829 |  | 
| 210 | 50 |  |  | 50 |  | 251 | my ($lhs, $rhs)	= @{ $self->children }; | 
|  | 50 |  |  |  |  | 113 |  | 
|  | 50 |  |  |  |  | 242 |  | 
| 211 | 50 |  |  | 50 |  | 16271 |  | 
|  | 50 |  |  |  |  | 112 |  | 
|  | 50 |  |  |  |  | 301 |  | 
| 212 | 50 |  |  | 50 |  | 22067 | my @tokens; | 
|  | 50 |  |  |  |  | 124 |  | 
|  | 50 |  |  |  |  | 238 |  | 
| 213 |  |  |  |  |  |  | push(@tokens, $l); | 
| 214 |  |  |  |  |  |  | push(@tokens, $lhs->sparql_subtokens->elements); | 
| 215 |  |  |  |  |  |  | push(@tokens, $r, $opt, $l); | 
| 216 |  |  |  |  |  |  | push(@tokens, $rhs->sparql_subtokens->elements); | 
| 217 |  |  |  |  |  |  |  | 
| 218 | 0 |  |  | 0 | 0 | 0 | my $expr	= $self->expression; | 
| 219 | 0 |  |  |  |  | 0 | my $is_true	= 0; | 
| 220 |  |  |  |  |  |  | if ($expr->isa('Attean::ValueExpression')) { | 
| 221 | 0 |  |  | 0 | 0 | 0 | my $value	= $expr->value; | 
| 222 |  |  |  |  |  |  | if ($value->equals(Attean::Literal->true)) { | 
| 223 | 4 |  |  | 4 | 0 | 16 | $is_true	= 1; | 
| 224 | 4 |  |  |  |  | 24 | } | 
| 225 | 4 |  |  |  |  | 229 | } | 
| 226 | 4 |  |  |  |  | 165 |  | 
| 227 | 4 |  |  |  |  | 155 | unless ($is_true) { | 
|  | 4 |  |  |  |  | 19 |  | 
| 228 |  |  |  |  |  |  | my $f		= AtteanX::SPARQL::Token->keyword('FILTER'); | 
| 229 | 4 |  |  |  |  | 11 | my $lparen	= AtteanX::SPARQL::Token->lparen; | 
| 230 | 4 |  |  |  |  | 12 | my $rparen	= AtteanX::SPARQL::Token->rparen; | 
| 231 | 4 |  |  |  |  | 20 | push(@tokens, $f); | 
| 232 | 4 |  |  |  |  | 17 | push(@tokens, $lparen); | 
| 233 | 4 |  |  |  |  | 14 | push(@tokens, $expr->sparql_tokens->elements); | 
| 234 |  |  |  |  |  |  | push(@tokens, $rparen); | 
| 235 | 4 |  |  |  |  | 19 | } | 
| 236 | 4 |  |  |  |  | 8 |  | 
| 237 | 4 | 100 |  |  |  | 35 | push(@tokens, $r); | 
| 238 | 2 |  |  |  |  | 7 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 239 | 2 | 50 |  |  |  | 7 | } | 
| 240 | 2 |  |  |  |  | 18 |  | 
| 241 |  |  |  |  |  |  | } | 
| 242 |  |  |  |  |  |  |  | 
| 243 |  |  |  |  |  |  | =item * L<Attean::Algebra::Filter> | 
| 244 | 4 | 100 |  |  |  | 11 |  | 
| 245 | 2 |  |  |  |  | 9 | =cut | 
| 246 | 2 |  |  |  |  | 91 |  | 
| 247 | 2 |  |  |  |  | 86 | use AtteanX::SPARQL::Constants; | 
| 248 | 2 |  |  |  |  | 80 | use AtteanX::SPARQL::Token; | 
| 249 | 2 |  |  |  |  | 4 | use Moo; | 
| 250 | 2 |  |  |  |  | 8 | use Types::Standard qw(ConsumerOf); | 
| 251 | 2 |  |  |  |  | 7 | use namespace::clean; | 
| 252 |  |  |  |  |  |  |  | 
| 253 |  |  |  |  |  |  | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | 
| 254 | 4 |  |  |  |  | 19 |  | 
| 255 | 4 |  |  |  |  | 62 | has 'expression' => (is => 'ro', isa => ConsumerOf['Attean::API::Expression'], required => 1); | 
| 256 |  |  |  |  |  |  | my $self	= shift; | 
| 257 |  |  |  |  |  |  | return sprintf('Filter { %s }', $self->expression->as_string); | 
| 258 |  |  |  |  |  |  | } | 
| 259 |  |  |  |  |  |  | my $self	= shift; | 
| 260 |  |  |  |  |  |  | my $f		= AtteanX::SPARQL::Token->keyword('FILTER'); | 
| 261 |  |  |  |  |  |  | my $l		= AtteanX::SPARQL::Token->lparen; | 
| 262 |  |  |  |  |  |  | my $r		= AtteanX::SPARQL::Token->rparen; | 
| 263 |  |  |  |  |  |  | my ($child)	= @{ $self->children }; | 
| 264 |  |  |  |  |  |  | my $expr	= $self->expression; | 
| 265 | 50 |  |  | 50 |  | 146093 | my @tokens; | 
|  | 50 |  |  |  |  | 118 |  | 
|  | 50 |  |  |  |  | 6609 |  | 
| 266 | 50 |  |  | 50 |  | 303 | push(@tokens, $child->sparql_tokens->elements); | 
|  | 50 |  |  |  |  | 120 |  | 
|  | 50 |  |  |  |  | 815 |  | 
| 267 | 50 |  |  | 50 |  | 229 | push(@tokens, $f); | 
|  | 50 |  |  |  |  | 106 |  | 
|  | 50 |  |  |  |  | 246 |  | 
| 268 | 50 |  |  | 50 |  | 16307 | push(@tokens, $l); | 
|  | 50 |  |  |  |  | 115 |  | 
|  | 50 |  |  |  |  | 303 |  | 
| 269 | 50 |  |  | 50 |  | 21981 | push(@tokens, $expr->sparql_tokens->elements); | 
|  | 50 |  |  |  |  | 118 |  | 
|  | 50 |  |  |  |  | 241 |  | 
| 270 |  |  |  |  |  |  | push(@tokens, $r); | 
| 271 |  |  |  |  |  |  | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 272 |  |  |  |  |  |  | } | 
| 273 |  |  |  |  |  |  | } | 
| 274 |  |  |  |  |  |  |  | 
| 275 | 2 |  |  | 2 | 0 | 12 | =item * L<Attean::Algebra::Union> | 
| 276 | 2 |  |  |  |  | 20 |  | 
| 277 |  |  |  |  |  |  | =cut | 
| 278 | 0 |  |  | 0 | 0 | 0 |  | 
| 279 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 280 | 4 |  |  | 4 | 0 | 37 | use AtteanX::SPARQL::Token; | 
| 281 | 4 |  |  |  |  | 44 | use Moo; | 
| 282 | 4 |  |  |  |  | 346 | use Types::Standard qw(ConsumerOf); | 
| 283 | 4 |  |  |  |  | 185 | use namespace::clean; | 
| 284 | 4 |  |  |  |  | 229 |  | 
|  | 4 |  |  |  |  | 30 |  | 
| 285 | 4 |  |  |  |  | 18 | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::BinaryQueryTree'; | 
| 286 | 4 |  |  |  |  | 9 |  | 
| 287 | 4 |  |  |  |  | 28 | my $self	= shift; | 
| 288 | 4 |  |  |  |  | 24 | my $union	= AtteanX::SPARQL::Token->keyword('UNION'); | 
| 289 | 4 |  |  |  |  | 12 | my $l		= AtteanX::SPARQL::Token->lbrace; | 
| 290 | 4 |  |  |  |  | 48 | my $r		= AtteanX::SPARQL::Token->rbrace; | 
| 291 | 4 |  |  |  |  | 20 | my ($lhs, $rhs)	= @{ $self->children }; | 
| 292 | 4 |  |  |  |  | 72 |  | 
| 293 |  |  |  |  |  |  | my @tokens; | 
| 294 |  |  |  |  |  |  | push(@tokens, $l); | 
| 295 |  |  |  |  |  |  | push(@tokens, $lhs->sparql_subtokens->elements); | 
| 296 |  |  |  |  |  |  | push(@tokens, $r, $union, $l); | 
| 297 |  |  |  |  |  |  | push(@tokens, $rhs->sparql_subtokens->elements); | 
| 298 |  |  |  |  |  |  | push(@tokens, $r); | 
| 299 |  |  |  |  |  |  | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 300 |  |  |  |  |  |  | } | 
| 301 | 50 |  |  | 50 |  | 140080 | } | 
|  | 50 |  |  |  |  | 119 |  | 
|  | 50 |  |  |  |  | 6650 |  | 
| 302 | 50 |  |  | 50 |  | 320 |  | 
|  | 50 |  |  |  |  | 107 |  | 
|  | 50 |  |  |  |  | 818 |  | 
| 303 | 50 |  |  | 50 |  | 221 | =item * L<Attean::Algebra::Graph> | 
|  | 50 |  |  |  |  | 95 |  | 
|  | 50 |  |  |  |  | 244 |  | 
| 304 | 50 |  |  | 50 |  | 17572 |  | 
|  | 50 |  |  |  |  | 10462 |  | 
|  | 50 |  |  |  |  | 378 |  | 
| 305 | 50 |  |  | 50 |  | 22312 | =cut | 
|  | 50 |  |  |  |  | 113 |  | 
|  | 50 |  |  |  |  | 249 |  | 
| 306 |  |  |  |  |  |  |  | 
| 307 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 308 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 309 | 1 |  |  | 1 | 0 | 4 | use Moo; | 
| 310 |  |  |  |  |  |  | use Types::Standard qw(ConsumerOf); | 
| 311 | 2 |  |  | 2 | 0 | 13 | use namespace::clean; | 
| 312 | 2 |  |  |  |  | 27 |  | 
| 313 | 2 |  |  |  |  | 188 | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | 
| 314 | 2 |  |  |  |  | 93 |  | 
| 315 | 2 |  |  |  |  | 83 | has 'graph' => (is => 'ro', isa => ConsumerOf['Attean::API::TermOrVariable'], required => 1); | 
|  | 2 |  |  |  |  | 18 |  | 
| 316 |  |  |  |  |  |  |  | 
| 317 | 2 |  |  |  |  | 4 | my $self	= shift; | 
| 318 | 2 |  |  |  |  | 6 | my $graph	= $self->graph; | 
| 319 | 2 |  |  |  |  | 15 | my ($child)	= @{ $self->children }; | 
| 320 | 2 |  |  |  |  | 12 | my @vars	= $child->in_scope_variables; | 
| 321 | 2 |  |  |  |  | 18 | if ($graph->does('Attean::API::Variable')) { | 
| 322 | 2 |  |  |  |  | 10 | return Set::Scalar->new(@vars, $graph->value)->elements; | 
| 323 | 2 |  |  |  |  | 35 | } else { | 
| 324 |  |  |  |  |  |  | return @vars; | 
| 325 |  |  |  |  |  |  | } | 
| 326 |  |  |  |  |  |  | } | 
| 327 |  |  |  |  |  |  | my $self	= shift; | 
| 328 |  |  |  |  |  |  | return sprintf('Graph %s', $self->graph->as_string); | 
| 329 |  |  |  |  |  |  | } | 
| 330 |  |  |  |  |  |  | my $self	= shift; | 
| 331 |  |  |  |  |  |  | my $graph	= AtteanX::SPARQL::Token->keyword('GRAPH'); | 
| 332 | 50 |  |  | 50 |  | 139066 | my $l		= AtteanX::SPARQL::Token->lbrace; | 
|  | 50 |  |  |  |  | 939 |  | 
|  | 50 |  |  |  |  | 6671 |  | 
| 333 | 50 |  |  | 50 |  | 305 | my $r		= AtteanX::SPARQL::Token->rbrace; | 
|  | 50 |  |  |  |  | 107 |  | 
|  | 50 |  |  |  |  | 763 |  | 
| 334 | 50 |  |  | 50 |  | 212 | my ($child)	= @{ $self->children }; | 
|  | 50 |  |  |  |  | 112 |  | 
|  | 50 |  |  |  |  | 424 |  | 
| 335 | 50 |  |  | 50 |  | 24472 |  | 
|  | 50 |  |  |  |  | 260 |  | 
|  | 50 |  |  |  |  | 342 |  | 
| 336 | 50 |  |  | 50 |  | 21269 | my @tokens; | 
|  | 50 |  |  |  |  | 106 |  | 
|  | 50 |  |  |  |  | 465 |  | 
| 337 |  |  |  |  |  |  | push(@tokens, $graph); | 
| 338 |  |  |  |  |  |  | push(@tokens, $self->graph->sparql_tokens->elements); | 
| 339 |  |  |  |  |  |  | push(@tokens, $l); | 
| 340 |  |  |  |  |  |  | push(@tokens, $child->sparql_subtokens->elements); | 
| 341 |  |  |  |  |  |  | push(@tokens, $r); | 
| 342 |  |  |  |  |  |  | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 343 | 6 |  |  | 6 | 0 | 13 | } | 
| 344 | 6 |  |  |  |  | 19 | } | 
| 345 | 6 |  |  |  |  | 10 |  | 
|  | 6 |  |  |  |  | 20 |  | 
| 346 | 6 |  |  |  |  | 17 | =item * L<Attean::Algebra::Extend> | 
| 347 | 6 | 100 |  |  |  | 257 |  | 
| 348 | 2 |  |  |  |  | 36 | =cut | 
| 349 |  |  |  |  |  |  |  | 
| 350 | 4 |  |  |  |  | 88 | use AtteanX::SPARQL::Constants; | 
| 351 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 352 |  |  |  |  |  |  | use Moo; | 
| 353 |  |  |  |  |  |  | use Types::Standard qw(ConsumerOf); | 
| 354 | 1 |  |  | 1 | 0 | 4 | use namespace::clean; | 
| 355 | 1 |  |  |  |  | 11 |  | 
| 356 |  |  |  |  |  |  | my $self	= shift; | 
| 357 | 0 |  |  | 0 | 0 | 0 | my ($child)	= @{ $self->children }; | 
| 358 |  |  |  |  |  |  | my @vars	= $child->in_scope_variables; | 
| 359 | 2 |  |  | 2 | 0 | 13 | return Set::Scalar->new(@vars, $self->variable->value)->elements; | 
| 360 | 2 |  |  |  |  | 24 | } | 
| 361 | 2 |  |  |  |  | 175 | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | 
| 362 | 2 |  |  |  |  | 89 |  | 
| 363 | 2 |  |  |  |  | 82 | has 'variable' => (is => 'ro', isa => ConsumerOf['Attean::API::Variable'], required => 1); | 
|  | 2 |  |  |  |  | 16 |  | 
| 364 |  |  |  |  |  |  | has 'expression' => (is => 'ro', isa => ConsumerOf['Attean::API::Expression'], required => 1); | 
| 365 | 2 |  |  |  |  | 6 |  | 
| 366 | 2 |  |  |  |  | 6 | my $self	= shift; | 
| 367 | 2 |  |  |  |  | 23 | return sprintf('Extend { %s ← %s }', $self->variable->as_string, $self->expression->as_string); | 
| 368 | 2 |  |  |  |  | 7 | } | 
| 369 | 2 |  |  |  |  | 15 | my $self	= shift; | 
| 370 | 2 |  |  |  |  | 8 | my $bind	= AtteanX::SPARQL::Token->keyword('BIND'); | 
| 371 | 2 |  |  |  |  | 36 | my $as		= AtteanX::SPARQL::Token->keyword('AS'); | 
| 372 |  |  |  |  |  |  | my $l		= AtteanX::SPARQL::Token->lparen; | 
| 373 |  |  |  |  |  |  | my $r		= AtteanX::SPARQL::Token->rparen; | 
| 374 |  |  |  |  |  |  | my ($child)	= @{ $self->children }; | 
| 375 |  |  |  |  |  |  | my $var		= $self->variable; | 
| 376 |  |  |  |  |  |  | my $expr	= $self->expression; | 
| 377 |  |  |  |  |  |  |  | 
| 378 |  |  |  |  |  |  | my @tokens; | 
| 379 |  |  |  |  |  |  | push(@tokens, $child->sparql_tokens->elements); | 
| 380 | 50 |  |  | 50 |  | 141406 | push(@tokens, $bind); | 
|  | 50 |  |  |  |  | 110 |  | 
|  | 50 |  |  |  |  | 7025 |  | 
| 381 | 50 |  |  | 50 |  | 324 | push(@tokens, $l); | 
|  | 50 |  |  |  |  | 92 |  | 
|  | 50 |  |  |  |  | 866 |  | 
| 382 | 50 |  |  | 50 |  | 226 | push(@tokens, $expr->sparql_tokens->elements); | 
|  | 50 |  |  |  |  | 481 |  | 
|  | 50 |  |  |  |  | 285 |  | 
| 383 | 50 |  |  | 50 |  | 15850 | push(@tokens, $as); | 
|  | 50 |  |  |  |  | 100 |  | 
|  | 50 |  |  |  |  | 322 |  | 
| 384 | 50 |  |  | 50 |  | 21918 | push(@tokens, $var->sparql_tokens->elements); | 
|  | 50 |  |  |  |  | 115 |  | 
|  | 50 |  |  |  |  | 223 |  | 
| 385 |  |  |  |  |  |  | push(@tokens, $r); | 
| 386 |  |  |  |  |  |  | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 387 | 12 |  |  | 12 | 0 | 27 | } | 
| 388 | 12 |  |  |  |  | 25 | } | 
|  | 12 |  |  |  |  | 47 |  | 
| 389 | 12 |  |  |  |  | 46 |  | 
| 390 | 12 |  |  |  |  | 571 | =item * L<Attean::Algebra::Minus> | 
| 391 |  |  |  |  |  |  |  | 
| 392 |  |  |  |  |  |  | =cut | 
| 393 |  |  |  |  |  |  |  | 
| 394 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 395 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 396 |  |  |  |  |  |  | use Moo; | 
| 397 |  |  |  |  |  |  | use Types::Standard qw(ConsumerOf); | 
| 398 | 1 |  |  | 1 | 0 | 2 | use namespace::clean; | 
| 399 | 1 |  |  |  |  | 10 |  | 
| 400 |  |  |  |  |  |  | with 'Attean::API::Algebra', 'Attean::API::BinaryQueryTree'; | 
| 401 | 0 |  |  | 0 | 0 | 0 |  | 
| 402 |  |  |  |  |  |  | my $self	= shift; | 
| 403 | 2 |  |  | 2 | 0 | 1613 | my ($child)	= @{ $self->children }; | 
| 404 | 2 |  |  |  |  | 15 | return $child->in_scope_variables; | 
| 405 | 2 |  |  |  |  | 124 | } | 
| 406 | 2 |  |  |  |  | 88 |  | 
| 407 | 2 |  |  |  |  | 85 | my $self	= shift; | 
| 408 | 2 |  |  |  |  | 80 | my $minus	= AtteanX::SPARQL::Token->keyword('MINUS'); | 
|  | 2 |  |  |  |  | 13 |  | 
| 409 | 2 |  |  |  |  | 12 | my $l		= AtteanX::SPARQL::Token->lbrace; | 
| 410 | 2 |  |  |  |  | 11 | my $r		= AtteanX::SPARQL::Token->rbrace; | 
| 411 |  |  |  |  |  |  | my ($lhs, $rhs)	= @{ $self->children }; | 
| 412 | 2 |  |  |  |  | 6 |  | 
| 413 | 2 |  |  |  |  | 14 | my @tokens; | 
| 414 | 2 |  |  |  |  | 8 | push(@tokens, $l); | 
| 415 | 2 |  |  |  |  | 8 | push(@tokens, $lhs->sparql_subtokens->elements); | 
| 416 | 2 |  |  |  |  | 22 | push(@tokens, $r, $minus, $l); | 
| 417 | 2 |  |  |  |  | 7 | push(@tokens, $rhs->sparql_subtokens->elements); | 
| 418 | 2 |  |  |  |  | 12 | push(@tokens, $r); | 
| 419 | 2 |  |  |  |  | 8 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 420 | 2 |  |  |  |  | 33 | } | 
| 421 |  |  |  |  |  |  |  | 
| 422 |  |  |  |  |  |  | } | 
| 423 |  |  |  |  |  |  |  | 
| 424 |  |  |  |  |  |  | =item * L<Attean::Algebra::Distinct> | 
| 425 |  |  |  |  |  |  |  | 
| 426 |  |  |  |  |  |  | =cut | 
| 427 |  |  |  |  |  |  |  | 
| 428 |  |  |  |  |  |  | use Moo; | 
| 429 | 50 |  |  | 50 |  | 146130 | use namespace::clean; | 
|  | 50 |  |  |  |  | 108 |  | 
|  | 50 |  |  |  |  | 6754 |  | 
| 430 | 50 |  |  | 50 |  | 306 |  | 
|  | 50 |  |  |  |  | 87 |  | 
|  | 50 |  |  |  |  | 1205 |  | 
| 431 | 50 |  |  | 50 |  | 228 | with 'Attean::API::SPARQLQuerySerializable'; | 
|  | 50 |  |  |  |  | 90 |  | 
|  | 50 |  |  |  |  | 224 |  | 
| 432 | 50 |  |  | 50 |  | 15796 | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | 
|  | 50 |  |  |  |  | 137 |  | 
|  | 50 |  |  |  |  | 289 |  | 
| 433 | 50 |  |  | 50 |  | 22077 |  | 
|  | 50 |  |  |  |  | 119 |  | 
|  | 50 |  |  |  |  | 233 |  | 
| 434 |  |  |  |  |  |  | } | 
| 435 |  |  |  |  |  |  |  | 
| 436 |  |  |  |  |  |  | =item * L<Attean::Algebra::Reduced> | 
| 437 |  |  |  |  |  |  |  | 
| 438 | 2 |  |  | 2 | 0 | 5 | =cut | 
| 439 | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 12 |  | 
| 440 | 2 |  |  |  |  | 9 | use Moo; | 
| 441 |  |  |  |  |  |  | use namespace::clean; | 
| 442 |  |  |  |  |  |  |  | 
| 443 | 1 |  |  | 1 | 0 | 4 | with 'Attean::API::SPARQLQuerySerializable'; | 
| 444 |  |  |  |  |  |  | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | 
| 445 | 2 |  |  | 2 | 0 | 12 |  | 
| 446 | 2 |  |  |  |  | 13 | } | 
| 447 | 2 |  |  |  |  | 134 |  | 
| 448 | 2 |  |  |  |  | 85 | =item * L<Attean::Algebra::Slice> | 
| 449 | 2 |  |  |  |  | 78 |  | 
|  | 2 |  |  |  |  | 9 |  | 
| 450 |  |  |  |  |  |  | =cut | 
| 451 | 2 |  |  |  |  | 3 |  | 
| 452 | 2 |  |  |  |  | 5 | use Moo; | 
| 453 | 2 |  |  |  |  | 9 | use Types::Standard qw(Int); | 
| 454 | 2 |  |  |  |  | 7 | use namespace::clean; | 
| 455 | 2 |  |  |  |  | 8 |  | 
| 456 | 2 |  |  |  |  | 7 | with 'Attean::API::SPARQLQuerySerializable'; | 
| 457 | 2 |  |  |  |  | 30 | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | 
| 458 |  |  |  |  |  |  |  | 
| 459 |  |  |  |  |  |  | has 'limit' => (is => 'ro', isa => Int, default => -1); | 
| 460 |  |  |  |  |  |  | has 'offset' => (is => 'ro', isa => Int, default => 0); | 
| 461 |  |  |  |  |  |  | my $self	= shift; | 
| 462 |  |  |  |  |  |  | my @str	= ('Slice'); | 
| 463 |  |  |  |  |  |  | push(@str, "Limit=" . $self->limit) if ($self->limit >= 0); | 
| 464 |  |  |  |  |  |  | push(@str, "Offset=" . $self->offset) if ($self->offset > 0); | 
| 465 |  |  |  |  |  |  | return join(' ', @str); | 
| 466 |  |  |  |  |  |  | } | 
| 467 | 50 |  |  | 50 |  | 138554 | } | 
|  | 50 |  |  |  |  | 120 |  | 
|  | 50 |  |  |  |  | 237 |  | 
| 468 | 50 |  |  | 50 |  | 15343 |  | 
|  | 50 |  |  |  |  | 117 |  | 
|  | 50 |  |  |  |  | 244 |  | 
| 469 |  |  |  |  |  |  | =item * L<Attean::Algebra::Project> | 
| 470 |  |  |  |  |  |  |  | 
| 471 |  |  |  |  |  |  | =cut | 
| 472 |  |  |  |  |  |  |  | 
| 473 | 1 |  |  | 1 | 0 | 3 | use Types::Standard qw(ArrayRef ConsumerOf); | 
| 474 |  |  |  |  |  |  | use Moo; | 
| 475 |  |  |  |  |  |  | use namespace::clean; | 
| 476 |  |  |  |  |  |  |  | 
| 477 |  |  |  |  |  |  | with 'Attean::API::SPARQLQuerySerializable'; | 
| 478 |  |  |  |  |  |  | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | 
| 479 |  |  |  |  |  |  |  | 
| 480 |  |  |  |  |  |  | has 'variables' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::Variable']], required => 1); | 
| 481 | 50 |  |  | 50 |  | 23430 |  | 
|  | 50 |  |  |  |  | 101 |  | 
|  | 50 |  |  |  |  | 197 |  | 
| 482 | 50 |  |  | 50 |  | 13879 | my $self	= shift; | 
|  | 50 |  |  |  |  | 134 |  | 
|  | 50 |  |  |  |  | 232 |  | 
| 483 |  |  |  |  |  |  | my ($child)	= @{ $self->children }; | 
| 484 |  |  |  |  |  |  | my $set		= Set::Scalar->new( $child->in_scope_variables ); | 
| 485 |  |  |  |  |  |  | my $proj	= Set::Scalar->new( map { $_->value } @{ $self->variables } ); | 
| 486 |  |  |  |  |  |  | return $set->intersection($proj)->elements; | 
| 487 | 1 |  |  | 1 | 0 | 5 | } | 
| 488 |  |  |  |  |  |  | my $self	= shift; | 
| 489 |  |  |  |  |  |  | return sprintf('Project { %s }', join(' ', map { '?' . $_->value } @{ $self->variables })); | 
| 490 |  |  |  |  |  |  | } | 
| 491 |  |  |  |  |  |  | } | 
| 492 |  |  |  |  |  |  |  | 
| 493 |  |  |  |  |  |  | =item * L<Attean::Algebra::Comparator> | 
| 494 |  |  |  |  |  |  |  | 
| 495 | 50 |  |  | 50 |  | 23490 | =cut | 
|  | 50 |  |  |  |  | 116 |  | 
|  | 50 |  |  |  |  | 232 |  | 
| 496 | 50 |  |  | 50 |  | 14802 |  | 
|  | 50 |  |  |  |  | 109 |  | 
|  | 50 |  |  |  |  | 303 |  | 
| 497 | 50 |  |  | 50 |  | 22526 | use Moo; | 
|  | 50 |  |  |  |  | 98 |  | 
|  | 50 |  |  |  |  | 220 |  | 
| 498 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 499 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 500 |  |  |  |  |  |  | use Types::Standard qw(Bool ConsumerOf); | 
| 501 |  |  |  |  |  |  | use namespace::clean; | 
| 502 |  |  |  |  |  |  |  | 
| 503 |  |  |  |  |  |  |  | 
| 504 |  |  |  |  |  |  | has 'ascending' => (is => 'ro', isa => Bool, default => 1); | 
| 505 | 0 |  |  | 0 | 0 | 0 | has 'expression' => (is => 'ro', isa => ConsumerOf['Attean::API::Expression'], required => 1); | 
| 506 | 0 |  |  |  |  | 0 |  | 
| 507 | 0 | 0 |  |  |  | 0 | my $self	= shift; | 
| 508 | 0 | 0 |  |  |  | 0 | if ($self->ascending) { | 
| 509 | 0 |  |  |  |  | 0 | return 'ASC(' . $self->expression->as_string . ')'; | 
| 510 |  |  |  |  |  |  | } else { | 
| 511 |  |  |  |  |  |  | return 'DESC(' . $self->expression->as_string . ')'; | 
| 512 |  |  |  |  |  |  | } | 
| 513 |  |  |  |  |  |  | } | 
| 514 |  |  |  |  |  |  |  | 
| 515 |  |  |  |  |  |  | my $self	= shift; | 
| 516 |  |  |  |  |  |  | my $asc		= AtteanX::SPARQL::Token->keyword('ASC'); | 
| 517 |  |  |  |  |  |  | my $desc	= AtteanX::SPARQL::Token->keyword('DESC'); | 
| 518 | 50 |  |  | 50 |  | 31738 | my $l		= AtteanX::SPARQL::Token->lparen; | 
|  | 50 |  |  |  |  | 137 |  | 
|  | 50 |  |  |  |  | 289 |  | 
| 519 | 50 |  |  | 50 |  | 25520 | my $r		= AtteanX::SPARQL::Token->rparen; | 
|  | 50 |  |  |  |  | 102 |  | 
|  | 50 |  |  |  |  | 232 |  | 
| 520 | 50 |  |  | 50 |  | 15375 |  | 
|  | 50 |  |  |  |  | 108 |  | 
|  | 50 |  |  |  |  | 277 |  | 
| 521 |  |  |  |  |  |  | my @tokens; | 
| 522 |  |  |  |  |  |  | if ($self->ascending) { | 
| 523 |  |  |  |  |  |  | push(@tokens, $self->expression->sparql_tokens->elements); | 
| 524 |  |  |  |  |  |  | } else { | 
| 525 |  |  |  |  |  |  | push(@tokens, $desc, $l); | 
| 526 |  |  |  |  |  |  | push(@tokens, $self->expression->sparql_tokens->elements); | 
| 527 |  |  |  |  |  |  | push(@tokens, $r); | 
| 528 | 2 |  |  | 2 | 0 | 3 | } | 
| 529 | 2 |  |  |  |  | 3 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
|  | 2 |  |  |  |  | 5 |  | 
| 530 | 2 |  |  |  |  | 7 | } | 
| 531 | 2 |  |  |  |  | 265 | } | 
|  | 4 |  |  |  |  | 11 |  | 
|  | 2 |  |  |  |  | 95 |  | 
| 532 | 2 |  |  |  |  | 113 |  | 
| 533 |  |  |  |  |  |  | =item * L<Attean::Algebra::OrderBy> | 
| 534 |  |  |  |  |  |  |  | 
| 535 | 5 |  |  | 5 | 0 | 10 | =cut | 
| 536 | 5 |  |  |  |  | 10 |  | 
|  | 8 |  |  |  |  | 74 |  | 
|  | 5 |  |  |  |  | 25 |  | 
| 537 |  |  |  |  |  |  | use Moo; | 
| 538 | 0 |  |  | 0 | 0 | 0 | use AtteanX::SPARQL::Constants; | 
| 539 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 540 |  |  |  |  |  |  | use Types::Standard qw(ArrayRef InstanceOf); | 
| 541 |  |  |  |  |  |  | use namespace::clean; | 
| 542 |  |  |  |  |  |  |  | 
| 543 |  |  |  |  |  |  | with 'Attean::API::SPARQLQuerySerializable'; | 
| 544 |  |  |  |  |  |  | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | 
| 545 |  |  |  |  |  |  |  | 
| 546 | 50 |  |  | 50 |  | 36699 | has 'comparators' => (is => 'ro', isa => ArrayRef[InstanceOf['Attean::Algebra::Comparator']], required => 1); | 
|  | 50 |  |  |  |  | 120 |  | 
|  | 50 |  |  |  |  | 225 |  | 
| 547 | 50 |  |  | 50 |  | 14753 |  | 
|  | 50 |  |  |  |  | 111 |  | 
|  | 50 |  |  |  |  | 8039 |  | 
| 548 | 50 |  |  | 50 |  | 328 | my $self	= shift; | 
|  | 50 |  |  |  |  | 100 |  | 
|  | 50 |  |  |  |  | 1413 |  | 
| 549 | 50 |  |  | 50 |  | 285 | return sprintf('Order { %s }', join(', ', map { $_->as_string } @{ $self->comparators })); | 
|  | 50 |  |  |  |  | 103 |  | 
|  | 50 |  |  |  |  | 263 |  | 
| 550 | 50 |  |  | 50 |  | 26131 | } | 
|  | 50 |  |  |  |  | 98 |  | 
|  | 50 |  |  |  |  | 230 |  | 
| 551 |  |  |  |  |  |  | } | 
| 552 |  |  |  |  |  |  |  | 
| 553 |  |  |  |  |  |  | =item * L<Attean::Algebra::BGP> | 
| 554 |  |  |  |  |  |  |  | 
| 555 |  |  |  |  |  |  | =cut | 
| 556 | 0 |  |  | 0 | 0 | 0 |  | 
| 557 |  |  |  |  |  |  | use Moo; | 
| 558 | 1 |  |  | 1 | 0 | 3 | use Attean::RDF; | 
| 559 | 1 | 50 |  |  |  | 5 | use Set::Scalar; | 
| 560 | 1 |  |  |  |  | 8 | use AtteanX::SPARQL::Constants; | 
| 561 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 562 | 0 |  |  |  |  | 0 | use Types::Standard qw(ArrayRef ConsumerOf); | 
| 563 |  |  |  |  |  |  | use namespace::clean; | 
| 564 |  |  |  |  |  |  |  | 
| 565 |  |  |  |  |  |  | with 'Attean::API::Algebra', 'Attean::API::NullaryQueryTree', 'Attean::API::CanonicalizingBindingSet'; | 
| 566 |  |  |  |  |  |  |  | 
| 567 | 2 |  |  | 2 | 0 | 2073 | has 'triples' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::TriplePattern']], default => sub { [] }); | 
| 568 | 2 |  |  |  |  | 11 |  | 
| 569 | 2 |  |  |  |  | 100 | my $self	= shift; | 
| 570 | 2 |  |  |  |  | 83 | my $set		= Set::Scalar->new(); | 
| 571 | 2 |  |  |  |  | 82 | foreach my $t (@{ $self->triples }) { | 
| 572 |  |  |  |  |  |  | my @vars	= $t->referenced_variables(); | 
| 573 | 2 |  |  |  |  | 76 | $set->insert(@vars); | 
| 574 | 2 | 50 |  |  |  | 10 | } | 
| 575 | 0 |  |  |  |  | 0 | return $set->elements; | 
| 576 |  |  |  |  |  |  | } | 
| 577 | 2 |  |  |  |  | 6 |  | 
| 578 | 2 |  |  |  |  | 10 | my $self	= shift; | 
| 579 | 2 |  |  |  |  | 5 | my @tokens; | 
| 580 |  |  |  |  |  |  | my $dot	= AtteanX::SPARQL::Token->dot; | 
| 581 | 2 |  |  |  |  | 62 | foreach my $t (@{ $self->triples }) { | 
| 582 |  |  |  |  |  |  | push(@tokens, $t->sparql_tokens->elements); | 
| 583 |  |  |  |  |  |  | push(@tokens, $dot); | 
| 584 |  |  |  |  |  |  | } | 
| 585 |  |  |  |  |  |  | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 586 |  |  |  |  |  |  | } | 
| 587 |  |  |  |  |  |  |  | 
| 588 |  |  |  |  |  |  | my $self	= shift; | 
| 589 |  |  |  |  |  |  | return 'BGP { ' . join(', ', map { $_->as_string } @{ $self->triples }) . ' }'; | 
| 590 | 50 |  |  | 50 |  | 144467 | } | 
|  | 50 |  |  |  |  | 108 |  | 
|  | 50 |  |  |  |  | 238 |  | 
| 591 | 50 |  |  | 50 |  | 15070 |  | 
|  | 50 |  |  |  |  | 107 |  | 
|  | 50 |  |  |  |  | 6884 |  | 
| 592 | 50 |  |  | 50 |  | 311 | my $self	= shift; | 
|  | 50 |  |  |  |  | 99 |  | 
|  | 50 |  |  |  |  | 1139 |  | 
| 593 | 50 |  |  | 50 |  | 261 | return @{ $self->triples }; | 
|  | 50 |  |  |  |  | 99 |  | 
|  | 50 |  |  |  |  | 257 |  | 
| 594 | 50 |  |  | 50 |  | 26573 | } | 
|  | 50 |  |  |  |  | 98 |  | 
|  | 50 |  |  |  |  | 232 |  | 
| 595 |  |  |  |  |  |  |  | 
| 596 |  |  |  |  |  |  | my $self	= shift; | 
| 597 |  |  |  |  |  |  | my ($algebra, $mapping)	= $self->canonical_bgp_with_mapping(); | 
| 598 |  |  |  |  |  |  | my @proj	= sort map { sprintf("(?v%03d AS $_)", $mapping->{$_}{id}) } grep { $mapping->{$_}{type} eq 'variable' } (keys %$mapping); | 
| 599 |  |  |  |  |  |  | foreach my $var (keys %$mapping) { | 
| 600 |  |  |  |  |  |  | $algebra	= Attean::Algebra::Extend->new( | 
| 601 | 0 |  |  | 0 | 0 | 0 | children	=> [$algebra], | 
| 602 |  |  |  |  |  |  | variable	=> variable($var), | 
| 603 | 1 |  |  | 1 | 0 | 3 | expression	=> Attean::ValueExpression->new( value => variable($mapping->{$var}{id}) ), | 
| 604 | 1 |  |  |  |  | 6 | ); | 
|  | 1 |  |  |  |  | 6 |  | 
|  | 1 |  |  |  |  | 7 |  | 
| 605 |  |  |  |  |  |  | } | 
| 606 |  |  |  |  |  |  | } | 
| 607 |  |  |  |  |  |  |  | 
| 608 |  |  |  |  |  |  | my $self	= shift; | 
| 609 |  |  |  |  |  |  | my ($triples, $mapping)	= $self->canonical_set_with_mapping(); | 
| 610 |  |  |  |  |  |  | my $algebra	= Attean::Algebra::BGP->new( triples => $triples ); | 
| 611 |  |  |  |  |  |  | return ($algebra, $mapping); | 
| 612 |  |  |  |  |  |  | } | 
| 613 | 50 |  |  | 50 |  | 137404 | } | 
|  | 50 |  |  |  |  | 107 |  | 
|  | 50 |  |  |  |  | 235 |  | 
| 614 | 50 |  |  | 50 |  | 14939 |  | 
|  | 50 |  |  |  |  | 111 |  | 
|  | 50 |  |  |  |  | 438 |  | 
| 615 | 50 |  |  | 50 |  | 62676 | =item * L<Attean::Algebra::Service> | 
|  | 50 |  |  |  |  | 476645 |  | 
|  | 50 |  |  |  |  | 2007 |  | 
| 616 | 50 |  |  | 50 |  | 389 |  | 
|  | 50 |  |  |  |  | 120 |  | 
|  | 50 |  |  |  |  | 6880 |  | 
| 617 | 50 |  |  | 50 |  | 300 | =cut | 
|  | 50 |  |  |  |  | 94 |  | 
|  | 50 |  |  |  |  | 1065 |  | 
| 618 | 50 |  |  | 50 |  | 249 |  | 
|  | 50 |  |  |  |  | 103 |  | 
|  | 50 |  |  |  |  | 376 |  | 
| 619 | 50 |  |  | 50 |  | 29424 | use AtteanX::SPARQL::Constants; | 
|  | 50 |  |  |  |  | 112 |  | 
|  | 50 |  |  |  |  | 414 |  | 
| 620 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 621 |  |  |  |  |  |  | use Moo; | 
| 622 |  |  |  |  |  |  | use Types::Standard qw(ConsumerOf Bool); | 
| 623 |  |  |  |  |  |  | use namespace::clean; | 
| 624 |  |  |  |  |  |  |  | 
| 625 |  |  |  |  |  |  | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree', 'Attean::API::UnionScopeVariables'; | 
| 626 | 77 |  |  | 77 | 0 | 141 |  | 
| 627 | 77 |  |  |  |  | 556 | has 'endpoint' => (is => 'ro', isa => ConsumerOf['Attean::API::TermOrVariable'], required => 1); | 
| 628 | 77 |  |  |  |  | 6070 | has 'silent' => (is => 'ro', isa => Bool, default => 0); | 
|  | 77 |  |  |  |  | 299 |  | 
| 629 | 91 |  |  |  |  | 1434 |  | 
| 630 | 91 |  |  |  |  | 356 | my $self	= shift; | 
| 631 |  |  |  |  |  |  | my $endpoint	= $self->endpoint->as_sparql; | 
| 632 | 77 |  |  |  |  | 3655 | chomp($endpoint); | 
| 633 |  |  |  |  |  |  | return sprintf('Service %s', $endpoint); | 
| 634 |  |  |  |  |  |  | } | 
| 635 |  |  |  |  |  |  |  | 
| 636 | 81 |  |  | 81 | 0 | 176 |  | 
| 637 | 81 |  |  |  |  | 157 | my $self	= shift; | 
| 638 | 81 |  |  |  |  | 462 | my $service	= AtteanX::SPARQL::Token->keyword('SERVICE'); | 
| 639 | 81 |  |  |  |  | 3759 | my $l		= AtteanX::SPARQL::Token->lbrace; | 
|  | 81 |  |  |  |  | 360 |  | 
| 640 | 91 |  |  |  |  | 485 | my $r		= AtteanX::SPARQL::Token->rbrace; | 
| 641 | 91 |  |  |  |  | 339 | my ($child)	= @{ $self->children }; | 
| 642 |  |  |  |  |  |  |  | 
| 643 | 81 |  |  |  |  | 1348 | my @tokens; | 
| 644 |  |  |  |  |  |  | push(@tokens, $service); | 
| 645 |  |  |  |  |  |  | if ($self->silent) { | 
| 646 |  |  |  |  |  |  | push(@tokens, AtteanX::SPARQL::Token->keyword('SILENT')); | 
| 647 | 19 |  |  | 19 | 0 | 38 | } | 
| 648 | 19 |  |  |  |  | 46 | push(@tokens, $self->endpoint->sparql_tokens->elements); | 
|  | 24 |  |  |  |  | 109 |  | 
|  | 19 |  |  |  |  | 87 |  | 
| 649 |  |  |  |  |  |  | push(@tokens, $l); | 
| 650 |  |  |  |  |  |  | push(@tokens, $child->sparql_subtokens->elements); | 
| 651 |  |  |  |  |  |  | push(@tokens, $r); | 
| 652 | 4 |  |  | 4 | 0 | 11 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 653 | 4 |  |  |  |  | 8 | } | 
|  | 4 |  |  |  |  | 24 |  | 
| 654 |  |  |  |  |  |  | } | 
| 655 |  |  |  |  |  |  |  | 
| 656 |  |  |  |  |  |  | =item * L<Attean::Algebra::Path> | 
| 657 | 0 |  |  | 0 | 0 | 0 |  | 
| 658 | 0 |  |  |  |  | 0 | =cut | 
| 659 | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 660 | 0 |  |  |  |  | 0 | use Moo; | 
| 661 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 662 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 663 |  |  |  |  |  |  | use Types::Standard qw(ArrayRef ConsumerOf); | 
| 664 | 0 |  |  |  |  | 0 | use namespace::clean; | 
| 665 |  |  |  |  |  |  |  | 
| 666 |  |  |  |  |  |  | with 'Attean::API::Algebra', 'Attean::API::NullaryQueryTree'; | 
| 667 |  |  |  |  |  |  |  | 
| 668 |  |  |  |  |  |  | has 'subject' => (is => 'ro', isa => ConsumerOf['Attean::API::TermOrVariableOrTriplePattern'], required => 1); | 
| 669 |  |  |  |  |  |  | has 'path' => (is => 'ro', isa => ConsumerOf['Attean::API::PropertyPath'], required => 1); | 
| 670 | 4 |  |  | 4 | 0 | 1816 | has 'object' => (is => 'ro', isa => ConsumerOf['Attean::API::TermOrVariableOrTriplePattern'], required => 1); | 
| 671 | 4 |  |  |  |  | 23 |  | 
| 672 | 4 |  |  |  |  | 86 | my $self	= shift; | 
| 673 | 4 |  |  |  |  | 25 | my @vars	= map { $_->value } grep { $_->does('Attean::API::Variable') } ($self->subject, $self->object); | 
| 674 |  |  |  |  |  |  | return Set::Scalar->new(@vars)->elements; | 
| 675 | 5 |  |  | 5 | 0 | 8 | } | 
| 676 |  |  |  |  |  |  |  | 
| 677 |  |  |  |  |  |  |  | 
| 678 |  |  |  |  |  |  | my $self	= shift; | 
| 679 |  |  |  |  |  |  | return 'Path { ' . join(', ', map { $_->as_string } map { $self->$_() } qw(subject path object)) . ' }'; | 
| 680 |  |  |  |  |  |  | } | 
| 681 |  |  |  |  |  |  |  | 
| 682 |  |  |  |  |  |  | my $self	= shift; | 
| 683 | 50 |  |  | 50 |  | 178710 | my @tokens; | 
|  | 50 |  |  |  |  | 136 |  | 
|  | 50 |  |  |  |  | 6923 |  | 
| 684 | 50 |  |  | 50 |  | 311 | foreach my $t ($self->subject, $self->path, $self->object) { | 
|  | 50 |  |  |  |  | 99 |  | 
|  | 50 |  |  |  |  | 936 |  | 
| 685 | 50 |  |  | 50 |  | 233 | push(@tokens, $t->sparql_tokens->elements); | 
|  | 50 |  |  |  |  | 96 |  | 
|  | 50 |  |  |  |  | 369 |  | 
| 686 | 50 |  |  | 50 |  | 16609 | } | 
|  | 50 |  |  |  |  | 107 |  | 
|  | 50 |  |  |  |  | 282 |  | 
| 687 | 50 |  |  | 50 |  | 27648 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
|  | 50 |  |  |  |  | 102 |  | 
|  | 50 |  |  |  |  | 247 |  | 
| 688 |  |  |  |  |  |  | } | 
| 689 |  |  |  |  |  |  | } | 
| 690 |  |  |  |  |  |  |  | 
| 691 |  |  |  |  |  |  | =item * L<Attean::Algebra::Group> | 
| 692 |  |  |  |  |  |  |  | 
| 693 |  |  |  |  |  |  | =cut | 
| 694 |  |  |  |  |  |  |  | 
| 695 | 1 |  |  | 1 | 0 | 8 | use utf8; | 
| 696 | 1 |  |  |  |  | 37 | use Moo; | 
| 697 | 1 |  |  |  |  | 27 | use Attean::API::Query; | 
| 698 | 1 |  |  |  |  | 11 | use AtteanX::SPARQL::Constants; | 
| 699 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 700 |  |  |  |  |  |  | use Types::Standard qw(ArrayRef ConsumerOf); | 
| 701 | 0 |  |  | 0 | 0 | 0 | use namespace::clean; | 
| 702 |  |  |  |  |  |  |  | 
| 703 |  |  |  |  |  |  | with 'Attean::API::SPARQLQuerySerializable'; | 
| 704 | 3 |  |  | 3 | 0 | 20 | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | 
| 705 | 3 |  |  |  |  | 31 |  | 
| 706 | 3 |  |  |  |  | 218 | has 'groupby' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::Expression']]); | 
| 707 | 3 |  |  |  |  | 231 | has 'aggregates' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::AggregateExpression']]); | 
| 708 | 3 |  |  |  |  | 122 |  | 
|  | 3 |  |  |  |  | 21 |  | 
| 709 |  |  |  |  |  |  | my $self	= shift; | 
| 710 | 3 |  |  |  |  | 9 | foreach my $a (@{ $self->aggregates }) { | 
| 711 | 3 |  |  |  |  | 9 | my $op	= $a->operator; | 
| 712 | 3 | 50 |  |  |  | 21 | if ($op eq 'RANK') { | 
| 713 | 0 |  |  |  |  | 0 | if (scalar(@{ $self->aggregates }) > 1) { | 
| 714 |  |  |  |  |  |  | die "Cannot use both aggregates and RANKing in grouping operator"; | 
| 715 | 3 |  |  |  |  | 38 | } | 
| 716 | 3 |  |  |  |  | 12 | } | 
| 717 | 3 |  |  |  |  | 26 | } | 
| 718 | 3 |  |  |  |  | 13 | } | 
| 719 | 3 |  |  |  |  | 53 |  | 
| 720 |  |  |  |  |  |  | my $self	= shift; | 
| 721 |  |  |  |  |  |  | my $aggs	= $self->aggregates // []; | 
| 722 |  |  |  |  |  |  | my $groups	= $self->groupby // []; | 
| 723 |  |  |  |  |  |  | my %vars; | 
| 724 |  |  |  |  |  |  | foreach my $a (@$aggs) { | 
| 725 |  |  |  |  |  |  | $vars{ $a->variable->value }++; | 
| 726 |  |  |  |  |  |  | } | 
| 727 |  |  |  |  |  |  | foreach my $e (@$groups) { | 
| 728 | 50 |  |  | 50 |  | 145216 | if ($e->isa('Attean::ValueExpression')) { | 
|  | 50 |  |  |  |  | 122 |  | 
|  | 50 |  |  |  |  | 251 |  | 
| 729 | 50 |  |  | 50 |  | 14959 | my $value	= $e->value; | 
|  | 50 |  |  |  |  | 107 |  | 
|  | 50 |  |  |  |  | 7211 |  | 
| 730 | 50 |  |  | 50 |  | 335 | if ($value->does('Attean::API::Variable')) { | 
|  | 50 |  |  |  |  | 106 |  | 
|  | 50 |  |  |  |  | 1222 |  | 
| 731 | 50 |  |  | 50 |  | 273 | $vars{ $value->value }++; | 
|  | 50 |  |  |  |  | 92 |  | 
|  | 50 |  |  |  |  | 270 |  | 
| 732 | 50 |  |  | 50 |  | 26880 | } | 
|  | 50 |  |  |  |  | 104 |  | 
|  | 50 |  |  |  |  | 234 |  | 
| 733 |  |  |  |  |  |  | } | 
| 734 |  |  |  |  |  |  | } | 
| 735 |  |  |  |  |  |  |  | 
| 736 |  |  |  |  |  |  | return keys %vars; | 
| 737 |  |  |  |  |  |  | } | 
| 738 |  |  |  |  |  |  |  | 
| 739 |  |  |  |  |  |  | my $self	= shift; | 
| 740 |  |  |  |  |  |  | my @aggs; | 
| 741 | 2 |  |  | 2 | 0 | 4 | my $aggs	= $self->aggregates // []; | 
| 742 | 2 |  |  |  |  | 8 | my $groups	= $self->groupby // []; | 
|  | 2 |  |  |  |  | 48 |  | 
|  | 4 |  |  |  |  | 37 |  | 
| 743 | 2 |  |  |  |  | 7 | foreach my $a (@$aggs) { | 
| 744 |  |  |  |  |  |  | my $v	= $a->variable->as_string; | 
| 745 |  |  |  |  |  |  | my $op	= $a->operator; | 
| 746 | 0 |  |  | 0 | 0 | 0 | my $d	= $a->distinct ? "DISTINCT " : ''; | 
| 747 |  |  |  |  |  |  | my ($e)	= ((map { $_->as_string } @{ $a->children }), ''); | 
| 748 |  |  |  |  |  |  | my $s	= "$v ← ${op}($d$e)"; | 
| 749 | 1 |  |  | 1 | 0 | 3 | push(@aggs, $s); | 
| 750 | 1 |  |  |  |  | 4 | } | 
|  | 3 |  |  |  |  | 48 |  | 
|  | 3 |  |  |  |  | 277 |  | 
| 751 |  |  |  |  |  |  | return sprintf('Group { %s } aggregate { %s }', join(', ', map { $_->as_string() } @$groups), join(', ', @aggs)); | 
| 752 |  |  |  |  |  |  | } | 
| 753 |  |  |  |  |  |  |  | 
| 754 | 13 |  |  | 13 | 0 | 93 | } | 
| 755 | 13 |  |  |  |  | 33 |  | 
| 756 | 13 |  |  |  |  | 101 | =item * L<Attean::Algebra::NegatedPropertySet> | 
| 757 | 39 |  |  |  |  | 189 |  | 
| 758 |  |  |  |  |  |  | =cut | 
| 759 | 13 |  |  |  |  | 229 |  | 
| 760 |  |  |  |  |  |  | use Moo; | 
| 761 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 762 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 763 |  |  |  |  |  |  | use Types::Standard qw(ArrayRef ConsumerOf); | 
| 764 |  |  |  |  |  |  | use namespace::clean; | 
| 765 |  |  |  |  |  |  |  | 
| 766 |  |  |  |  |  |  | with 'Attean::API::PropertyPath'; | 
| 767 |  |  |  |  |  |  |  | 
| 768 | 50 |  |  | 50 |  | 145540 | has 'predicates' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::IRI']], required => 1); | 
|  | 50 |  |  |  |  | 108 |  | 
|  | 50 |  |  |  |  | 416 |  | 
| 769 | 50 |  |  | 50 |  | 1033 |  | 
|  | 50 |  |  |  |  | 89 |  | 
|  | 50 |  |  |  |  | 240 |  | 
| 770 | 50 |  |  | 50 |  | 15452 | my $self	= shift; | 
|  | 50 |  |  |  |  | 109 |  | 
|  | 50 |  |  |  |  | 1162 |  | 
| 771 | 50 |  |  | 50 |  | 226 | return sprintf("!(%s)", join('|', map { $_->ntriples_string } @{ $self->predicates })); | 
|  | 50 |  |  |  |  | 96 |  | 
|  | 50 |  |  |  |  | 7338 |  | 
| 772 | 50 |  |  | 50 |  | 334 | } | 
|  | 50 |  |  |  |  | 96 |  | 
|  | 50 |  |  |  |  | 1227 |  | 
| 773 | 50 |  |  | 50 |  | 248 | my $self	= shift; | 
|  | 50 |  |  |  |  | 114 |  | 
|  | 50 |  |  |  |  | 272 |  | 
| 774 | 50 |  |  | 50 |  | 27618 | return "!(" . join('|', map { $_->as_sparql } @{$self->predicates}) . ")"; | 
|  | 50 |  |  |  |  | 106 |  | 
|  | 50 |  |  |  |  | 242 |  | 
| 775 |  |  |  |  |  |  | } | 
| 776 |  |  |  |  |  |  |  | 
| 777 |  |  |  |  |  |  | my $self	= shift; | 
| 778 |  |  |  |  |  |  | my $bang	= AtteanX::SPARQL::Token->op_bang; | 
| 779 |  |  |  |  |  |  | my $or		= AtteanX::SPARQL::Token->path_or; | 
| 780 |  |  |  |  |  |  | my $l		= AtteanX::SPARQL::Token->lparen; | 
| 781 |  |  |  |  |  |  | my $r		= AtteanX::SPARQL::Token->rparen; | 
| 782 |  |  |  |  |  |  |  | 
| 783 | 9 |  |  | 9 | 0 | 292 | my @tokens; | 
| 784 | 9 |  |  |  |  | 22 | push(@tokens, $bang, $l); | 
|  | 9 |  |  |  |  | 49 |  | 
| 785 | 9 |  |  |  |  | 43 | foreach my $t (@{ $self->predicates }) { | 
| 786 | 9 | 100 |  |  |  | 63 | push(@tokens, $t->sparql_tokens->elements); | 
| 787 | 3 | 50 |  |  |  | 11 | push(@tokens, $or); | 
|  | 3 |  |  |  |  | 30 |  | 
| 788 | 0 |  |  |  |  | 0 | } | 
| 789 |  |  |  |  |  |  | pop(@tokens); # remove last OR token | 
| 790 |  |  |  |  |  |  | push(@tokens, $r); | 
| 791 |  |  |  |  |  |  | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 792 |  |  |  |  |  |  | } | 
| 793 |  |  |  |  |  |  | } | 
| 794 |  |  |  |  |  |  |  | 
| 795 | 4 |  |  | 4 | 0 | 7 | =item * L<Attean::Algebra::PredicatePath> | 
| 796 | 4 |  | 50 |  |  | 10 |  | 
| 797 | 4 |  | 50 |  |  | 10 | =cut | 
| 798 | 4 |  |  |  |  | 18 |  | 
| 799 | 4 |  |  |  |  | 12 | use Moo; | 
| 800 | 4 |  |  |  |  | 28 | use Types::Standard qw(ConsumerOf); | 
| 801 |  |  |  |  |  |  | use namespace::clean; | 
| 802 | 4 |  |  |  |  | 10 |  | 
| 803 | 4 | 50 |  |  |  | 13 | with 'Attean::API::PropertyPath'; | 
| 804 | 4 |  |  |  |  | 9 |  | 
| 805 | 4 | 50 |  |  |  | 12 | has 'predicate' => (is => 'ro', isa => ConsumerOf['Attean::API::IRI'], required => 1); | 
| 806 | 4 |  |  |  |  | 97 | my $self	= shift; | 
| 807 |  |  |  |  |  |  | return $self->predicate->ntriples_string; | 
| 808 |  |  |  |  |  |  | } | 
| 809 |  |  |  |  |  |  | my $self	= shift; | 
| 810 |  |  |  |  |  |  | return 'Property Path ' . $self->as_string; | 
| 811 | 4 |  |  |  |  | 17 | } | 
| 812 |  |  |  |  |  |  | my $self	= shift; | 
| 813 |  |  |  |  |  |  | return $self->predicate->as_sparql; | 
| 814 |  |  |  |  |  |  | } | 
| 815 | 6 |  |  | 6 | 0 | 16 |  | 
| 816 | 6 |  |  |  |  | 11 | my $self	= shift; | 
| 817 | 6 |  | 50 |  |  | 29 | return $self->predicate->sparql_tokens; | 
| 818 | 6 |  | 50 |  |  | 29 | } | 
| 819 | 6 |  |  |  |  | 13 |  | 
| 820 | 6 |  |  |  |  | 45 | } | 
| 821 | 6 |  |  |  |  | 16 |  | 
| 822 | 6 | 50 |  |  |  | 31 | =item * L<Attean::Algebra::InversePath> | 
| 823 | 6 |  |  |  |  | 13 |  | 
|  | 6 |  |  |  |  | 28 |  | 
|  | 6 |  |  |  |  | 21 |  | 
| 824 | 6 |  |  |  |  | 39 | =cut | 
| 825 | 6 |  |  |  |  | 25 |  | 
| 826 |  |  |  |  |  |  | use Moo; | 
| 827 | 6 |  |  |  |  | 20 | use AtteanX::SPARQL::Constants; | 
|  | 6 |  |  |  |  | 17 |  | 
| 828 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 829 |  |  |  |  |  |  | use Types::Standard qw(ConsumerOf); | 
| 830 | 0 |  |  | 0 | 0 | 0 | use namespace::clean; | 
| 831 |  |  |  |  |  |  |  | 
| 832 |  |  |  |  |  |  | with 'Attean::API::UnaryPropertyPath'; | 
| 833 |  |  |  |  |  |  |  | 
| 834 |  |  |  |  |  |  | my $self	= shift; | 
| 835 |  |  |  |  |  |  | my ($path)	= @{ $self->children }; | 
| 836 |  |  |  |  |  |  | return '^' . $self->path->as_sparql; | 
| 837 |  |  |  |  |  |  | } | 
| 838 | 50 |  |  | 50 |  | 154422 |  | 
|  | 50 |  |  |  |  | 123 |  | 
|  | 50 |  |  |  |  | 253 |  | 
| 839 | 50 |  |  | 50 |  | 15045 | my $self	= shift; | 
|  | 50 |  |  |  |  | 122 |  | 
|  | 50 |  |  |  |  | 7315 |  | 
| 840 | 50 |  |  | 50 |  | 335 | my $hat		= AtteanX::SPARQL::Token->path_hat; | 
|  | 50 |  |  |  |  | 99 |  | 
|  | 50 |  |  |  |  | 1133 |  | 
| 841 | 50 |  |  | 50 |  | 237 | my $l		= AtteanX::SPARQL::Token->lparen; | 
|  | 50 |  |  |  |  | 108 |  | 
|  | 50 |  |  |  |  | 263 |  | 
| 842 | 50 |  |  | 50 |  | 26957 | my $r		= AtteanX::SPARQL::Token->rparen; | 
|  | 50 |  |  |  |  | 154 |  | 
|  | 50 |  |  |  |  | 249 |  | 
| 843 |  |  |  |  |  |  |  | 
| 844 |  |  |  |  |  |  | my @tokens; | 
| 845 |  |  |  |  |  |  | foreach my $t (@{ $self->children }) { | 
| 846 |  |  |  |  |  |  | push(@tokens, $t->sparql_tokens->elements); | 
| 847 |  |  |  |  |  |  | } | 
| 848 |  |  |  |  |  |  |  | 
| 849 | 1 |  |  | 1 | 0 | 424 | if (scalar(@tokens) > 1) { | 
| 850 | 1 |  |  |  |  | 6 | unshift(@tokens, $hat, $l); | 
|  | 2 |  |  |  |  | 43 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 851 |  |  |  |  |  |  | push(@tokens, $r); | 
| 852 | 1 |  |  | 1 | 0 | 2 | } else { | 
| 853 | 1 |  |  | 1 | 0 | 3 | unshift(@tokens, $hat); | 
| 854 |  |  |  |  |  |  | } | 
| 855 | 0 |  |  | 0 | 0 | 0 |  | 
| 856 | 0 |  |  |  |  | 0 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
|  | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 857 |  |  |  |  |  |  | } | 
| 858 |  |  |  |  |  |  | } | 
| 859 |  |  |  |  |  |  |  | 
| 860 | 2 |  |  | 2 | 0 | 133 | =item * L<Attean::Algebra::SequencePath> | 
| 861 | 2 |  |  |  |  | 12 |  | 
| 862 | 2 |  |  |  |  | 96 | =cut | 
| 863 | 2 |  |  |  |  | 81 |  | 
| 864 | 2 |  |  |  |  | 80 | use Moo; | 
| 865 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 866 | 2 |  |  |  |  | 75 | use AtteanX::SPARQL::Token; | 
| 867 | 2 |  |  |  |  | 4 | use namespace::clean; | 
| 868 | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 6 |  | 
| 869 | 4 |  |  |  |  | 11 | with 'Attean::API::NaryPropertyPath'; | 
| 870 | 4 |  |  |  |  | 14 |  | 
| 871 |  |  |  |  |  |  | my $self	= shift; | 
| 872 | 2 |  |  |  |  | 4 | my @paths	= @{ $self->children }; | 
| 873 | 2 |  |  |  |  | 3 | return '(' . join('/', map { $_->as_sparql } @paths) . ')'; | 
| 874 | 2 |  |  |  |  | 30 | } | 
| 875 |  |  |  |  |  |  |  | 
| 876 |  |  |  |  |  |  | my $self	= shift; | 
| 877 |  |  |  |  |  |  | my $slash	= AtteanX::SPARQL::Token->slash; | 
| 878 |  |  |  |  |  |  |  | 
| 879 |  |  |  |  |  |  | my @tokens; | 
| 880 |  |  |  |  |  |  | foreach my $t (@{ $self->children }) { | 
| 881 |  |  |  |  |  |  | push(@tokens, $t->sparql_tokens->elements); | 
| 882 |  |  |  |  |  |  | push(@tokens, $slash); | 
| 883 | 50 |  |  | 50 |  | 147630 | } | 
|  | 50 |  |  |  |  | 123 |  | 
|  | 50 |  |  |  |  | 264 |  | 
| 884 | 50 |  |  | 50 |  | 16158 | pop(@tokens); # remove last SLASH token | 
|  | 50 |  |  |  |  | 119 |  | 
|  | 50 |  |  |  |  | 298 |  | 
| 885 | 50 |  |  | 50 |  | 21322 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
|  | 50 |  |  |  |  | 107 |  | 
|  | 50 |  |  |  |  | 263 |  | 
| 886 |  |  |  |  |  |  | } | 
| 887 |  |  |  |  |  |  | } | 
| 888 |  |  |  |  |  |  |  | 
| 889 |  |  |  |  |  |  | =item * L<Attean::Algebra::AlternativePath> | 
| 890 |  |  |  |  |  |  |  | 
| 891 | 18 |  |  | 18 | 0 | 435 | =cut | 
| 892 | 18 |  |  |  |  | 294 |  | 
| 893 |  |  |  |  |  |  | use Moo; | 
| 894 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 895 | 4 |  |  | 4 | 0 | 5 | use AtteanX::SPARQL::Token; | 
| 896 | 4 |  |  |  |  | 8 | use namespace::clean; | 
| 897 |  |  |  |  |  |  |  | 
| 898 | 4 |  |  | 4 | 0 | 7 | with 'Attean::API::NaryPropertyPath'; | 
| 899 |  |  |  |  |  |  |  | 
| 900 | 0 |  |  | 0 | 0 | 0 | my $self	= shift; | 
| 901 | 0 |  |  |  |  | 0 | my @paths	= @{ $self->children }; | 
| 902 |  |  |  |  |  |  | return '(' . join('|', map { $_->as_sparql } @paths) . ')'; | 
| 903 |  |  |  |  |  |  | } | 
| 904 |  |  |  |  |  |  |  | 
| 905 | 36 |  |  | 36 | 0 | 169 | my $self	= shift; | 
| 906 | 36 |  |  |  |  | 210 | my $or		= AtteanX::SPARQL::Token->path_or; | 
| 907 |  |  |  |  |  |  |  | 
| 908 |  |  |  |  |  |  | my @tokens; | 
| 909 |  |  |  |  |  |  | foreach my $t (@{ $self->children }) { | 
| 910 |  |  |  |  |  |  | push(@tokens, $t->sparql_tokens->elements); | 
| 911 |  |  |  |  |  |  | push(@tokens, $or); | 
| 912 |  |  |  |  |  |  | } | 
| 913 |  |  |  |  |  |  | pop(@tokens); # remove last OR token | 
| 914 |  |  |  |  |  |  | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 915 |  |  |  |  |  |  | } | 
| 916 | 50 |  |  | 50 |  | 33209 | } | 
|  | 50 |  |  |  |  | 110 |  | 
|  | 50 |  |  |  |  | 241 |  | 
| 917 | 50 |  |  | 50 |  | 15295 |  | 
|  | 50 |  |  |  |  | 126 |  | 
|  | 50 |  |  |  |  | 7770 |  | 
| 918 | 50 |  |  | 50 |  | 352 | =item * L<Attean::Algebra::ZeroOrMorePath> | 
|  | 50 |  |  |  |  | 95 |  | 
|  | 50 |  |  |  |  | 1285 |  | 
| 919 | 50 |  |  | 50 |  | 298 |  | 
|  | 50 |  |  |  |  | 113 |  | 
|  | 50 |  |  |  |  | 289 |  | 
| 920 | 50 |  |  | 50 |  | 20942 | =cut | 
|  | 50 |  |  |  |  | 118 |  | 
|  | 50 |  |  |  |  | 220 |  | 
| 921 |  |  |  |  |  |  |  | 
| 922 |  |  |  |  |  |  | use Moo; | 
| 923 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 924 | 4 |  |  | 4 | 0 | 12 | use AtteanX::SPARQL::Token; | 
| 925 |  |  |  |  |  |  | use Types::Standard qw(ConsumerOf); | 
| 926 | 0 |  |  | 0 | 0 | 0 | use namespace::clean; | 
| 927 | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 928 | 0 |  |  |  |  | 0 | with 'Attean::API::UnaryPropertyPath'; | 
| 929 |  |  |  |  |  |  |  | 
| 930 |  |  |  |  |  |  | my $self	= shift; | 
| 931 |  |  |  |  |  |  | my ($path)	= @{ $self->children }; | 
| 932 | 10 |  |  | 10 | 0 | 2760 | return $self->path->as_sparql . '*'; | 
| 933 | 10 |  |  |  |  | 80 | } | 
| 934 | 10 |  |  |  |  | 552 |  | 
| 935 | 10 |  |  |  |  | 435 | my $self	= shift; | 
| 936 |  |  |  |  |  |  | my $star	= AtteanX::SPARQL::Token->star; | 
| 937 | 10 |  |  |  |  | 484 | my $l		= AtteanX::SPARQL::Token->lparen; | 
| 938 | 10 |  |  |  |  | 24 | my $r		= AtteanX::SPARQL::Token->rparen; | 
|  | 10 |  |  |  |  | 59 |  | 
| 939 | 10 |  |  |  |  | 60 |  | 
| 940 |  |  |  |  |  |  | my @tokens; | 
| 941 |  |  |  |  |  |  | foreach my $t (@{ $self->children }) { | 
| 942 | 10 | 100 |  |  |  | 58 | push(@tokens, $t->sparql_tokens->elements); | 
| 943 | 8 |  |  |  |  | 42 | } | 
| 944 | 8 |  |  |  |  | 24 |  | 
| 945 |  |  |  |  |  |  | if (scalar(@tokens) > 1) { | 
| 946 | 2 |  |  |  |  | 6 | unshift(@tokens, $l); | 
| 947 |  |  |  |  |  |  | push(@tokens, $r); | 
| 948 |  |  |  |  |  |  | } | 
| 949 | 10 |  |  |  |  | 170 | push(@tokens, $star); | 
| 950 |  |  |  |  |  |  |  | 
| 951 |  |  |  |  |  |  | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 952 |  |  |  |  |  |  | } | 
| 953 |  |  |  |  |  |  | } | 
| 954 |  |  |  |  |  |  |  | 
| 955 |  |  |  |  |  |  | =item * L<Attean::Algebra::OneOrMorePath> | 
| 956 |  |  |  |  |  |  |  | 
| 957 |  |  |  |  |  |  | =cut | 
| 958 | 50 |  |  | 50 |  | 142672 |  | 
|  | 50 |  |  |  |  | 125 |  | 
|  | 50 |  |  |  |  | 253 |  | 
| 959 | 50 |  |  | 50 |  | 14921 | use Moo; | 
|  | 50 |  |  |  |  | 120 |  | 
|  | 50 |  |  |  |  | 6659 |  | 
| 960 | 50 |  |  | 50 |  | 301 | use AtteanX::SPARQL::Constants; | 
|  | 50 |  |  |  |  | 107 |  | 
|  | 50 |  |  |  |  | 844 |  | 
| 961 | 50 |  |  | 50 |  | 222 | use AtteanX::SPARQL::Token; | 
|  | 50 |  |  |  |  | 88 |  | 
|  | 50 |  |  |  |  | 224 |  | 
| 962 |  |  |  |  |  |  | use Types::Standard qw(ConsumerOf); | 
| 963 |  |  |  |  |  |  | use namespace::clean; | 
| 964 |  |  |  |  |  |  |  | 
| 965 | 5 |  |  | 5 | 0 | 28 | with 'Attean::API::UnaryPropertyPath'; | 
| 966 |  |  |  |  |  |  |  | 
| 967 | 0 |  |  | 0 | 0 | 0 | my $self	= shift; | 
| 968 | 0 |  |  |  |  | 0 | my ($path)	= @{ $self->children }; | 
|  | 0 |  |  |  |  | 0 |  | 
| 969 | 0 |  |  |  |  | 0 | return $self->path->as_sparql . '+'; | 
|  | 0 |  |  |  |  | 0 |  | 
| 970 |  |  |  |  |  |  | } | 
| 971 |  |  |  |  |  |  |  | 
| 972 |  |  |  |  |  |  | my $self	= shift; | 
| 973 | 6 |  |  | 6 | 0 | 1774 | my $plus	= AtteanX::SPARQL::Token->op_plus; | 
| 974 | 6 |  |  |  |  | 40 | my $l		= AtteanX::SPARQL::Token->lparen; | 
| 975 |  |  |  |  |  |  | my $r		= AtteanX::SPARQL::Token->rparen; | 
| 976 | 6 |  |  |  |  | 305 |  | 
| 977 | 6 |  |  |  |  | 10 | my @tokens; | 
|  | 6 |  |  |  |  | 29 |  | 
| 978 | 10 |  |  |  |  | 41 | foreach my $t (@{ $self->children }) { | 
| 979 | 10 |  |  |  |  | 32 | push(@tokens, $t->sparql_tokens->elements); | 
| 980 |  |  |  |  |  |  | } | 
| 981 | 6 |  |  |  |  | 14 |  | 
| 982 | 6 |  |  |  |  | 91 | if (scalar(@tokens) > 1) { | 
| 983 |  |  |  |  |  |  | unshift(@tokens, $l); | 
| 984 |  |  |  |  |  |  | push(@tokens, $r); | 
| 985 |  |  |  |  |  |  | } | 
| 986 |  |  |  |  |  |  | push(@tokens, $plus); | 
| 987 |  |  |  |  |  |  |  | 
| 988 |  |  |  |  |  |  | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 989 |  |  |  |  |  |  | } | 
| 990 |  |  |  |  |  |  | } | 
| 991 | 50 |  |  | 50 |  | 136519 |  | 
|  | 50 |  |  |  |  | 113 |  | 
|  | 50 |  |  |  |  | 257 |  | 
| 992 | 50 |  |  | 50 |  | 15159 | =item * L<Attean::Algebra::ZeroOrOnePath> | 
|  | 50 |  |  |  |  | 119 |  | 
|  | 50 |  |  |  |  | 6647 |  | 
| 993 | 50 |  |  | 50 |  | 304 |  | 
|  | 50 |  |  |  |  | 112 |  | 
|  | 50 |  |  |  |  | 777 |  | 
| 994 | 50 |  |  | 50 |  | 234 | =cut | 
|  | 50 |  |  |  |  | 92 |  | 
|  | 50 |  |  |  |  | 219 |  | 
| 995 |  |  |  |  |  |  |  | 
| 996 |  |  |  |  |  |  | use Moo; | 
| 997 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 998 | 2 |  |  | 2 | 0 | 15 | use AtteanX::SPARQL::Token; | 
| 999 |  |  |  |  |  |  | use Types::Standard qw(ConsumerOf); | 
| 1000 | 0 |  |  | 0 | 0 | 0 | use namespace::clean; | 
| 1001 | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 1002 | 0 |  |  |  |  | 0 | with 'Attean::API::UnaryPropertyPath'; | 
|  | 0 |  |  |  |  | 0 |  | 
| 1003 |  |  |  |  |  |  |  | 
| 1004 |  |  |  |  |  |  | my $self	= shift; | 
| 1005 |  |  |  |  |  |  | my ($path)	= @{ $self->children }; | 
| 1006 | 12 |  |  | 12 | 0 | 2547 | return $self->path->as_sparql . '?'; | 
| 1007 | 12 |  |  |  |  | 98 | } | 
| 1008 |  |  |  |  |  |  |  | 
| 1009 | 12 |  |  |  |  | 597 | my $self	= shift; | 
| 1010 | 12 |  |  |  |  | 34 | my $q		= AtteanX::SPARQL::Token->question; | 
|  | 12 |  |  |  |  | 67 |  | 
| 1011 | 22 |  |  |  |  | 94 | my $l		= AtteanX::SPARQL::Token->lparen; | 
| 1012 | 22 |  |  |  |  | 86 | my $r		= AtteanX::SPARQL::Token->rparen; | 
| 1013 |  |  |  |  |  |  |  | 
| 1014 | 12 |  |  |  |  | 30 | my @tokens; | 
| 1015 | 12 |  |  |  |  | 190 | foreach my $t (@{ $self->children }) { | 
| 1016 |  |  |  |  |  |  | push(@tokens, $t->sparql_tokens->elements); | 
| 1017 |  |  |  |  |  |  | } | 
| 1018 |  |  |  |  |  |  |  | 
| 1019 |  |  |  |  |  |  | if (scalar(@tokens) > 1) { | 
| 1020 |  |  |  |  |  |  | unshift(@tokens, $l); | 
| 1021 |  |  |  |  |  |  | push(@tokens, $r); | 
| 1022 |  |  |  |  |  |  | } | 
| 1023 |  |  |  |  |  |  | push(@tokens, $q); | 
| 1024 | 50 |  |  | 50 |  | 137298 |  | 
|  | 50 |  |  |  |  | 113 |  | 
|  | 50 |  |  |  |  | 304 |  | 
| 1025 | 50 |  |  | 50 |  | 15092 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
|  | 50 |  |  |  |  | 115 |  | 
|  | 50 |  |  |  |  | 6716 |  | 
| 1026 | 50 |  |  | 50 |  | 292 | } | 
|  | 50 |  |  |  |  | 95 |  | 
|  | 50 |  |  |  |  | 957 |  | 
| 1027 | 50 |  |  | 50 |  | 287 | } | 
|  | 50 |  |  |  |  | 96 |  | 
|  | 50 |  |  |  |  | 280 |  | 
| 1028 | 50 |  |  | 50 |  | 22613 |  | 
|  | 50 |  |  |  |  | 119 |  | 
|  | 50 |  |  |  |  | 257 |  | 
| 1029 |  |  |  |  |  |  | =item * L<Attean::Algebra::Table> | 
| 1030 |  |  |  |  |  |  |  | 
| 1031 |  |  |  |  |  |  | =cut | 
| 1032 | 3 |  |  | 3 | 0 | 11 |  | 
| 1033 |  |  |  |  |  |  | use Moo; | 
| 1034 | 0 |  |  | 0 | 0 | 0 | use AtteanX::SPARQL::Constants; | 
| 1035 | 0 |  |  |  |  | 0 | use AtteanX::SPARQL::Token; | 
|  | 0 |  |  |  |  | 0 |  | 
| 1036 | 0 |  |  |  |  | 0 | use Types::Standard qw(ArrayRef ConsumerOf); | 
| 1037 |  |  |  |  |  |  | use namespace::clean; | 
| 1038 |  |  |  |  |  |  |  | 
| 1039 |  |  |  |  |  |  | with 'Attean::API::Algebra', 'Attean::API::NullaryQueryTree'; | 
| 1040 | 2 |  |  | 2 | 0 | 2592 |  | 
| 1041 | 2 |  |  |  |  | 23 | has variables => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::Variable']]); | 
| 1042 | 2 |  |  |  |  | 133 | has rows => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::Result']]); | 
| 1043 | 2 |  |  |  |  | 87 |  | 
| 1044 |  |  |  |  |  |  | my $self	= shift; | 
| 1045 | 2 |  |  |  |  | 80 | return map { $_->value } @{ $self->variables }; | 
| 1046 | 2 |  |  |  |  | 4 | } | 
|  | 2 |  |  |  |  | 17 |  | 
| 1047 | 2 |  |  |  |  | 14 |  | 
| 1048 |  |  |  |  |  |  | my $self	= shift; | 
| 1049 |  |  |  |  |  |  | my $values	= AtteanX::SPARQL::Token->keyword('VALUES'); | 
| 1050 | 2 | 50 |  |  |  | 11 | my $lparen	= AtteanX::SPARQL::Token->lparen; | 
| 1051 | 2 |  |  |  |  | 6 | my $rparen	= AtteanX::SPARQL::Token->rparen; | 
| 1052 | 2 |  |  |  |  | 6 | my $lbrace	= AtteanX::SPARQL::Token->lbrace; | 
| 1053 |  |  |  |  |  |  | my $rbrace	= AtteanX::SPARQL::Token->rbrace; | 
| 1054 | 2 |  |  |  |  | 8 |  | 
| 1055 |  |  |  |  |  |  | my @tokens; | 
| 1056 | 2 |  |  |  |  | 34 | push(@tokens, $values); | 
| 1057 |  |  |  |  |  |  | push(@tokens, $lparen); | 
| 1058 |  |  |  |  |  |  | foreach my $var (@{ $self->variables }) { | 
| 1059 |  |  |  |  |  |  | push(@tokens, $var->sparql_tokens->elements); | 
| 1060 |  |  |  |  |  |  | } | 
| 1061 |  |  |  |  |  |  | push(@tokens, $rparen); | 
| 1062 |  |  |  |  |  |  |  | 
| 1063 |  |  |  |  |  |  | push(@tokens, $lbrace); | 
| 1064 |  |  |  |  |  |  | foreach my $row (@{ $self->rows }) { | 
| 1065 | 50 |  |  | 50 |  | 140021 | push(@tokens, $lparen); | 
|  | 50 |  |  |  |  | 121 |  | 
|  | 50 |  |  |  |  | 247 |  | 
| 1066 | 50 |  |  | 50 |  | 14859 | foreach my $val ($row->values) { | 
|  | 50 |  |  |  |  | 117 |  | 
|  | 50 |  |  |  |  | 6783 |  | 
| 1067 | 50 |  |  | 50 |  | 306 | # TODO: verify correct serialization of UNDEF | 
|  | 50 |  |  |  |  | 99 |  | 
|  | 50 |  |  |  |  | 1001 |  | 
| 1068 | 50 |  |  | 50 |  | 220 | push(@tokens, $val->sparql_tokens->elements); | 
|  | 50 |  |  |  |  | 91 |  | 
|  | 50 |  |  |  |  | 277 |  | 
| 1069 | 50 |  |  | 50 |  | 22784 | } | 
|  | 50 |  |  |  |  | 123 |  | 
|  | 50 |  |  |  |  | 243 |  | 
| 1070 |  |  |  |  |  |  | push(@tokens, $rparen); | 
| 1071 |  |  |  |  |  |  | } | 
| 1072 |  |  |  |  |  |  | push(@tokens, $rbrace); | 
| 1073 | 0 |  |  | 0 | 0 | 0 |  | 
| 1074 |  |  |  |  |  |  | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 1075 | 0 |  |  | 0 | 0 | 0 | } | 
| 1076 | 0 |  |  |  |  | 0 | } | 
|  | 0 |  |  |  |  | 0 |  | 
| 1077 | 0 |  |  |  |  | 0 |  | 
| 1078 |  |  |  |  |  |  | =item * L<Attean::Algebra::Ask> | 
| 1079 |  |  |  |  |  |  |  | 
| 1080 |  |  |  |  |  |  | =cut | 
| 1081 | 2 |  |  | 2 | 0 | 2553 |  | 
| 1082 | 2 |  |  |  |  | 22 | use Moo; | 
| 1083 | 2 |  |  |  |  | 134 | use AtteanX::SPARQL::Constants; | 
| 1084 | 2 |  |  |  |  | 84 | use AtteanX::SPARQL::Token; | 
| 1085 |  |  |  |  |  |  | use namespace::clean; | 
| 1086 | 2 |  |  |  |  | 78 |  | 
| 1087 | 2 |  |  |  |  | 5 | with 'Attean::API::SPARQLQuerySerializable'; | 
|  | 2 |  |  |  |  | 14 |  | 
| 1088 | 2 |  |  |  |  | 12 | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | 
| 1089 |  |  |  |  |  |  |  | 
| 1090 |  |  |  |  |  |  |  | 
| 1091 | 2 | 50 |  |  |  | 11 | } | 
| 1092 | 2 |  |  |  |  | 7 |  | 
| 1093 | 2 |  |  |  |  | 7 | =item * L<Attean::Algebra::Construct> | 
| 1094 |  |  |  |  |  |  |  | 
| 1095 | 2 |  |  |  |  | 6 | =cut | 
| 1096 |  |  |  |  |  |  |  | 
| 1097 | 2 |  |  |  |  | 34 | use Moo; | 
| 1098 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 1099 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 1100 |  |  |  |  |  |  | use Types::Standard qw(ArrayRef ConsumerOf); | 
| 1101 |  |  |  |  |  |  | use namespace::clean; | 
| 1102 |  |  |  |  |  |  |  | 
| 1103 |  |  |  |  |  |  | with 'Attean::API::SPARQLQuerySerializable'; | 
| 1104 |  |  |  |  |  |  | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | 
| 1105 |  |  |  |  |  |  |  | 
| 1106 | 50 |  |  | 50 |  | 139907 | has 'triples' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::TriplePattern']]); | 
|  | 50 |  |  |  |  | 128 |  | 
|  | 50 |  |  |  |  | 249 |  | 
| 1107 | 50 |  |  | 50 |  | 15232 |  | 
|  | 50 |  |  |  |  | 111 |  | 
|  | 50 |  |  |  |  | 6709 |  | 
| 1108 | 50 |  |  | 50 |  | 332 | my $self	= shift; | 
|  | 50 |  |  |  |  | 104 |  | 
|  | 50 |  |  |  |  | 1021 |  | 
| 1109 | 50 |  |  | 50 |  | 249 | my $triples	= $self->triples; | 
|  | 50 |  |  |  |  | 97 |  | 
|  | 50 |  |  |  |  | 273 |  | 
| 1110 | 50 |  |  | 50 |  | 22554 | return sprintf('Construct { %s }', join(' . ', map { $_->as_string } @$triples)); | 
|  | 50 |  |  |  |  | 110 |  | 
|  | 50 |  |  |  |  | 239 |  | 
| 1111 |  |  |  |  |  |  | } | 
| 1112 |  |  |  |  |  |  | } | 
| 1113 |  |  |  |  |  |  |  | 
| 1114 | 0 |  |  | 0 | 0 | 0 | =item * L<Attean::Algebra::Describe> | 
| 1115 |  |  |  |  |  |  |  | 
| 1116 | 0 |  |  | 0 | 0 | 0 | =cut | 
| 1117 | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 1118 | 0 |  |  |  |  | 0 | use Moo; | 
| 1119 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 1120 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 1121 |  |  |  |  |  |  | use Types::Standard qw(ArrayRef ConsumerOf); | 
| 1122 | 2 |  |  | 2 | 0 | 2495 | use namespace::clean; | 
| 1123 | 2 |  |  |  |  | 23 |  | 
| 1124 | 2 |  |  |  |  | 135 | with 'Attean::API::SPARQLQuerySerializable'; | 
| 1125 | 2 |  |  |  |  | 87 | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | 
| 1126 |  |  |  |  |  |  |  | 
| 1127 | 2 |  |  |  |  | 175 | has 'terms' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::TermOrVariable']]); | 
| 1128 | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 15 |  | 
| 1129 | 2 |  |  |  |  | 12 | } | 
| 1130 |  |  |  |  |  |  |  | 
| 1131 |  |  |  |  |  |  | =item * L<Attean::Algebra::Load> | 
| 1132 | 2 | 50 |  |  |  | 12 |  | 
| 1133 | 2 |  |  |  |  | 7 | =cut | 
| 1134 | 2 |  |  |  |  | 6 |  | 
| 1135 |  |  |  |  |  |  | use Moo; | 
| 1136 | 2 |  |  |  |  | 5 | use AtteanX::SPARQL::Constants; | 
| 1137 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 1138 | 2 |  |  |  |  | 34 | use Types::Standard qw(Bool ConsumerOf); | 
| 1139 |  |  |  |  |  |  | use namespace::clean; | 
| 1140 |  |  |  |  |  |  |  | 
| 1141 |  |  |  |  |  |  | with 'Attean::API::Algebra', 'Attean::API::NullaryQueryTree'; | 
| 1142 |  |  |  |  |  |  |  | 
| 1143 |  |  |  |  |  |  | has 'silent' => (is => 'ro', isa => Bool, default => 0); | 
| 1144 |  |  |  |  |  |  | has 'url' => (is => 'ro', isa => ConsumerOf['Attean::API::IRI'], required => 1); | 
| 1145 |  |  |  |  |  |  | has 'graph' => (is => 'ro', isa => ConsumerOf['Attean::API::Term'], predicate => 'has_graph'); | 
| 1146 |  |  |  |  |  |  |  | 
| 1147 | 50 |  |  | 50 |  | 139775 | my $self	= shift; | 
|  | 50 |  |  |  |  | 126 |  | 
|  | 50 |  |  |  |  | 261 |  | 
| 1148 | 50 |  |  | 50 |  | 14943 | return 'Load ' . $self->url->as_string; | 
|  | 50 |  |  |  |  | 108 |  | 
|  | 50 |  |  |  |  | 6819 |  | 
| 1149 | 50 |  |  | 50 |  | 295 | } | 
|  | 50 |  |  |  |  | 120 |  | 
|  | 50 |  |  |  |  | 1052 |  | 
| 1150 | 50 |  |  | 50 |  | 232 |  | 
|  | 50 |  |  |  |  | 106 |  | 
|  | 50 |  |  |  |  | 261 |  | 
| 1151 | 50 |  |  | 50 |  | 26679 | my $self	= shift; | 
|  | 50 |  |  |  |  | 106 |  | 
|  | 50 |  |  |  |  | 240 |  | 
| 1152 |  |  |  |  |  |  |  | 
| 1153 |  |  |  |  |  |  | my @tokens; | 
| 1154 |  |  |  |  |  |  | push(@tokens, AtteanX::SPARQL::Token->keyword('LOAD')); | 
| 1155 |  |  |  |  |  |  | if ($self->silent) { | 
| 1156 |  |  |  |  |  |  | push(@tokens, AtteanX::SPARQL::Token->keyword('SILENT')); | 
| 1157 |  |  |  |  |  |  | } | 
| 1158 |  |  |  |  |  |  | push(@tokens, $self->url->sparql_tokens->elements); | 
| 1159 | 2 |  |  | 2 | 0 | 5 |  | 
| 1160 | 2 |  |  |  |  | 4 | if ($self->has_graph) { | 
|  | 2 |  |  |  |  | 10 |  | 
|  | 2 |  |  |  |  | 9 |  | 
| 1161 |  |  |  |  |  |  | push(@tokens, AtteanX::SPARQL::Token->keyword('INTO')); | 
| 1162 | 0 |  |  | 0 | 0 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('GRAPH')); | 
| 1163 | 1 |  |  | 1 | 0 | 5 | push(@tokens, $self->graph->sparql_tokens->elements); | 
| 1164 |  |  |  |  |  |  | } | 
| 1165 |  |  |  |  |  |  | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 1166 | 2 |  |  | 2 | 0 | 9 | } | 
| 1167 | 2 |  |  |  |  | 15 | } | 
| 1168 | 2 |  |  |  |  | 133 |  | 
| 1169 | 2 |  |  |  |  | 87 | =item * L<Attean::Algebra::Clear> | 
| 1170 | 2 |  |  |  |  | 83 |  | 
| 1171 | 2 |  |  |  |  | 81 | =cut | 
| 1172 |  |  |  |  |  |  |  | 
| 1173 | 2 |  |  |  |  | 76 | use Moo; | 
| 1174 | 2 |  |  |  |  | 5 | use Scalar::Util qw(blessed); | 
| 1175 | 2 |  |  |  |  | 4 | use AtteanX::SPARQL::Constants; | 
| 1176 | 2 |  |  |  |  | 3 | use AtteanX::SPARQL::Token; | 
|  | 2 |  |  |  |  | 9 |  | 
| 1177 | 2 |  |  |  |  | 10 | use Types::Standard qw(Enum Bool ConsumerOf); | 
| 1178 |  |  |  |  |  |  | use namespace::clean; | 
| 1179 | 2 |  |  |  |  | 5 |  | 
| 1180 |  |  |  |  |  |  | with 'Attean::API::Algebra', 'Attean::API::NullaryQueryTree'; | 
| 1181 | 2 |  |  |  |  | 4 |  | 
| 1182 | 2 |  |  |  |  | 4 | has 'drop' => (is => 'ro', isa => Bool, default => 0); | 
|  | 2 |  |  |  |  | 9 |  | 
| 1183 | 4 |  |  |  |  | 6 | has 'silent' => (is => 'ro', isa => Bool, default => 0); | 
| 1184 | 4 |  |  |  |  | 14 | has 'target' => (is => 'ro', isa => Enum[qw(GRAPH DEFAULT NAMED ALL)], required => 1); | 
| 1185 |  |  |  |  |  |  | has 'graph' => (is => 'ro', isa => ConsumerOf['Attean::API::Term']); | 
| 1186 | 4 |  |  |  |  | 23 |  | 
| 1187 |  |  |  |  |  |  | my $self	= shift; | 
| 1188 | 4 |  |  |  |  | 10 | if ($self->target eq 'GRAPH') { | 
| 1189 |  |  |  |  |  |  | unless (blessed($self->graph)) { | 
| 1190 | 2 |  |  |  |  | 4 | die "Attean::Algebra::Clear operations with a GRAPH target must include a graph IRI"; | 
| 1191 |  |  |  |  |  |  | } | 
| 1192 | 2 |  |  |  |  | 31 | } | 
| 1193 |  |  |  |  |  |  | } | 
| 1194 |  |  |  |  |  |  |  | 
| 1195 |  |  |  |  |  |  | my $self	= shift; | 
| 1196 |  |  |  |  |  |  | return $self->drop ? 'Drop' : 'Clear'; | 
| 1197 |  |  |  |  |  |  | } | 
| 1198 |  |  |  |  |  |  |  | 
| 1199 |  |  |  |  |  |  | my $self	= shift; | 
| 1200 |  |  |  |  |  |  |  | 
| 1201 | 50 |  |  | 50 |  | 149205 | my @tokens; | 
|  | 50 |  |  |  |  | 130 |  | 
|  | 50 |  |  |  |  | 301 |  | 
| 1202 | 50 |  |  | 50 |  | 14955 | push(@tokens, AtteanX::SPARQL::Token->keyword($self->drop ? 'DROP' : 'CLEAR')); | 
|  | 50 |  |  |  |  | 115 |  | 
|  | 50 |  |  |  |  | 7089 |  | 
| 1203 | 50 |  |  | 50 |  | 385 | if ($self->silent) { | 
|  | 50 |  |  |  |  | 99 |  | 
|  | 50 |  |  |  |  | 946 |  | 
| 1204 | 50 |  |  | 50 |  | 241 | push(@tokens, AtteanX::SPARQL::Token->keyword('SILENT')); | 
|  | 50 |  |  |  |  | 96 |  | 
|  | 50 |  |  |  |  | 242 |  | 
| 1205 |  |  |  |  |  |  | } | 
| 1206 |  |  |  |  |  |  |  | 
| 1207 |  |  |  |  |  |  | if ($self->target =~ /^(DEFAULT|NAMED|ALL)$/) { | 
| 1208 |  |  |  |  |  |  | push(@tokens, AtteanX::SPARQL::Token->keyword($self->target)); | 
| 1209 | 0 |  |  | 0 | 0 | 0 | } else { | 
| 1210 |  |  |  |  |  |  | push(@tokens, AtteanX::SPARQL::Token->keyword('GRAPH')); | 
| 1211 | 1 |  |  | 1 | 0 | 5 | push(@tokens, $self->graph->sparql_tokens->elements); | 
| 1212 |  |  |  |  |  |  | } | 
| 1213 |  |  |  |  |  |  | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 1214 |  |  |  |  |  |  | } | 
| 1215 |  |  |  |  |  |  | } | 
| 1216 |  |  |  |  |  |  |  | 
| 1217 |  |  |  |  |  |  | =item * L<Attean::Algebra::Create> | 
| 1218 |  |  |  |  |  |  |  | 
| 1219 | 50 |  |  | 50 |  | 130068 | =cut | 
|  | 50 |  |  |  |  | 131 |  | 
|  | 50 |  |  |  |  | 228 |  | 
| 1220 | 50 |  |  | 50 |  | 14597 |  | 
|  | 50 |  |  |  |  | 138 |  | 
|  | 50 |  |  |  |  | 6934 |  | 
| 1221 | 50 |  |  | 50 |  | 295 | use Moo; | 
|  | 50 |  |  |  |  | 122 |  | 
|  | 50 |  |  |  |  | 1019 |  | 
| 1222 | 50 |  |  | 50 |  | 235 | use Scalar::Util qw(blessed); | 
|  | 50 |  |  |  |  | 94 |  | 
|  | 50 |  |  |  |  | 285 |  | 
| 1223 | 50 |  |  | 50 |  | 27301 | use AtteanX::SPARQL::Constants; | 
|  | 50 |  |  |  |  | 111 |  | 
|  | 50 |  |  |  |  | 232 |  | 
| 1224 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 1225 |  |  |  |  |  |  | use Types::Standard qw(Bool ConsumerOf); | 
| 1226 |  |  |  |  |  |  | use namespace::clean; | 
| 1227 |  |  |  |  |  |  |  | 
| 1228 |  |  |  |  |  |  | with 'Attean::API::Algebra', 'Attean::API::NullaryQueryTree'; | 
| 1229 |  |  |  |  |  |  |  | 
| 1230 | 0 |  |  | 0 | 0 | 0 | has 'silent' => (is => 'ro', isa => Bool, default => 0); | 
| 1231 | 0 |  |  | 0 | 0 | 0 | has 'graph' => (is => 'ro', isa => ConsumerOf['Attean::API::Term'], required => 1); | 
| 1232 |  |  |  |  |  |  |  | 
| 1233 | 3 |  |  | 3 | 0 | 7 |  | 
| 1234 | 3 |  |  |  |  | 10 | my $self	= shift; | 
| 1235 | 3 |  |  |  |  | 9 |  | 
|  | 3 |  |  |  |  | 18 |  | 
| 1236 |  |  |  |  |  |  | my @tokens; | 
| 1237 |  |  |  |  |  |  | push(@tokens, AtteanX::SPARQL::Token->keyword('CREATE')); | 
| 1238 |  |  |  |  |  |  | if ($self->silent) { | 
| 1239 |  |  |  |  |  |  | push(@tokens, AtteanX::SPARQL::Token->keyword('SILENT')); | 
| 1240 |  |  |  |  |  |  | } | 
| 1241 |  |  |  |  |  |  | push(@tokens, AtteanX::SPARQL::Token->keyword('GRAPH')); | 
| 1242 |  |  |  |  |  |  | push(@tokens, $self->graph->sparql_tokens->elements); | 
| 1243 |  |  |  |  |  |  | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 1244 | 50 |  |  | 50 |  | 139050 | } | 
|  | 50 |  |  |  |  | 125 |  | 
|  | 50 |  |  |  |  | 568 |  | 
| 1245 | 50 |  |  | 50 |  | 15764 | } | 
|  | 50 |  |  |  |  | 107 |  | 
|  | 50 |  |  |  |  | 6592 |  | 
| 1246 | 50 |  |  | 50 |  | 280 |  | 
|  | 50 |  |  |  |  | 100 |  | 
|  | 50 |  |  |  |  | 1004 |  | 
| 1247 | 50 |  |  | 50 |  | 240 | =item * L<Attean::Algebra::Add> | 
|  | 50 |  |  |  |  | 98 |  | 
|  | 50 |  |  |  |  | 253 |  | 
| 1248 | 50 |  |  | 50 |  | 26589 |  | 
|  | 50 |  |  |  |  | 111 |  | 
|  | 50 |  |  |  |  | 240 |  | 
| 1249 |  |  |  |  |  |  | =cut | 
| 1250 |  |  |  |  |  |  |  | 
| 1251 |  |  |  |  |  |  | use Moo; | 
| 1252 |  |  |  |  |  |  | use Scalar::Util qw(blessed); | 
| 1253 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 1254 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 1255 | 0 |  |  | 0 | 0 | 0 | use Types::Standard qw(Enum Bool ConsumerOf); | 
| 1256 | 0 |  |  | 0 | 0 | 0 | use namespace::clean; | 
| 1257 | 0 |  |  | 0 | 0 | 0 |  | 
| 1258 |  |  |  |  |  |  | with 'Attean::API::Algebra', 'Attean::API::NullaryQueryTree'; | 
| 1259 |  |  |  |  |  |  |  | 
| 1260 |  |  |  |  |  |  | has 'silent' => (is => 'ro', isa => Bool, default => 0); | 
| 1261 |  |  |  |  |  |  | has 'drop_source' => (is => 'ro', isa => Bool, default => 0); | 
| 1262 |  |  |  |  |  |  | has 'drop_destination' => (is => 'ro', isa => Bool, default => 0); | 
| 1263 |  |  |  |  |  |  |  | 
| 1264 |  |  |  |  |  |  | has 'source' => (is => 'ro', isa => ConsumerOf['Attean::API::Term'], predicate => 'has_source'); | 
| 1265 | 50 |  |  | 50 |  | 134323 | has 'destination' => (is => 'ro', isa => ConsumerOf['Attean::API::Term'], predicate => 'has_destination'); | 
|  | 50 |  |  |  |  | 122 |  | 
|  | 50 |  |  |  |  | 262 |  | 
| 1266 | 50 |  |  | 50 |  | 14935 |  | 
|  | 50 |  |  |  |  | 110 |  | 
|  | 50 |  |  |  |  | 6710 |  | 
| 1267 | 50 |  |  | 50 |  | 306 | my $self	= shift; | 
|  | 50 |  |  |  |  | 113 |  | 
|  | 50 |  |  |  |  | 1065 |  | 
| 1268 | 50 |  |  | 50 |  | 236 | return ($self->drop_source and $self->drop_destination) ? 'Move' : ($self->drop_destination) ? 'Copy' : 'Add'; | 
|  | 50 |  |  |  |  | 101 |  | 
|  | 50 |  |  |  |  | 263 |  | 
| 1269 | 50 |  |  | 50 |  | 27024 | } | 
|  | 50 |  |  |  |  | 123 |  | 
|  | 50 |  |  |  |  | 246 |  | 
| 1270 |  |  |  |  |  |  |  | 
| 1271 |  |  |  |  |  |  | my $self	= shift; | 
| 1272 |  |  |  |  |  |  |  | 
| 1273 |  |  |  |  |  |  | my @tokens; | 
| 1274 |  |  |  |  |  |  | my $op	= ($self->drop_source and $self->drop_destination) ? 'MOVE' : ($self->drop_destination) ? 'COPY' : 'ADD'; | 
| 1275 |  |  |  |  |  |  | push(@tokens, AtteanX::SPARQL::Token->keyword($op)); | 
| 1276 |  |  |  |  |  |  | if ($self->silent) { | 
| 1277 | 0 |  |  | 0 | 0 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('SILENT')); | 
| 1278 | 0 |  |  | 0 | 0 | 0 | } | 
| 1279 |  |  |  |  |  |  |  | 
| 1280 | 0 |  |  | 0 | 0 | 0 | if ($self->has_source) { | 
| 1281 | 0 |  |  |  |  | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('GRAPH')); | 
| 1282 |  |  |  |  |  |  | push(@tokens, $self->source->sparql_tokens->elements); | 
| 1283 |  |  |  |  |  |  | } else { | 
| 1284 |  |  |  |  |  |  | push(@tokens, AtteanX::SPARQL::Token->keyword('DEFAULT')); | 
| 1285 | 0 |  |  | 0 | 0 | 0 | } | 
| 1286 |  |  |  |  |  |  |  | 
| 1287 | 0 |  |  |  |  | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('TO')); | 
| 1288 | 0 |  |  |  |  | 0 |  | 
| 1289 | 0 | 0 |  |  |  | 0 | if ($self->has_destination) { | 
| 1290 | 0 |  |  |  |  | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('GRAPH')); | 
| 1291 |  |  |  |  |  |  | push(@tokens, $self->destination->sparql_tokens->elements); | 
| 1292 | 0 |  |  |  |  | 0 | } else { | 
| 1293 |  |  |  |  |  |  | push(@tokens, AtteanX::SPARQL::Token->keyword('DEFAULT')); | 
| 1294 | 0 | 0 |  |  |  | 0 | } | 
| 1295 | 0 |  |  |  |  | 0 |  | 
| 1296 | 0 |  |  |  |  | 0 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
| 1297 | 0 |  |  |  |  | 0 | } | 
| 1298 |  |  |  |  |  |  | } | 
| 1299 | 0 |  |  |  |  | 0 |  | 
| 1300 |  |  |  |  |  |  | =item * L<Attean::Algebra::Modify> | 
| 1301 |  |  |  |  |  |  |  | 
| 1302 |  |  |  |  |  |  | =cut | 
| 1303 |  |  |  |  |  |  |  | 
| 1304 |  |  |  |  |  |  | use Moo; | 
| 1305 |  |  |  |  |  |  | use Scalar::Util qw(blessed); | 
| 1306 |  |  |  |  |  |  | use AtteanX::SPARQL::Constants; | 
| 1307 |  |  |  |  |  |  | use AtteanX::SPARQL::Token; | 
| 1308 | 50 |  |  | 50 |  | 142099 | use List::MoreUtils qw(all any); | 
|  | 50 |  |  |  |  | 127 |  | 
|  | 50 |  |  |  |  | 239 |  | 
| 1309 | 50 |  |  | 50 |  | 16114 | use Types::Standard qw(HashRef ArrayRef ConsumerOf); | 
|  | 50 |  |  |  |  | 141 |  | 
|  | 50 |  |  |  |  | 2277 |  | 
| 1310 | 50 |  |  | 50 |  | 267 | use namespace::clean; | 
|  | 50 |  |  |  |  | 104 |  | 
|  | 50 |  |  |  |  | 6709 |  | 
| 1311 | 50 |  |  | 50 |  | 333 |  | 
|  | 50 |  |  |  |  | 138 |  | 
|  | 50 |  |  |  |  | 1129 |  | 
| 1312 | 50 |  |  | 50 |  | 250 | with 'Attean::API::Algebra', 'Attean::API::QueryTree'; | 
|  | 50 |  |  |  |  | 102 |  | 
|  | 50 |  |  |  |  | 288 |  | 
| 1313 | 50 |  |  | 50 |  | 33436 |  | 
|  | 50 |  |  |  |  | 112 |  | 
|  | 50 |  |  |  |  | 232 |  | 
| 1314 |  |  |  |  |  |  | has 'dataset' => (is => 'ro', isa => HashRef, default => sub { +{} }); | 
| 1315 |  |  |  |  |  |  | has 'insert' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::TripleOrQuadPattern']], default => sub { [] }); | 
| 1316 |  |  |  |  |  |  | has 'delete' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::TripleOrQuadPattern']], default => sub { [] }); | 
| 1317 |  |  |  |  |  |  |  | 
| 1318 |  |  |  |  |  |  |  | 
| 1319 |  |  |  |  |  |  | my $self	= shift; | 
| 1320 |  |  |  |  |  |  | my $i		= scalar(@{ $self->insert }); | 
| 1321 |  |  |  |  |  |  | my $d		= scalar(@{ $self->delete }); | 
| 1322 |  |  |  |  |  |  | my $w		= scalar(@{ $self->children }); | 
| 1323 | 0 |  |  | 0 | 0 | 0 | my $ig		= all { $_->is_ground } @{ $self->insert }; | 
| 1324 | 0 | 0 |  |  |  | 0 | my $dg		= all { $_->is_ground } @{ $self->delete }; | 
| 1325 | 0 | 0 |  |  |  | 0 | if ($i and not $d) { | 
| 1326 | 0 |  |  |  |  | 0 | # INSERT | 
| 1327 |  |  |  |  |  |  | return ($ig and not $w) ? 'ID' : 'I'; | 
| 1328 |  |  |  |  |  |  | } elsif ($d and not $i) { | 
| 1329 |  |  |  |  |  |  | # DELETE | 
| 1330 |  |  |  |  |  |  | return ($dg and not $w) ? 'DD' : 'D'; | 
| 1331 | 0 |  |  | 0 | 0 | 0 | } else { | 
| 1332 | 0 |  |  | 0 | 0 | 0 | # INSERT + DELETE | 
| 1333 |  |  |  |  |  |  | return 'U' | 
| 1334 | 0 |  |  | 0 | 0 | 0 | } | 
| 1335 | 0 | 0 |  |  |  | 0 | } | 
| 1336 |  |  |  |  |  |  |  | 
| 1337 |  |  |  |  |  |  | around 'blank_nodes' => sub { | 
| 1338 |  |  |  |  |  |  | my $orig	= shift; | 
| 1339 | 0 |  |  | 0 | 0 | 0 | my $self	= shift; | 
| 1340 |  |  |  |  |  |  | my @blanks	= $orig->($self, @_); | 
| 1341 | 0 |  |  |  |  | 0 | my %seen	= map { $_->value => 1 } @blanks; | 
| 1342 | 0 | 0 |  |  |  | 0 | foreach my $data ($self->insert, $self->delete) { | 
| 1343 | 0 | 0 |  |  |  | 0 | my @triples	= @{ $data }; | 
| 1344 | 0 |  |  |  |  | 0 | my @b	= grep { $_->does('Attean::API::Blank') } map { $_->values } @triples; | 
| 1345 |  |  |  |  |  |  | push(@blanks, grep { not $seen{$_->value}++ } @b); | 
| 1346 |  |  |  |  |  |  | } | 
| 1347 | 0 | 0 |  |  |  | 0 | return @blanks; | 
| 1348 | 0 |  |  |  |  | 0 | }; | 
| 1349 |  |  |  |  |  |  |  | 
| 1350 | 0 |  |  |  |  | 0 | my $self	= shift; | 
| 1351 | 0 |  |  |  |  | 0 | my $level	= shift; | 
| 1352 |  |  |  |  |  |  | my $indent	= '  ' x ($level + 1); | 
| 1353 | 0 |  |  |  |  | 0 | state $S	= { | 
| 1354 |  |  |  |  |  |  | 'ID'	=> 'Insert Data', | 
| 1355 |  |  |  |  |  |  | 'I'		=> 'Insert', | 
| 1356 |  |  |  |  |  |  | 'DD'	=> 'Delete Data', | 
| 1357 |  |  |  |  |  |  | 'D'		=> 'Delete', | 
| 1358 |  |  |  |  |  |  | 'U'		=> 'Update', | 
| 1359 |  |  |  |  |  |  | }; | 
| 1360 |  |  |  |  |  |  | my $op	= $self->_op_type(); | 
| 1361 |  |  |  |  |  |  | my $s	= $S->{ $op }; | 
| 1362 | 50 |  |  | 50 |  | 153084 | my @data; | 
|  | 50 |  |  |  |  | 123 |  | 
|  | 50 |  |  |  |  | 253 |  | 
| 1363 | 50 |  |  | 50 |  | 14973 | my $ic	= scalar(@{ $self->insert }); | 
|  | 50 |  |  |  |  | 120 |  | 
|  | 50 |  |  |  |  | 2137 |  | 
| 1364 | 50 |  |  | 50 |  | 271 | my $dc	= scalar(@{ $self->delete }); | 
|  | 50 |  |  |  |  | 102 |  | 
|  | 50 |  |  |  |  | 7393 |  | 
| 1365 | 50 |  |  | 50 |  | 350 | if ($ic) { | 
|  | 50 |  |  |  |  | 110 |  | 
|  | 50 |  |  |  |  | 1042 |  | 
| 1366 | 50 |  |  | 50 |  | 259 | my $name	= $dc ? 'Insert Data' : 'Data'; | 
|  | 50 |  |  |  |  | 100 |  | 
|  | 50 |  |  |  |  | 278 |  | 
| 1367 | 50 |  |  | 50 |  | 27006 | push(@data, [$name, $self->insert]); | 
|  | 50 |  |  |  |  | 110 |  | 
|  | 50 |  |  |  |  | 264 |  | 
| 1368 |  |  |  |  |  |  | } | 
| 1369 |  |  |  |  |  |  | if ($dc) { | 
| 1370 |  |  |  |  |  |  | my $name	= $ic ? 'Delete Data' : 'Data'; | 
| 1371 |  |  |  |  |  |  | push(@data, [$name, $self->delete]); | 
| 1372 |  |  |  |  |  |  | } | 
| 1373 |  |  |  |  |  |  | foreach my $data (@data) { | 
| 1374 | 0 |  |  | 0 | 0 | 0 | my ($name, $quads)	= @$data; | 
| 1375 | 0 |  |  | 0 | 0 | 0 | $s	.= "\n-${indent} $name"; | 
| 1376 | 0 |  |  | 0 | 0 | 0 | foreach my $q (@$quads) { | 
| 1377 |  |  |  |  |  |  | $s	.= "\n-${indent}   " . $q->as_string; | 
| 1378 |  |  |  |  |  |  | } | 
| 1379 | 0 |  |  | 0 | 0 | 0 | } | 
| 1380 |  |  |  |  |  |  | return $s; | 
| 1381 | 0 |  |  |  |  | 0 | } | 
| 1382 | 0 |  |  |  |  | 0 |  | 
| 1383 | 0 | 0 |  |  |  | 0 | my $self	= shift; | 
| 1384 | 0 |  |  |  |  | 0 | my $op		= $self->_op_type(); | 
| 1385 |  |  |  |  |  |  | my $l		= AtteanX::SPARQL::Token->lbrace; | 
| 1386 | 0 |  |  |  |  | 0 | my $r		= AtteanX::SPARQL::Token->rbrace; | 
| 1387 | 0 |  |  |  |  | 0 | my $dot		= AtteanX::SPARQL::Token->dot; | 
| 1388 | 0 |  |  |  |  | 0 | my $data	= AtteanX::SPARQL::Token->keyword('DATA'); | 
| 1389 |  |  |  |  |  |  | my $insert	= AtteanX::SPARQL::Token->keyword('INSERT'); | 
| 1390 |  |  |  |  |  |  | my $delete	= AtteanX::SPARQL::Token->keyword('DELETE'); | 
| 1391 |  |  |  |  |  |  | my $where	= AtteanX::SPARQL::Token->keyword('WHERE'); | 
| 1392 |  |  |  |  |  |  | my $using	= AtteanX::SPARQL::Token->keyword('USING'); | 
| 1393 |  |  |  |  |  |  | my $named	= AtteanX::SPARQL::Token->keyword('NAMED'); | 
| 1394 |  |  |  |  |  |  |  | 
| 1395 |  |  |  |  |  |  | # TODO: Support 'DELETE WHERE' shortcut syntax | 
| 1396 |  |  |  |  |  |  | # TODO: Support WITH | 
| 1397 | 50 |  |  | 50 |  | 142376 |  | 
|  | 50 |  |  |  |  | 152 |  | 
|  | 50 |  |  |  |  | 277 |  | 
| 1398 | 50 |  |  | 50 |  | 15904 | my @dataset; | 
|  | 50 |  |  |  |  | 120 |  | 
|  | 50 |  |  |  |  | 2056 |  | 
| 1399 | 50 |  |  | 50 |  | 297 | my $dataset	= $self->dataset; | 
|  | 50 |  |  |  |  | 97 |  | 
|  | 50 |  |  |  |  | 6522 |  | 
| 1400 | 50 |  |  | 50 |  | 309 | my @default	= @{ $dataset->{default} || [] }; | 
|  | 50 |  |  |  |  | 102 |  | 
|  | 50 |  |  |  |  | 1185 |  | 
| 1401 | 50 |  |  | 50 |  | 246 | my @named	= values %{ $dataset->{named} || {} }; | 
|  | 50 |  |  |  |  | 98 |  | 
|  | 50 |  |  |  |  | 280 |  | 
| 1402 | 50 |  |  | 50 |  | 31746 | if (scalar(@default) or scalar(@named)) { | 
|  | 50 |  |  |  |  | 110 |  | 
|  | 50 |  |  |  |  | 243 |  | 
| 1403 |  |  |  |  |  |  | foreach my $g (sort { $a->as_string cmp $b->as_string } @default) { | 
| 1404 |  |  |  |  |  |  | push(@dataset, $using, $g->sparql_tokens->elements); | 
| 1405 |  |  |  |  |  |  | } | 
| 1406 |  |  |  |  |  |  | foreach my $g (sort { $a->as_string cmp $b->as_string } @named) { | 
| 1407 |  |  |  |  |  |  | push(@dataset, $using, $named, $g->sparql_tokens->elements); | 
| 1408 |  |  |  |  |  |  | } | 
| 1409 |  |  |  |  |  |  | } | 
| 1410 |  |  |  |  |  |  |  | 
| 1411 |  |  |  |  |  |  | my @tokens; | 
| 1412 |  |  |  |  |  |  | if ($op eq 'ID' or $op eq 'DD') { | 
| 1413 | 1 |  |  | 1 | 0 | 7 | my $statements	= ($op eq 'ID') ? $self->insert : $self->delete; | 
| 1414 | 0 |  |  | 0 | 0 | 0 | my $kw	= ($op eq 'ID') ? $insert : $delete; | 
| 1415 |  |  |  |  |  |  | push(@tokens, $kw); | 
| 1416 | 3 |  |  | 3 | 0 | 6 | push(@tokens, $data); | 
| 1417 | 3 | 50 | 33 |  |  | 32 | push(@tokens, $l); | 
|  |  | 50 |  |  |  |  |  | 
| 1418 |  |  |  |  |  |  | foreach my $t (@{ $statements }) { | 
| 1419 |  |  |  |  |  |  | push(@tokens, $t->sparql_tokens->elements); | 
| 1420 |  |  |  |  |  |  | push(@tokens, $dot); | 
| 1421 | 0 |  |  | 0 | 0 | 0 | } | 
| 1422 |  |  |  |  |  |  | push(@tokens, $r); | 
| 1423 | 0 |  |  |  |  | 0 | } elsif ($op eq 'I' or $op eq 'D') { | 
| 1424 | 0 | 0 | 0 |  |  | 0 | my $statements	= ($op eq 'I') ? $self->insert : $self->delete; | 
|  |  | 0 |  |  |  |  |  | 
| 1425 | 0 |  |  |  |  | 0 | my $kw	= ($op eq 'I') ? $insert : $delete; | 
| 1426 | 0 | 0 |  |  |  | 0 | push(@tokens, $kw); | 
| 1427 | 0 |  |  |  |  | 0 | push(@tokens, $l); | 
| 1428 |  |  |  |  |  |  | foreach my $t (@{ $statements }) { | 
| 1429 |  |  |  |  |  |  | push(@tokens, $t->sparql_tokens->elements); | 
| 1430 | 0 | 0 |  |  |  | 0 | push(@tokens, $dot); | 
| 1431 | 0 |  |  |  |  | 0 | } | 
| 1432 | 0 |  |  |  |  | 0 | push(@tokens, $r); | 
| 1433 |  |  |  |  |  |  | push(@tokens, @dataset); | 
| 1434 | 0 |  |  |  |  | 0 | push(@tokens, $where); | 
| 1435 |  |  |  |  |  |  | push(@tokens, $l); | 
| 1436 |  |  |  |  |  |  | foreach my $c (@{ $self->children }) { | 
| 1437 | 0 |  |  |  |  | 0 | push(@tokens, $c->sparql_tokens->elements); | 
| 1438 |  |  |  |  |  |  | } | 
| 1439 | 0 | 0 |  |  |  | 0 | push(@tokens, $r); | 
| 1440 | 0 |  |  |  |  | 0 | } else { | 
| 1441 | 0 |  |  |  |  | 0 | foreach my $x ([$delete, $self->delete], [$insert, $self->insert]) { | 
| 1442 |  |  |  |  |  |  | my ($kw, $statements)	= @$x; | 
| 1443 | 0 |  |  |  |  | 0 | push(@tokens, $kw); | 
| 1444 |  |  |  |  |  |  | push(@tokens, $l); | 
| 1445 |  |  |  |  |  |  | foreach my $t (@{ $statements }) { | 
| 1446 | 0 |  |  |  |  | 0 | push(@tokens, $t->sparql_tokens->elements); | 
| 1447 |  |  |  |  |  |  | push(@tokens, $dot); | 
| 1448 |  |  |  |  |  |  | } | 
| 1449 |  |  |  |  |  |  | push(@tokens, $r); | 
| 1450 |  |  |  |  |  |  | } | 
| 1451 |  |  |  |  |  |  | push(@tokens, @dataset); | 
| 1452 |  |  |  |  |  |  | push(@tokens, $where); | 
| 1453 |  |  |  |  |  |  | push(@tokens, $l); | 
| 1454 |  |  |  |  |  |  | foreach my $c (@{ $self->children }) { | 
| 1455 | 50 |  |  | 50 |  | 151050 | push(@tokens, $c->sparql_tokens->elements); | 
|  | 50 |  |  |  |  | 116 |  | 
|  | 50 |  |  |  |  | 241 |  | 
| 1456 | 50 |  |  | 50 |  | 15693 | } | 
|  | 50 |  |  |  |  | 123 |  | 
|  | 50 |  |  |  |  | 2139 |  | 
| 1457 | 50 |  |  | 50 |  | 297 | push(@tokens, $r); | 
|  | 50 |  |  |  |  | 122 |  | 
|  | 50 |  |  |  |  | 7083 |  | 
| 1458 | 50 |  |  | 50 |  | 335 | } | 
|  | 50 |  |  |  |  | 125 |  | 
|  | 50 |  |  |  |  | 1175 |  | 
| 1459 | 50 |  |  | 50 |  | 257 |  | 
|  | 50 |  |  |  |  | 96 |  | 
|  | 50 |  |  |  |  | 491 |  | 
| 1460 | 50 |  |  | 50 |  | 50961 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | 
|  | 50 |  |  |  |  | 111 |  | 
|  | 50 |  |  |  |  | 240 |  | 
| 1461 | 50 |  |  | 50 |  | 32150 | } | 
|  | 50 |  |  |  |  | 106 |  | 
|  | 50 |  |  |  |  | 250 |  | 
| 1462 |  |  |  |  |  |  | } | 
| 1463 |  |  |  |  |  |  |  | 
| 1464 |  |  |  |  |  |  | 1; | 
| 1465 |  |  |  |  |  |  |  | 
| 1466 |  |  |  |  |  |  |  | 
| 1467 |  |  |  |  |  |  | =back | 
| 1468 |  |  |  |  |  |  |  | 
| 1469 | 1 |  |  | 1 | 0 | 8 | =head1 BUGS | 
| 1470 | 0 |  |  | 0 | 0 | 0 |  | 
| 1471 |  |  |  |  |  |  | Please report any bugs or feature requests to through the GitHub web interface | 
| 1472 |  |  |  |  |  |  | at L<https://github.com/kasei/attean/issues>. | 
| 1473 | 8 |  |  | 8 |  | 21 |  | 
| 1474 | 8 |  |  |  |  | 14 | =head1 SEE ALSO | 
|  | 8 |  |  |  |  | 33 |  | 
| 1475 | 8 |  |  |  |  | 16 |  | 
|  | 8 |  |  |  |  | 29 |  | 
| 1476 | 8 |  |  |  |  | 17 |  | 
|  | 8 |  |  |  |  | 29 |  | 
| 1477 | 8 |  |  | 2 |  | 52 |  | 
|  | 2 |  |  |  |  | 15 |  | 
|  | 8 |  |  |  |  | 95 |  | 
| 1478 | 8 |  |  | 6 |  | 50 | =head1 AUTHOR | 
|  | 6 |  |  |  |  | 46 |  | 
|  | 8 |  |  |  |  | 51 |  | 
| 1479 | 8 | 100 | 66 |  |  | 79 |  | 
|  |  | 50 | 33 |  |  |  |  | 
| 1480 |  |  |  |  |  |  | Gregory Todd Williams  C<< <gwilliams@cpan.org> >> | 
| 1481 | 2 | 100 | 66 |  |  | 14 |  | 
| 1482 |  |  |  |  |  |  | =head1 COPYRIGHT | 
| 1483 |  |  |  |  |  |  |  | 
| 1484 | 6 | 100 | 66 |  |  | 33 | Copyright (c) 2014--2022 Gregory Todd Williams. | 
| 1485 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify it under | 
| 1486 |  |  |  |  |  |  | the same terms as Perl itself. | 
| 1487 | 0 |  |  |  |  | 0 |  | 
| 1488 |  |  |  |  |  |  | =cut |