| 1 | 50 | ▶ | use v5.14; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 2 | 50 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 3 | 50 | ▶ | use utf8; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 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.040 | ||||||||||||||||||||||||||||||||
| 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 | ▶ | use Attean::API::Query; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||
| 29 | 50 | package Attean::Algebra::Query 0.040 { | |||||||||||||||||||||||||||||||
| 30 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 31 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 32 | 50 | ▶ | use Types::Standard qw(Bool ArrayRef HashRef ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 33 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 34 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||
| 36 | 1 | ▶ | has 'dataset' => (is => 'ro', isa => HashRef[ArrayRef[ConsumerOf['Attean::API::Term']]], default => sub { +{} }); | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 37 | 50 | has 'subquery' => (is => 'ro', isa => Bool, default => 0); | |||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||
| 39 | 50 | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | |||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||
| 41 | 9 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=7 SCAR=27.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 42 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||
| 43 | 9 | ▶ | my $name = $self->subquery ? 'SubQuery' : 'Query'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||
| 45 | 9 | my %dataset = %{ $self->dataset }; | |||||||||||||||||||||||||||||||
| 46 | 9 | ▶ | my @default = @{ $dataset{ default } || [] }; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$dataset{'default'} || []
MC/DC0%0/1
$dataset{'default'} || []
$dataset{'default'}
Truth table50%1/2
A
A= $dataset{'default'}
| |||||||||||||||||||||||||||||||||
| 47 | 9 | ▶ | my @named = @{ $dataset{ named } || [] }; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$dataset{'named'} || []
MC/DC0%0/1
$dataset{'named'} || []
$dataset{'named'}
Truth table50%1/2
A
A= $dataset{'named'}
| |||||||||||||||||||||||||||||||||
| 48 | 9 | my $has_dataset = (scalar(@default) + scalar(@named)); | |||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | 9 | my $s = $name; | |||||||||||||||||||||||||||||||
| 51 | 9 | ▶ | if ($has_dataset) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 52 | 0 | my @parts; | |||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | if (scalar(@default)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 54 | 0 | push(@parts, 'Default graph(s): ' . join(', ', map { chomp; $_ } map { $_->as_sparql } @default)); | |||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | if (scalar(@named)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 57 | 0 | push(@parts, 'Named graph(s): ' . join(', ', map { chomp; $_ } map { $_->as_sparql } @named)); | |||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||
| 59 | 0 | $s .= ' { ' . join('; ', @parts) . ' }'; | |||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||
| 61 | 9 | return $s; | |||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||
| 64 | 8 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=11 SCAR=26.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 65 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||
| 66 | 8 | my $child = $self->child; | |||||||||||||||||||||||||||||||
| 67 | 8 | my $l = AtteanX::SPARQL::Token->lbrace; | |||||||||||||||||||||||||||||||
| 68 | 8 | my $r = AtteanX::SPARQL::Token->rbrace; | |||||||||||||||||||||||||||||||
| 69 | 8 | my $from = AtteanX::SPARQL::Token->keyword('FROM'); | |||||||||||||||||||||||||||||||
| 70 | 8 | my $named = AtteanX::SPARQL::Token->keyword('NAMED'); | |||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | 8 | my %dataset = %{ $self->dataset }; | |||||||||||||||||||||||||||||||
| 73 | 8 | ▶ | my @default = @{ $dataset{ default } || [] }; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$dataset{'default'} || []
MC/DC100%1/1
$dataset{'default'} || []
$dataset{'default'}
Truth table100%2/2
A
A= $dataset{'default'}
| |||||||||||||||||||||||||||||||||
| 74 | 8 | ▶ | my @named = @{ $dataset{ named } || [] }; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$dataset{'named'} || []
MC/DC100%1/1
$dataset{'named'} || []
$dataset{'named'}
Truth table100%2/2
A
A= $dataset{'named'}
| |||||||||||||||||||||||||||||||||
| 75 | 8 | my $has_dataset = (scalar(@default) + scalar(@named)); | |||||||||||||||||||||||||||||||
| 76 | 8 | ▶ | if ($child->does('Attean::API::SPARQLQuerySerializable')) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 77 | 7 | ▶ | if ($self->subquery) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 78 | 0 | my @tokens; | |||||||||||||||||||||||||||||||
| 79 | 0 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 80 | 0 | push(@tokens, $child->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 81 | 0 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 82 | 0 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 83 | } else { | ||||||||||||||||||||||||||||||||
| 84 | 7 | my %args; | |||||||||||||||||||||||||||||||
| 85 | 7 | ▶ | if ($has_dataset) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 86 | 4 | $args{dataset} = $self->dataset; | |||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||
| 88 | 7 | return $child->query_tokens(%args); | |||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||
| 90 | } else { | ||||||||||||||||||||||||||||||||
| 91 | 1 | my $sel = AtteanX::SPARQL::Token->keyword('SELECT'); | |||||||||||||||||||||||||||||||
| 92 | 1 | my $star = AtteanX::SPARQL::Token->star; | |||||||||||||||||||||||||||||||
| 93 | 1 | my $where = AtteanX::SPARQL::Token->keyword('WHERE'); | |||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||
| 95 | 1 | my @tokens; | |||||||||||||||||||||||||||||||
| 96 | 1 | ▶ | if ($self->subquery) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 97 | 0 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||
| 99 | 1 | push(@tokens, $sel, $star); | |||||||||||||||||||||||||||||||
| 100 | 1 | ▶ | if ($has_dataset) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 101 | 0 | foreach my $i (sort { $a->as_string cmp $b->as_string } @default) { | |||||||||||||||||||||||||||||||
| 102 | 0 | push(@tokens, $from); | |||||||||||||||||||||||||||||||
| 103 | 0 | push(@tokens, $i->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||
| 105 | 0 | foreach my $i (sort { $a->as_string cmp $b->as_string } @named) { | |||||||||||||||||||||||||||||||
| 106 | 0 | push(@tokens, $from); | |||||||||||||||||||||||||||||||
| 107 | 0 | push(@tokens, $named); | |||||||||||||||||||||||||||||||
| 108 | 0 | push(@tokens, $i->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||
| 111 | 1 | push(@tokens, $where); | |||||||||||||||||||||||||||||||
| 112 | 1 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 113 | 1 | push(@tokens, $child->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 114 | 1 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 115 | 1 | ▶ | if ($self->subquery) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 116 | 0 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||
| 118 | 1 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||
| 123 | 50 | package Attean::Algebra::Update 0.040 { | |||||||||||||||||||||||||||||||
| 124 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 125 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 126 | 50 | ▶ | use Types::Standard qw(Bool); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 127 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 128 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||
| 130 | 50 | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | |||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||
| 132 | 3 | ▶ | sub algebra_as_string { return 'Update' } | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||
| 134 | 6 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 135 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||
| 136 | 6 | my $child = $self->child; | |||||||||||||||||||||||||||||||
| 137 | 6 | return $child->sparql_tokens; | |||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||
| 141 | =item * L<Attean::Algebra::Sequence> | ||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||
| 143 | =cut | ||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||
| 145 | 50 | package Attean::Algebra::Sequence 0.040 { | |||||||||||||||||||||||||||||||
| 146 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 147 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 148 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 149 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||
| 151 | 50 | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::QueryTree'; | |||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | sub arity { | ||||||||||||||||||||||||||||||
|
Subroutine
arity: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 154 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 155 | 0 | return scalar(@{ $self->children }); | |||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||
| 158 | 1 | ▶ | sub algebra_as_string { return 'Sequence' } | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||
| 160 | 1 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 161 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||
| 162 | 1 | my $semi = AtteanX::SPARQL::Token->semicolon; | |||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||
| 164 | 1 | my @tokens; | |||||||||||||||||||||||||||||||
| 165 | 1 | foreach my $t (@{ $self->children }) { | |||||||||||||||||||||||||||||||
| 166 | 2 | push(@tokens, $t->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 167 | 2 | push(@tokens, $semi); | |||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||
| 169 | 1 | pop(@tokens); # remove last SEMICOLON token | |||||||||||||||||||||||||||||||
| 170 | 1 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||
| 174 | =item * L<Attean::Algebra::Join> | ||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||
| 176 | =cut | ||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||
| 178 | 50 | package Attean::Algebra::Join 0.040 { | |||||||||||||||||||||||||||||||
| 179 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 180 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 181 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 182 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||
| 184 | 50 | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::QueryTree'; | |||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||
| 186 | 2 | ▶ | sub algebra_as_string { return 'Join' } | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||
| 188 | 5 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 189 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||
| 190 | 5 | my $l = AtteanX::SPARQL::Token->lbrace; | |||||||||||||||||||||||||||||||
| 191 | 5 | my $r = AtteanX::SPARQL::Token->rbrace; | |||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||
| 193 | 5 | my @tokens; | |||||||||||||||||||||||||||||||
| 194 | 5 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 195 | 5 | foreach my $t (@{ $self->children }) { | |||||||||||||||||||||||||||||||
| 196 | 8 | push(@tokens, $t->sparql_subtokens->elements); | |||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||
| 198 | 5 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 199 | 5 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||
| 203 | =item * L<Attean::Algebra::LeftJoin> | ||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||
| 205 | =cut | ||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||
| 207 | 50 | package Attean::Algebra::LeftJoin 0.040 { | |||||||||||||||||||||||||||||||
| 208 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 209 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 210 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 211 | 50 | ▶ | use Types::Standard qw(ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 212 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||
| 214 | 50 | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::BinaryQueryTree'; | |||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||
| 216 | 2 | ▶ | has 'expression' => (is => 'ro', isa => ConsumerOf['Attean::API::Expression'], required => 1, default => sub { Attean::ValueExpression->new( value => Attean::Literal->true ) }); | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 218 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 219 | 0 | return sprintf('LeftJoin { %s }', $self->expression->as_string); | |||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | sub tree_attributes { return qw(expression) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 222 | 4 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 223 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||
| 224 | 4 | my $opt = AtteanX::SPARQL::Token->keyword('OPTIONAL'); | |||||||||||||||||||||||||||||||
| 225 | 4 | my $l = AtteanX::SPARQL::Token->lbrace; | |||||||||||||||||||||||||||||||
| 226 | 4 | my $r = AtteanX::SPARQL::Token->rbrace; | |||||||||||||||||||||||||||||||
| 227 | 4 | my ($lhs, $rhs) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||
| 229 | 4 | my @tokens; | |||||||||||||||||||||||||||||||
| 230 | 4 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 231 | 4 | push(@tokens, $lhs->sparql_subtokens->elements); | |||||||||||||||||||||||||||||||
| 232 | 4 | push(@tokens, $r, $opt, $l); | |||||||||||||||||||||||||||||||
| 233 | 4 | push(@tokens, $rhs->sparql_subtokens->elements); | |||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||
| 235 | 4 | my $expr = $self->expression; | |||||||||||||||||||||||||||||||
| 236 | 4 | my $is_true = 0; | |||||||||||||||||||||||||||||||
| 237 | 4 | ▶ | if ($expr->isa('Attean::ValueExpression')) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 238 | 2 | my $value = $expr->value; | |||||||||||||||||||||||||||||||
| 239 | 2 | ▶ | if ($value->equals(Attean::Literal->true)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 240 | 2 | $is_true = 1; | |||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||
| 244 | 4 | ▶ | unless ($is_true) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 245 | 2 | my $f = AtteanX::SPARQL::Token->keyword('FILTER'); | |||||||||||||||||||||||||||||||
| 246 | 2 | my $lparen = AtteanX::SPARQL::Token->lparen; | |||||||||||||||||||||||||||||||
| 247 | 2 | my $rparen = AtteanX::SPARQL::Token->rparen; | |||||||||||||||||||||||||||||||
| 248 | 2 | push(@tokens, $f); | |||||||||||||||||||||||||||||||
| 249 | 2 | push(@tokens, $lparen); | |||||||||||||||||||||||||||||||
| 250 | 2 | push(@tokens, $expr->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 251 | 2 | push(@tokens, $rparen); | |||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||
| 254 | 4 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 255 | 4 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||
| 260 | =item * L<Attean::Algebra::Filter> | ||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||
| 262 | =cut | ||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||
| 264 | 50 | package Attean::Algebra::Filter 0.040 { | |||||||||||||||||||||||||||||||
| 265 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 266 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 267 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 268 | 50 | ▶ | use Types::Standard qw(ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 269 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||
| 271 | 50 | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | |||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||
| 273 | 50 | has 'expression' => (is => 'ro', isa => ConsumerOf['Attean::API::Expression'], required => 1); | |||||||||||||||||||||||||||||||
| 274 | 2 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 275 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 276 | 2 | return sprintf('Filter { %s }', $self->expression->as_string); | |||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | sub tree_attributes { return qw(expression) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 279 | 4 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 280 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||
| 281 | 4 | my $f = AtteanX::SPARQL::Token->keyword('FILTER'); | |||||||||||||||||||||||||||||||
| 282 | 4 | my $l = AtteanX::SPARQL::Token->lparen; | |||||||||||||||||||||||||||||||
| 283 | 4 | my $r = AtteanX::SPARQL::Token->rparen; | |||||||||||||||||||||||||||||||
| 284 | 4 | my ($child) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 285 | 4 | my $expr = $self->expression; | |||||||||||||||||||||||||||||||
| 286 | 4 | my @tokens; | |||||||||||||||||||||||||||||||
| 287 | 4 | push(@tokens, $child->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 288 | 4 | push(@tokens, $f); | |||||||||||||||||||||||||||||||
| 289 | 4 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 290 | 4 | push(@tokens, $expr->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 291 | 4 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 292 | 4 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||
| 296 | =item * L<Attean::Algebra::Union> | ||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||
| 298 | =cut | ||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||
| 300 | 50 | package Attean::Algebra::Union 0.040 { | |||||||||||||||||||||||||||||||
| 301 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 302 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 303 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 304 | 50 | ▶ | use Types::Standard qw(ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 305 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||
| 307 | 50 | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::BinaryQueryTree'; | |||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||
| 309 | 1 | ▶ | sub algebra_as_string { return 'Union' } | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 310 | 2 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 311 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 312 | 2 | my $union = AtteanX::SPARQL::Token->keyword('UNION'); | |||||||||||||||||||||||||||||||
| 313 | 2 | my $l = AtteanX::SPARQL::Token->lbrace; | |||||||||||||||||||||||||||||||
| 314 | 2 | my $r = AtteanX::SPARQL::Token->rbrace; | |||||||||||||||||||||||||||||||
| 315 | 2 | my ($lhs, $rhs) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||
| 317 | 2 | my @tokens; | |||||||||||||||||||||||||||||||
| 318 | 2 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 319 | 2 | push(@tokens, $lhs->sparql_subtokens->elements); | |||||||||||||||||||||||||||||||
| 320 | 2 | push(@tokens, $r, $union, $l); | |||||||||||||||||||||||||||||||
| 321 | 2 | push(@tokens, $rhs->sparql_subtokens->elements); | |||||||||||||||||||||||||||||||
| 322 | 2 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 323 | 2 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||
| 327 | =item * L<Attean::Algebra::Graph> | ||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||
| 329 | =cut | ||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||
| 331 | 50 | package Attean::Algebra::Graph 0.040 { | |||||||||||||||||||||||||||||||
| 332 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 333 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 334 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 335 | 50 | ▶ | use Types::Standard qw(ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 336 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||
| 338 | 50 | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | |||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||
| 340 | 50 | has 'graph' => (is => 'ro', isa => ConsumerOf['Attean::API::TermOrVariable'], required => 1); | |||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||
| 342 | 6 | ▶ | sub in_scope_variables { | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 343 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||
| 344 | 6 | my $graph = $self->graph; | |||||||||||||||||||||||||||||||
| 345 | 6 | my ($child) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 346 | 6 | my @vars = $child->in_scope_variables; | |||||||||||||||||||||||||||||||
| 347 | 6 | ▶ | if ($graph->does('Attean::API::Variable')) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 348 | 2 | return Set::Scalar->new(@vars, $graph->value)->elements; | |||||||||||||||||||||||||||||||
| 349 | } else { | ||||||||||||||||||||||||||||||||
| 350 | 4 | return @vars; | |||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||
| 353 | 1 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 354 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||
| 355 | 1 | return sprintf('Graph %s', $self->graph->as_string); | |||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||
| 357 | 0 | ▶ | sub tree_attributes { return qw(graph) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 358 | 2 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 359 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 360 | 2 | my $graph = AtteanX::SPARQL::Token->keyword('GRAPH'); | |||||||||||||||||||||||||||||||
| 361 | 2 | my $l = AtteanX::SPARQL::Token->lbrace; | |||||||||||||||||||||||||||||||
| 362 | 2 | my $r = AtteanX::SPARQL::Token->rbrace; | |||||||||||||||||||||||||||||||
| 363 | 2 | my ($child) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||
| 365 | 2 | my @tokens; | |||||||||||||||||||||||||||||||
| 366 | 2 | push(@tokens, $graph); | |||||||||||||||||||||||||||||||
| 367 | 2 | push(@tokens, $self->graph->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 368 | 2 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 369 | 2 | push(@tokens, $child->sparql_subtokens->elements); | |||||||||||||||||||||||||||||||
| 370 | 2 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 371 | 2 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||
| 375 | =item * L<Attean::Algebra::Extend> | ||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||
| 377 | =cut | ||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||
| 379 | 50 | package Attean::Algebra::Extend 0.040 { | |||||||||||||||||||||||||||||||
| 380 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 381 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 382 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 383 | 50 | ▶ | use Types::Standard qw(ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 384 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||
| 386 | 12 | ▶ | sub in_scope_variables { | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 387 | 12 | my $self = shift; | |||||||||||||||||||||||||||||||
| 388 | 12 | my ($child) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 389 | 12 | my @vars = $child->in_scope_variables; | |||||||||||||||||||||||||||||||
| 390 | 12 | return Set::Scalar->new(@vars, $self->variable->value)->elements; | |||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||
| 392 | 50 | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | |||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||
| 394 | 50 | has 'variable' => (is => 'ro', isa => ConsumerOf['Attean::API::Variable'], required => 1); | |||||||||||||||||||||||||||||||
| 395 | 50 | has 'expression' => (is => 'ro', isa => ConsumerOf['Attean::API::Expression'], required => 1); | |||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||
| 397 | 1 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 398 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||
| 399 | 1 | return sprintf('Extend { %s ← %s }', $self->variable->as_string, $self->expression->as_string); | |||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | sub tree_attributes { return qw(variable expression) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 402 | 2 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 403 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 404 | 2 | my $bind = AtteanX::SPARQL::Token->keyword('BIND'); | |||||||||||||||||||||||||||||||
| 405 | 2 | my $as = AtteanX::SPARQL::Token->keyword('AS'); | |||||||||||||||||||||||||||||||
| 406 | 2 | my $l = AtteanX::SPARQL::Token->lparen; | |||||||||||||||||||||||||||||||
| 407 | 2 | my $r = AtteanX::SPARQL::Token->rparen; | |||||||||||||||||||||||||||||||
| 408 | 2 | my ($child) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 409 | 2 | my $var = $self->variable; | |||||||||||||||||||||||||||||||
| 410 | 2 | my $expr = $self->expression; | |||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||
| 412 | 2 | my @tokens; | |||||||||||||||||||||||||||||||
| 413 | 2 | push(@tokens, $child->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 414 | 2 | push(@tokens, $bind); | |||||||||||||||||||||||||||||||
| 415 | 2 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 416 | 2 | push(@tokens, $expr->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 417 | 2 | push(@tokens, $as); | |||||||||||||||||||||||||||||||
| 418 | 2 | push(@tokens, $var->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 419 | 2 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 420 | 2 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||
| 424 | =item * L<Attean::Algebra::Unfold> | ||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||
| 426 | =cut | ||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||
| 428 | 50 | package Attean::Algebra::Unfold 0.031 { | |||||||||||||||||||||||||||||||
| 429 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 430 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 431 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 432 | 50 | ▶ | use Types::Standard qw(ArrayRef ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 433 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | sub in_scope_variables { | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 436 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 437 | 0 | my ($child) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 438 | 0 | my @vars = $child->in_scope_variables; | |||||||||||||||||||||||||||||||
| 439 | 0 | return Set::Scalar->new(@vars, map { $_->value } @{ $self->variables })->elements; | |||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||
| 441 | 50 | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | |||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||
| 443 | 50 | has 'variables' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::Variable']], required => 1); | |||||||||||||||||||||||||||||||
| 444 | 50 | has 'expression' => (is => 'ro', isa => ConsumerOf['Attean::API::Expression'], required => 1); | |||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 447 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 448 | 0 | my @vars = map { $_->as_string } @{ $self->variables }; | |||||||||||||||||||||||||||||||
| 449 | 0 | my $vars = '(' . join(', ', @vars) . ')'; | |||||||||||||||||||||||||||||||
| 450 | 0 | return sprintf('Unfold { %s ← %s }', $vars, $self->expression->as_string); | |||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | sub tree_attributes { return qw(variables expression) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 453 | 0 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 454 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 455 | 0 | my $explode = AtteanX::SPARQL::Token->keyword('UNFOLD'); | |||||||||||||||||||||||||||||||
| 456 | 0 | my $as = AtteanX::SPARQL::Token->keyword('AS'); | |||||||||||||||||||||||||||||||
| 457 | 0 | my $l = AtteanX::SPARQL::Token->lparen; | |||||||||||||||||||||||||||||||
| 458 | 0 | my $r = AtteanX::SPARQL::Token->rparen; | |||||||||||||||||||||||||||||||
| 459 | 0 | my ($child) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 460 | 0 | my @vars = @{ $self->variables }; | |||||||||||||||||||||||||||||||
| 461 | 0 | my $expr = $self->expression; | |||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||
| 463 | 0 | my @tokens; | |||||||||||||||||||||||||||||||
| 464 | 0 | push(@tokens, $child->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 465 | 0 | push(@tokens, $explode); | |||||||||||||||||||||||||||||||
| 466 | 0 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 467 | 0 | push(@tokens, $expr->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 468 | 0 | push(@tokens, $as); | |||||||||||||||||||||||||||||||
| 469 | 0 | foreach my $i (0 .. $#vars) { | |||||||||||||||||||||||||||||||
| 470 | 0 | my $var = $vars[$i]; | |||||||||||||||||||||||||||||||
| 471 | 0 | ▶ | if ($i > 0) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 472 | 0 | push(@tokens, AtteanX::SPARQL::Token->comma); | |||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||
| 474 | 0 | push(@tokens, $var->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||
| 476 | 0 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 477 | 0 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||
| 481 | =item * L<Attean::Algebra::Minus> | ||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||
| 483 | =cut | ||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||
| 485 | 50 | package Attean::Algebra::Minus 0.040 { | |||||||||||||||||||||||||||||||
| 486 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 487 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 488 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 489 | 50 | ▶ | use Types::Standard qw(ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 490 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||
| 492 | 50 | with 'Attean::API::Algebra', 'Attean::API::BinaryQueryTree'; | |||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||
| 494 | 2 | ▶ | sub in_scope_variables { | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 495 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 496 | 2 | my ($child) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 497 | 2 | return $child->in_scope_variables; | |||||||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||
| 500 | 1 | ▶ | sub algebra_as_string { return 'Minus' } | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 501 | 2 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 502 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 503 | 2 | my $minus = AtteanX::SPARQL::Token->keyword('MINUS'); | |||||||||||||||||||||||||||||||
| 504 | 2 | my $l = AtteanX::SPARQL::Token->lbrace; | |||||||||||||||||||||||||||||||
| 505 | 2 | my $r = AtteanX::SPARQL::Token->rbrace; | |||||||||||||||||||||||||||||||
| 506 | 2 | my ($lhs, $rhs) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||
| 508 | 2 | my @tokens; | |||||||||||||||||||||||||||||||
| 509 | 2 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 510 | 2 | push(@tokens, $lhs->sparql_subtokens->elements); | |||||||||||||||||||||||||||||||
| 511 | 2 | push(@tokens, $r, $minus, $l); | |||||||||||||||||||||||||||||||
| 512 | 2 | push(@tokens, $rhs->sparql_subtokens->elements); | |||||||||||||||||||||||||||||||
| 513 | 2 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 514 | 2 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||
| 519 | =item * L<Attean::Algebra::Distinct> | ||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||
| 521 | =cut | ||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||
| 523 | 50 | package Attean::Algebra::Distinct 0.040 { | |||||||||||||||||||||||||||||||
| 524 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 525 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||
| 527 | 50 | with 'Attean::API::SPARQLQuerySerializable'; | |||||||||||||||||||||||||||||||
| 528 | 50 | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | |||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||
| 530 | 1 | ▶ | sub algebra_as_string { return 'Distinct' } | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||
| 533 | =item * L<Attean::Algebra::Reduced> | ||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||
| 535 | =cut | ||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||
| 537 | 50 | package Attean::Algebra::Reduced 0.040 { | |||||||||||||||||||||||||||||||
| 538 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 539 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||
| 541 | 50 | with 'Attean::API::SPARQLQuerySerializable'; | |||||||||||||||||||||||||||||||
| 542 | 50 | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | |||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||
| 544 | 1 | ▶ | sub algebra_as_string { return 'Reduced' } | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||
| 547 | =item * L<Attean::Algebra::Slice> | ||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||
| 549 | =cut | ||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||
| 551 | 50 | package Attean::Algebra::Slice 0.040 { | |||||||||||||||||||||||||||||||
| 552 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 553 | 50 | ▶ | use Types::Standard qw(Int); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 554 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||
| 556 | 50 | with 'Attean::API::SPARQLQuerySerializable'; | |||||||||||||||||||||||||||||||
| 557 | 50 | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | |||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||
| 559 | 50 | has 'limit' => (is => 'ro', isa => Int, default => -1); | |||||||||||||||||||||||||||||||
| 560 | 50 | has 'offset' => (is => 'ro', isa => Int, default => 0); | |||||||||||||||||||||||||||||||
| 561 | 0 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 562 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 563 | 0 | my @str = ('Slice'); | |||||||||||||||||||||||||||||||
| 564 | 0 | ▶ | push(@str, "Limit=" . $self->limit) if ($self->limit >= 0); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 565 | 0 | ▶ | push(@str, "Offset=" . $self->offset) if ($self->offset > 0); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 566 | 0 | return join(' ', @str); | |||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||
| 570 | =item * L<Attean::Algebra::Project> | ||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||
| 572 | =cut | ||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||
| 574 | 50 | package Attean::Algebra::Project 0.040 { | |||||||||||||||||||||||||||||||
| 575 | 50 | ▶ | use Types::Standard qw(ArrayRef ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 576 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 577 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||
| 579 | 50 | with 'Attean::API::SPARQLQuerySerializable'; | |||||||||||||||||||||||||||||||
| 580 | 50 | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | |||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||
| 582 | 50 | has 'variables' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::Variable']], required => 1); | |||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||
| 584 | 2 | ▶ | sub in_scope_variables { | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 585 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 586 | 2 | my ($child) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 587 | 2 | my $set = Set::Scalar->new( $child->in_scope_variables ); | |||||||||||||||||||||||||||||||
| 588 | 2 | my $proj = Set::Scalar->new( map { $_->value } @{ $self->variables } ); | |||||||||||||||||||||||||||||||
| 589 | 2 | return $set->intersection($proj)->elements; | |||||||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||||||
| 591 | 5 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 592 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||
| 593 | 5 | return sprintf('Project { %s }', join(' ', map { '?' . $_->value } @{ $self->variables })); | |||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | sub tree_attributes { return qw(variables) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||
| 598 | =item * L<Attean::Algebra::Comparator> | ||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||
| 600 | =cut | ||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||
| 602 | 50 | package Attean::Algebra::Comparator 0.040 { | |||||||||||||||||||||||||||||||
| 603 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 604 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 605 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 606 | 50 | ▶ | use Types::Standard qw(Bool ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 607 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||
| 610 | 50 | has 'ascending' => (is => 'ro', isa => Bool, default => 1); | |||||||||||||||||||||||||||||||
| 611 | 50 | has 'expression' => (is => 'ro', isa => ConsumerOf['Attean::API::Expression'], required => 1); | |||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||
| 613 | 0 | ▶ | sub tree_attributes { return qw(expression) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 614 | 1 | ▶ | sub as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 615 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||
| 616 | 1 | ▶ | if ($self->ascending) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 617 | 1 | return 'ASC(' . $self->expression->as_string . ')'; | |||||||||||||||||||||||||||||||
| 618 | } else { | ||||||||||||||||||||||||||||||||
| 619 | 0 | return 'DESC(' . $self->expression->as_string . ')'; | |||||||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||
| 623 | 2 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 624 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 625 | 2 | my $asc = AtteanX::SPARQL::Token->keyword('ASC'); | |||||||||||||||||||||||||||||||
| 626 | 2 | my $desc = AtteanX::SPARQL::Token->keyword('DESC'); | |||||||||||||||||||||||||||||||
| 627 | 2 | my $l = AtteanX::SPARQL::Token->lparen; | |||||||||||||||||||||||||||||||
| 628 | 2 | my $r = AtteanX::SPARQL::Token->rparen; | |||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||
| 630 | 2 | my @tokens; | |||||||||||||||||||||||||||||||
| 631 | 2 | ▶ | if ($self->ascending) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 632 | 0 | push(@tokens, $self->expression->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 633 | } else { | ||||||||||||||||||||||||||||||||
| 634 | 2 | push(@tokens, $desc, $l); | |||||||||||||||||||||||||||||||
| 635 | 2 | push(@tokens, $self->expression->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 636 | 2 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||||||
| 638 | 2 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||
| 642 | =item * L<Attean::Algebra::OrderBy> | ||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||
| 644 | =cut | ||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||
| 646 | 50 | package Attean::Algebra::OrderBy 0.040 { | |||||||||||||||||||||||||||||||
| 647 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 648 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 649 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 650 | 50 | ▶ | use Types::Standard qw(ArrayRef InstanceOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 651 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||
| 653 | 50 | with 'Attean::API::SPARQLQuerySerializable'; | |||||||||||||||||||||||||||||||
| 654 | 50 | with 'Attean::API::UnionScopeVariables', 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | |||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||
| 656 | 50 | has 'comparators' => (is => 'ro', isa => ArrayRef[InstanceOf['Attean::Algebra::Comparator']], required => 1); | |||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||
| 658 | 0 | ▶ | sub tree_attributes { return qw(comparators) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 659 | 1 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 660 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||
| 661 | 1 | return sprintf('Order { %s }', join(', ', map { $_->as_string } @{ $self->comparators })); | |||||||||||||||||||||||||||||||
| 662 | } | ||||||||||||||||||||||||||||||||
| 663 | } | ||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||
| 665 | =item * L<Attean::Algebra::BGP> | ||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||
| 667 | =cut | ||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||
| 669 | 50 | package Attean::Algebra::BGP 0.040 { | |||||||||||||||||||||||||||||||
| 670 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 671 | 50 | ▶ | use Attean::RDF; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 672 | 50 | ▶ | use Set::Scalar; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 673 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 674 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 675 | 50 | ▶ | use Types::Standard qw(ArrayRef ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 676 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||
| 678 | 50 | with 'Attean::API::Algebra', 'Attean::API::NullaryQueryTree', 'Attean::API::CanonicalizingBindingSet'; | |||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||
| 680 | 3 | ▶ | has 'triples' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::TriplePattern']], default => sub { [] }); | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||
| 682 | 84 | ▶ | sub in_scope_variables { | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 683 | 84 | my $self = shift; | |||||||||||||||||||||||||||||||
| 684 | 84 | my $set = Set::Scalar->new(); | |||||||||||||||||||||||||||||||
| 685 | 84 | foreach my $t (@{ $self->triples }) { | |||||||||||||||||||||||||||||||
| 686 | 109 | my @vars = $t->referenced_variables(); | |||||||||||||||||||||||||||||||
| 687 | 109 | $set->insert(@vars); | |||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||
| 689 | 84 | return $set->elements; | |||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||
| 692 | 81 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 693 | 81 | my $self = shift; | |||||||||||||||||||||||||||||||
| 694 | 81 | my @tokens; | |||||||||||||||||||||||||||||||
| 695 | 81 | my $dot = AtteanX::SPARQL::Token->dot; | |||||||||||||||||||||||||||||||
| 696 | 81 | foreach my $t (@{ $self->triples }) { | |||||||||||||||||||||||||||||||
| 697 | 92 | push(@tokens, $t->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 698 | 92 | push(@tokens, $dot); | |||||||||||||||||||||||||||||||
| 699 | } | ||||||||||||||||||||||||||||||||
| 700 | 81 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 701 | } | ||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||
| 703 | 19 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 704 | 19 | my $self = shift; | |||||||||||||||||||||||||||||||
| 705 | 19 | return 'BGP { ' . join(', ', map { $_->as_string } @{ $self->triples }) . ' }'; | |||||||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||
| 708 | 4 | ▶ | sub elements { | ||||||||||||||||||||||||||||||
|
Subroutine
elements: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 709 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||
| 710 | 4 | return @{ $self->triples }; | |||||||||||||||||||||||||||||||
| 711 | } | ||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||
| 713 | 0 | ▶ | sub canonicalize { | ||||||||||||||||||||||||||||||
|
Subroutine
canonicalize: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 714 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 715 | 0 | my ($algebra, $mapping) = $self->canonical_bgp_with_mapping(); | |||||||||||||||||||||||||||||||
| 716 | 0 | my @proj = sort map { sprintf("(?v%03d AS $_)", $mapping->{$_}{id}) } grep { $mapping->{$_}{type} eq 'variable' } (keys %$mapping); | |||||||||||||||||||||||||||||||
| 717 | 0 | foreach my $var (keys %$mapping) { | |||||||||||||||||||||||||||||||
| 718 | $algebra = Attean::Algebra::Extend->new( | ||||||||||||||||||||||||||||||||
| 719 | children => [$algebra], | ||||||||||||||||||||||||||||||||
| 720 | variable => variable($var), | ||||||||||||||||||||||||||||||||
| 721 | 0 | expression => Attean::ValueExpression->new( value => variable($mapping->{$var}{id}) ), | |||||||||||||||||||||||||||||||
| 722 | ); | ||||||||||||||||||||||||||||||||
| 723 | } | ||||||||||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||
| 726 | 4 | ▶ | sub canonical_bgp_with_mapping { | ||||||||||||||||||||||||||||||
|
Subroutine
canonical_bgp_with_mapping: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 727 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||
| 728 | 4 | my ($triples, $mapping) = $self->canonical_set_with_mapping(); | |||||||||||||||||||||||||||||||
| 729 | 4 | my $algebra = Attean::Algebra::BGP->new( triples => $triples ); | |||||||||||||||||||||||||||||||
| 730 | 4 | return ($algebra, $mapping); | |||||||||||||||||||||||||||||||
| 731 | } | ||||||||||||||||||||||||||||||||
| 732 | 5 | ▶ | sub tree_attributes { return qw(triples) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 733 | } | ||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||
| 735 | =item * L<Attean::Algebra::Service> | ||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||
| 737 | =cut | ||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||
| 739 | 50 | package Attean::Algebra::Service 0.040 { | |||||||||||||||||||||||||||||||
| 740 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 741 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 742 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 743 | 50 | ▶ | use Types::Standard qw(ConsumerOf Bool); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 744 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||
| 746 | 50 | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree', 'Attean::API::UnionScopeVariables'; | |||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||
| 748 | 50 | has 'endpoint' => (is => 'ro', isa => ConsumerOf['Attean::API::TermOrVariable'], required => 1); | |||||||||||||||||||||||||||||||
| 749 | 50 | has 'silent' => (is => 'ro', isa => Bool, default => 0); | |||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||
| 751 | 1 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 752 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||
| 753 | 1 | my $endpoint = $self->endpoint->as_sparql; | |||||||||||||||||||||||||||||||
| 754 | 1 | chomp($endpoint); | |||||||||||||||||||||||||||||||
| 755 | 1 | return sprintf('Service %s', $endpoint); | |||||||||||||||||||||||||||||||
| 756 | } | ||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||
| 758 | 0 | ▶ | sub tree_attributes { return qw(endpoint) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||
| 760 | 3 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 761 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||
| 762 | 3 | my $service = AtteanX::SPARQL::Token->keyword('SERVICE'); | |||||||||||||||||||||||||||||||
| 763 | 3 | my $l = AtteanX::SPARQL::Token->lbrace; | |||||||||||||||||||||||||||||||
| 764 | 3 | my $r = AtteanX::SPARQL::Token->rbrace; | |||||||||||||||||||||||||||||||
| 765 | 3 | my ($child) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||
| 767 | 3 | my @tokens; | |||||||||||||||||||||||||||||||
| 768 | 3 | push(@tokens, $service); | |||||||||||||||||||||||||||||||
| 769 | 3 | ▶ | if ($self->silent) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 770 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('SILENT')); | |||||||||||||||||||||||||||||||
| 771 | } | ||||||||||||||||||||||||||||||||
| 772 | 3 | push(@tokens, $self->endpoint->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 773 | 3 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 774 | 3 | push(@tokens, $child->sparql_subtokens->elements); | |||||||||||||||||||||||||||||||
| 775 | 3 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 776 | 3 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||
| 778 | } | ||||||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||||||
| 780 | =item * L<Attean::Algebra::Path> | ||||||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||||||
| 782 | =cut | ||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||
| 784 | 50 | package Attean::Algebra::Path 0.040 { | |||||||||||||||||||||||||||||||
| 785 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 786 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 787 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 788 | 50 | ▶ | use Types::Standard qw(ArrayRef ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 789 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||||
| 791 | 50 | with 'Attean::API::Algebra', 'Attean::API::NullaryQueryTree'; | |||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||
| 793 | 50 | has 'subject' => (is => 'ro', isa => ConsumerOf['Attean::API::TermOrVariableOrTriplePattern'], required => 1); | |||||||||||||||||||||||||||||||
| 794 | 50 | has 'path' => (is => 'ro', isa => ConsumerOf['Attean::API::PropertyPath'], required => 1); | |||||||||||||||||||||||||||||||
| 795 | 50 | has 'object' => (is => 'ro', isa => ConsumerOf['Attean::API::TermOrVariableOrTriplePattern'], required => 1); | |||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||
| 797 | 2 | ▶ | sub in_scope_variables { | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 798 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 799 | 2 | my @vars = map { $_->value } grep { $_->does('Attean::API::Variable') } ($self->subject, $self->object); | |||||||||||||||||||||||||||||||
| 800 | 2 | return Set::Scalar->new(@vars)->elements; | |||||||||||||||||||||||||||||||
| 801 | } | ||||||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||||||
| 803 | 0 | ▶ | sub tree_attributes { return qw(subject path object) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||
| 805 | 1 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 806 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||
| 807 | 1 | return 'Path { ' . join(', ', map { $_->as_string } map { $self->$_() } qw(subject path object)) . ' }'; | |||||||||||||||||||||||||||||||
| 808 | } | ||||||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||||||
| 810 | 13 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 811 | 13 | my $self = shift; | |||||||||||||||||||||||||||||||
| 812 | 13 | my @tokens; | |||||||||||||||||||||||||||||||
| 813 | 13 | foreach my $t ($self->subject, $self->path, $self->object) { | |||||||||||||||||||||||||||||||
| 814 | 39 | push(@tokens, $t->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||||||
| 816 | 13 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 817 | } | ||||||||||||||||||||||||||||||||
| 818 | } | ||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||
| 820 | =item * L<Attean::Algebra::Group> | ||||||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||||||
| 822 | =cut | ||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||
| 824 | 50 | package Attean::Algebra::Group 0.040 { | |||||||||||||||||||||||||||||||
| 825 | 50 | ▶ | use utf8; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 826 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 827 | 50 | ▶ | use Attean::API::Query; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 828 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 829 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 830 | 50 | ▶ | use Types::Standard qw(ArrayRef ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 831 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||
| 833 | 50 | with 'Attean::API::SPARQLQuerySerializable'; | |||||||||||||||||||||||||||||||
| 834 | 50 | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | |||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||
| 836 | 50 | has 'groupby' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::Expression']]); | |||||||||||||||||||||||||||||||
| 837 | 50 | has 'aggregates' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::AggregateExpression']]); | |||||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||||||
| 839 | 9 | ▶ | sub BUILD { | ||||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 840 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||
| 841 | 9 | foreach my $a (@{ $self->aggregates }) { | |||||||||||||||||||||||||||||||
| 842 | 9 | my $op = $a->operator; | |||||||||||||||||||||||||||||||
| 843 | 9 | ▶ | if ($op eq 'RANK') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 844 | 3 | ▶ | if (scalar(@{ $self->aggregates }) > 1) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 845 | 0 | die "Cannot use both aggregates and RANKing in grouping operator"; | |||||||||||||||||||||||||||||||
| 846 | } | ||||||||||||||||||||||||||||||||
| 847 | } | ||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||
| 849 | } | ||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||
| 851 | 4 | ▶ | sub in_scope_variables { | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: called CC=7 SCAR=20.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 852 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||
| 853 | 4 | ▶ | my $aggs = $self->aggregates // []; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->aggregates // []
MC/DC0%0/1
$self->aggregates // []
$self->aggregates
Truth table50%1/2
A
A= $self->aggregates
| |||||||||||||||||||||||||||||||||
| 854 | 4 | ▶ | my $groups = $self->groupby // []; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->groupby // []
MC/DC0%0/1
$self->groupby // []
$self->groupby
Truth table50%1/2
A
A= $self->groupby
| |||||||||||||||||||||||||||||||||
| 855 | 4 | my %vars; | |||||||||||||||||||||||||||||||
| 856 | 4 | foreach my $a (@$aggs) { | |||||||||||||||||||||||||||||||
| 857 | 4 | $vars{ $a->variable->value }++; | |||||||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||||||
| 859 | 4 | foreach my $e (@$groups) { | |||||||||||||||||||||||||||||||
| 860 | 4 | ▶ | if ($e->isa('Attean::ValueExpression')) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 861 | 4 | my $value = $e->value; | |||||||||||||||||||||||||||||||
| 862 | 4 | ▶ | if ($value->does('Attean::API::Variable')) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 863 | 4 | $vars{ $value->value }++; | |||||||||||||||||||||||||||||||
| 864 | } | ||||||||||||||||||||||||||||||||
| 865 | } | ||||||||||||||||||||||||||||||||
| 866 | } | ||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||
| 868 | 4 | return keys %vars; | |||||||||||||||||||||||||||||||
| 869 | } | ||||||||||||||||||||||||||||||||
| 870 | |||||||||||||||||||||||||||||||||
| 871 | 6 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 872 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||
| 873 | 6 | my @aggs; | |||||||||||||||||||||||||||||||
| 874 | 6 | ▶ | my $aggs = $self->aggregates // []; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->aggregates // []
MC/DC0%0/1
$self->aggregates // []
$self->aggregates
Truth table50%1/2
A
A= $self->aggregates
| |||||||||||||||||||||||||||||||||
| 875 | 6 | ▶ | my $groups = $self->groupby // []; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->groupby // []
MC/DC0%0/1
$self->groupby // []
$self->groupby
Truth table50%1/2
A
A= $self->groupby
| |||||||||||||||||||||||||||||||||
| 876 | 6 | foreach my $a (@$aggs) { | |||||||||||||||||||||||||||||||
| 877 | 6 | my $v = $a->variable->as_string; | |||||||||||||||||||||||||||||||
| 878 | 6 | my $op = $a->operator; | |||||||||||||||||||||||||||||||
| 879 | 6 | ▶ | my $d = $a->distinct ? "DISTINCT " : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 880 | 6 | my ($e) = ((map { $_->as_string } @{ $a->children }), ''); | |||||||||||||||||||||||||||||||
| 881 | 6 | my $s = "$v ← ${op}($d$e)"; | |||||||||||||||||||||||||||||||
| 882 | 6 | push(@aggs, $s); | |||||||||||||||||||||||||||||||
| 883 | } | ||||||||||||||||||||||||||||||||
| 884 | 6 | return sprintf('Group { %s } aggregate { %s }', join(', ', map { $_->as_string() } @$groups), join(', ', @aggs)); | |||||||||||||||||||||||||||||||
| 885 | } | ||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||
| 887 | 0 | ▶ | sub tree_attributes { return qw(groupby aggregates) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 888 | } | ||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||
| 890 | =item * L<Attean::Algebra::NegatedPropertySet> | ||||||||||||||||||||||||||||||||
| 891 | |||||||||||||||||||||||||||||||||
| 892 | =cut | ||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||
| 894 | 50 | package Attean::Algebra::NegatedPropertySet 0.040 { | |||||||||||||||||||||||||||||||
| 895 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 896 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 897 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 898 | 50 | ▶ | use Types::Standard qw(ArrayRef ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 899 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||
| 901 | 50 | with 'Attean::API::PropertyPath'; | |||||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||||||
| 903 | 0 | ▶ | has 'predicates' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::IRI']], required => 0, default => sub { [] }); | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||
| 904 | 4 | ▶ | has 'reversed' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::IRI']], required => 0, default => sub { [] }); | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||
| 906 | 1 | ▶ | sub as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 907 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||
| 908 | 1 | my @forward = map { $_->ntriples_string } @{ $self->predicates }; | |||||||||||||||||||||||||||||||
| 909 | 0 | my @rev = map { '^' . $_->ntriples_string } @{ $self->reversed }; | |||||||||||||||||||||||||||||||
| 910 | 1 | return sprintf("!(%s)", join('|', @forward, @rev)); | |||||||||||||||||||||||||||||||
| 911 | } | ||||||||||||||||||||||||||||||||
| 912 | 1 | ▶ | sub algebra_as_string { return 'NPS' } | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 913 | 1 | ▶ | sub tree_attributes { return qw(predicates reversed) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 914 | 0 | ▶ | sub as_sparql { | ||||||||||||||||||||||||||||||
|
Subroutine
as_sparql: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 915 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 916 | 0 | my @forward = map { $_->as_sparql } @{ $self->predicates }; | |||||||||||||||||||||||||||||||
| 917 | 0 | my @rev = map { '^' . $_->as_sparql } @{ $self->reversed }; | |||||||||||||||||||||||||||||||
| 918 | 0 | return sprintf("!(%s)", join('|', @forward, @rev)); | |||||||||||||||||||||||||||||||
| 919 | } | ||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||
| 921 | 2 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 922 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 923 | 2 | my $bang = AtteanX::SPARQL::Token->op_bang; | |||||||||||||||||||||||||||||||
| 924 | 2 | my $or = AtteanX::SPARQL::Token->path_or; | |||||||||||||||||||||||||||||||
| 925 | 2 | my $hat = AtteanX::SPARQL::Token->path_hat; | |||||||||||||||||||||||||||||||
| 926 | 2 | my $l = AtteanX::SPARQL::Token->lparen; | |||||||||||||||||||||||||||||||
| 927 | 2 | my $r = AtteanX::SPARQL::Token->rparen; | |||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||
| 929 | 2 | my @tokens; | |||||||||||||||||||||||||||||||
| 930 | 2 | push(@tokens, $bang, $l); | |||||||||||||||||||||||||||||||
| 931 | 2 | foreach my $t (@{ $self->predicates }) { | |||||||||||||||||||||||||||||||
| 932 | 4 | push(@tokens, $t->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 933 | 4 | push(@tokens, $or); | |||||||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||||||
| 935 | 2 | foreach my $t (@{ $self->reversed }) { | |||||||||||||||||||||||||||||||
| 936 | 0 | push(@tokens, $hat); | |||||||||||||||||||||||||||||||
| 937 | 0 | push(@tokens, $t->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 938 | 0 | push(@tokens, $or); | |||||||||||||||||||||||||||||||
| 939 | } | ||||||||||||||||||||||||||||||||
| 940 | 2 | pop(@tokens); # remove last OR token | |||||||||||||||||||||||||||||||
| 941 | 2 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 942 | 2 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 943 | } | ||||||||||||||||||||||||||||||||
| 944 | } | ||||||||||||||||||||||||||||||||
| 945 | |||||||||||||||||||||||||||||||||
| 946 | =item * L<Attean::Algebra::PredicatePath> | ||||||||||||||||||||||||||||||||
| 947 | |||||||||||||||||||||||||||||||||
| 948 | =cut | ||||||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||||||
| 950 | 50 | package Attean::Algebra::PredicatePath 0.040 { | |||||||||||||||||||||||||||||||
| 951 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 952 | 50 | ▶ | use Types::Standard qw(ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 953 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||
| 955 | 50 | with 'Attean::API::PropertyPath'; | |||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||
| 957 | 50 | has 'predicate' => (is => 'ro', isa => ConsumerOf['Attean::API::IRI'], required => 1); | |||||||||||||||||||||||||||||||
| 958 | 18 | ▶ | sub as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 959 | 18 | my $self = shift; | |||||||||||||||||||||||||||||||
| 960 | 18 | return $self->predicate->ntriples_string; | |||||||||||||||||||||||||||||||
| 961 | } | ||||||||||||||||||||||||||||||||
| 962 | 4 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 963 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||
| 964 | 4 | return 'Property Path ' . $self->as_string; | |||||||||||||||||||||||||||||||
| 965 | } | ||||||||||||||||||||||||||||||||
| 966 | 4 | ▶ | sub tree_attributes { return qw(predicate) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 967 | 0 | ▶ | sub as_sparql { | ||||||||||||||||||||||||||||||
|
Subroutine
as_sparql: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 968 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 969 | 0 | return $self->predicate->as_sparql; | |||||||||||||||||||||||||||||||
| 970 | } | ||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||
| 972 | 36 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 973 | 36 | my $self = shift; | |||||||||||||||||||||||||||||||
| 974 | 36 | return $self->predicate->sparql_tokens; | |||||||||||||||||||||||||||||||
| 975 | } | ||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||
| 977 | } | ||||||||||||||||||||||||||||||||
| 978 | |||||||||||||||||||||||||||||||||
| 979 | =item * L<Attean::Algebra::InversePath> | ||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||
| 981 | =cut | ||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||
| 983 | 50 | package Attean::Algebra::InversePath 0.040 { | |||||||||||||||||||||||||||||||
| 984 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 985 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 986 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 987 | 50 | ▶ | use Types::Standard qw(ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 988 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||
| 990 | 50 | with 'Attean::API::UnaryPropertyPath'; | |||||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||||||
| 992 | 4 | ▶ | sub prefix_name { return "^" } | ||||||||||||||||||||||||||||||
|
Subroutine
prefix_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 993 | 0 | ▶ | sub as_sparql { | ||||||||||||||||||||||||||||||
|
Subroutine
as_sparql: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 994 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 995 | 0 | my ($path) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 996 | 0 | return '^' . $self->path->as_sparql; | |||||||||||||||||||||||||||||||
| 997 | } | ||||||||||||||||||||||||||||||||
| 998 | |||||||||||||||||||||||||||||||||
| 999 | 10 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1000 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1001 | 10 | my $hat = AtteanX::SPARQL::Token->path_hat; | |||||||||||||||||||||||||||||||
| 1002 | 10 | my $l = AtteanX::SPARQL::Token->lparen; | |||||||||||||||||||||||||||||||
| 1003 | 10 | my $r = AtteanX::SPARQL::Token->rparen; | |||||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||||||
| 1005 | 10 | my @tokens; | |||||||||||||||||||||||||||||||
| 1006 | 10 | foreach my $t (@{ $self->children }) { | |||||||||||||||||||||||||||||||
| 1007 | 10 | push(@tokens, $t->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1008 | } | ||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||
| 1010 | 10 | ▶ | if (scalar(@tokens) > 1) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1011 | 8 | unshift(@tokens, $hat, $l); | |||||||||||||||||||||||||||||||
| 1012 | 8 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 1013 | } else { | ||||||||||||||||||||||||||||||||
| 1014 | 2 | unshift(@tokens, $hat); | |||||||||||||||||||||||||||||||
| 1015 | } | ||||||||||||||||||||||||||||||||
| 1016 | |||||||||||||||||||||||||||||||||
| 1017 | 10 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 1018 | } | ||||||||||||||||||||||||||||||||
| 1019 | } | ||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||
| 1021 | =item * L<Attean::Algebra::SequencePath> | ||||||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||||||
| 1023 | =cut | ||||||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||||||
| 1025 | 50 | package Attean::Algebra::SequencePath 0.040 { | |||||||||||||||||||||||||||||||
| 1026 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1027 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1028 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1029 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1030 | |||||||||||||||||||||||||||||||||
| 1031 | 50 | with 'Attean::API::NaryPropertyPath'; | |||||||||||||||||||||||||||||||
| 1032 | |||||||||||||||||||||||||||||||||
| 1033 | 5 | ▶ | sub separator { return "/" } | ||||||||||||||||||||||||||||||
|
Subroutine
separator: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1034 | 0 | ▶ | sub as_sparql { | ||||||||||||||||||||||||||||||
|
Subroutine
as_sparql: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1035 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1036 | 0 | my @paths = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 1037 | 0 | return '(' . join('/', map { $_->as_sparql } @paths) . ')'; | |||||||||||||||||||||||||||||||
| 1038 | } | ||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||
| 1040 | 6 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1041 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1042 | 6 | my $slash = AtteanX::SPARQL::Token->slash; | |||||||||||||||||||||||||||||||
| 1043 | |||||||||||||||||||||||||||||||||
| 1044 | 6 | my @tokens; | |||||||||||||||||||||||||||||||
| 1045 | 6 | foreach my $t (@{ $self->children }) { | |||||||||||||||||||||||||||||||
| 1046 | 10 | push(@tokens, $t->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1047 | 10 | push(@tokens, $slash); | |||||||||||||||||||||||||||||||
| 1048 | } | ||||||||||||||||||||||||||||||||
| 1049 | 6 | pop(@tokens); # remove last SLASH token | |||||||||||||||||||||||||||||||
| 1050 | 6 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 1051 | } | ||||||||||||||||||||||||||||||||
| 1052 | } | ||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||
| 1054 | =item * L<Attean::Algebra::AlternativePath> | ||||||||||||||||||||||||||||||||
| 1055 | |||||||||||||||||||||||||||||||||
| 1056 | =cut | ||||||||||||||||||||||||||||||||
| 1057 | |||||||||||||||||||||||||||||||||
| 1058 | 50 | package Attean::Algebra::AlternativePath 0.040 { | |||||||||||||||||||||||||||||||
| 1059 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1060 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1061 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1062 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1063 | |||||||||||||||||||||||||||||||||
| 1064 | 50 | with 'Attean::API::NaryPropertyPath'; | |||||||||||||||||||||||||||||||
| 1065 | |||||||||||||||||||||||||||||||||
| 1066 | 2 | ▶ | sub separator { return "|" } | ||||||||||||||||||||||||||||||
|
Subroutine
separator: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1067 | 0 | ▶ | sub as_sparql { | ||||||||||||||||||||||||||||||
|
Subroutine
as_sparql: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1068 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1069 | 0 | my @paths = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 1070 | 0 | return '(' . join('|', map { $_->as_sparql } @paths) . ')'; | |||||||||||||||||||||||||||||||
| 1071 | } | ||||||||||||||||||||||||||||||||
| 1072 | |||||||||||||||||||||||||||||||||
| 1073 | 12 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1074 | 12 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1075 | 12 | my $or = AtteanX::SPARQL::Token->path_or; | |||||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||||||
| 1077 | 12 | my @tokens; | |||||||||||||||||||||||||||||||
| 1078 | 12 | foreach my $t (@{ $self->children }) { | |||||||||||||||||||||||||||||||
| 1079 | 22 | push(@tokens, $t->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1080 | 22 | push(@tokens, $or); | |||||||||||||||||||||||||||||||
| 1081 | } | ||||||||||||||||||||||||||||||||
| 1082 | 12 | pop(@tokens); # remove last OR token | |||||||||||||||||||||||||||||||
| 1083 | 12 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 1084 | } | ||||||||||||||||||||||||||||||||
| 1085 | } | ||||||||||||||||||||||||||||||||
| 1086 | |||||||||||||||||||||||||||||||||
| 1087 | =item * L<Attean::Algebra::ZeroOrMorePath> | ||||||||||||||||||||||||||||||||
| 1088 | |||||||||||||||||||||||||||||||||
| 1089 | =cut | ||||||||||||||||||||||||||||||||
| 1090 | |||||||||||||||||||||||||||||||||
| 1091 | 50 | package Attean::Algebra::ZeroOrMorePath 0.040 { | |||||||||||||||||||||||||||||||
| 1092 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1093 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1094 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1095 | 50 | ▶ | use Types::Standard qw(ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1096 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||
| 1098 | 50 | with 'Attean::API::UnaryPropertyPath'; | |||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||
| 1100 | 3 | ▶ | sub postfix_name { return "*" } | ||||||||||||||||||||||||||||||
|
Subroutine
postfix_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1101 | 0 | ▶ | sub as_sparql { | ||||||||||||||||||||||||||||||
|
Subroutine
as_sparql: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1102 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1103 | 0 | my ($path) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 1104 | 0 | return $self->path->as_sparql . '*'; | |||||||||||||||||||||||||||||||
| 1105 | } | ||||||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||||||
| 1107 | 2 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1108 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1109 | 2 | my $star = AtteanX::SPARQL::Token->star; | |||||||||||||||||||||||||||||||
| 1110 | 2 | my $l = AtteanX::SPARQL::Token->lparen; | |||||||||||||||||||||||||||||||
| 1111 | 2 | my $r = AtteanX::SPARQL::Token->rparen; | |||||||||||||||||||||||||||||||
| 1112 | |||||||||||||||||||||||||||||||||
| 1113 | 2 | my @tokens; | |||||||||||||||||||||||||||||||
| 1114 | 2 | foreach my $t (@{ $self->children }) { | |||||||||||||||||||||||||||||||
| 1115 | 2 | push(@tokens, $t->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1116 | } | ||||||||||||||||||||||||||||||||
| 1117 | |||||||||||||||||||||||||||||||||
| 1118 | 2 | ▶ | if (scalar(@tokens) > 1) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1119 | 2 | unshift(@tokens, $l); | |||||||||||||||||||||||||||||||
| 1120 | 2 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 1121 | } | ||||||||||||||||||||||||||||||||
| 1122 | 2 | push(@tokens, $star); | |||||||||||||||||||||||||||||||
| 1123 | |||||||||||||||||||||||||||||||||
| 1124 | 2 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 1125 | } | ||||||||||||||||||||||||||||||||
| 1126 | } | ||||||||||||||||||||||||||||||||
| 1127 | |||||||||||||||||||||||||||||||||
| 1128 | =item * L<Attean::Algebra::OneOrMorePath> | ||||||||||||||||||||||||||||||||
| 1129 | |||||||||||||||||||||||||||||||||
| 1130 | =cut | ||||||||||||||||||||||||||||||||
| 1131 | |||||||||||||||||||||||||||||||||
| 1132 | 50 | package Attean::Algebra::OneOrMorePath 0.040 { | |||||||||||||||||||||||||||||||
| 1133 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1134 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1135 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1136 | 50 | ▶ | use Types::Standard qw(ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1137 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||
| 1139 | 50 | with 'Attean::API::UnaryPropertyPath'; | |||||||||||||||||||||||||||||||
| 1140 | |||||||||||||||||||||||||||||||||
| 1141 | 0 | ▶ | sub postfix_name { return "+" } | ||||||||||||||||||||||||||||||
|
Subroutine
postfix_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1142 | 0 | ▶ | sub as_sparql { | ||||||||||||||||||||||||||||||
|
Subroutine
as_sparql: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1143 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1144 | 0 | my ($path) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 1145 | 0 | return $self->path->as_sparql . '+'; | |||||||||||||||||||||||||||||||
| 1146 | } | ||||||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||||||
| 1148 | 2 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1149 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1150 | 2 | my $plus = AtteanX::SPARQL::Token->op_plus; | |||||||||||||||||||||||||||||||
| 1151 | 2 | my $l = AtteanX::SPARQL::Token->lparen; | |||||||||||||||||||||||||||||||
| 1152 | 2 | my $r = AtteanX::SPARQL::Token->rparen; | |||||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||||
| 1154 | 2 | my @tokens; | |||||||||||||||||||||||||||||||
| 1155 | 2 | foreach my $t (@{ $self->children }) { | |||||||||||||||||||||||||||||||
| 1156 | 2 | push(@tokens, $t->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1157 | } | ||||||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||||||
| 1159 | 2 | ▶ | if (scalar(@tokens) > 1) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1160 | 2 | unshift(@tokens, $l); | |||||||||||||||||||||||||||||||
| 1161 | 2 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 1162 | } | ||||||||||||||||||||||||||||||||
| 1163 | 2 | push(@tokens, $plus); | |||||||||||||||||||||||||||||||
| 1164 | |||||||||||||||||||||||||||||||||
| 1165 | 2 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 1166 | } | ||||||||||||||||||||||||||||||||
| 1167 | } | ||||||||||||||||||||||||||||||||
| 1168 | |||||||||||||||||||||||||||||||||
| 1169 | =item * L<Attean::Algebra::ZeroOrOnePath> | ||||||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||||||
| 1171 | =cut | ||||||||||||||||||||||||||||||||
| 1172 | |||||||||||||||||||||||||||||||||
| 1173 | 50 | package Attean::Algebra::ZeroOrOnePath 0.040 { | |||||||||||||||||||||||||||||||
| 1174 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1175 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1176 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1177 | 50 | ▶ | use Types::Standard qw(ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1178 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1179 | |||||||||||||||||||||||||||||||||
| 1180 | 50 | with 'Attean::API::UnaryPropertyPath'; | |||||||||||||||||||||||||||||||
| 1181 | |||||||||||||||||||||||||||||||||
| 1182 | 0 | ▶ | sub postfix_name { return "?" } | ||||||||||||||||||||||||||||||
|
Subroutine
postfix_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1183 | 0 | ▶ | sub as_sparql { | ||||||||||||||||||||||||||||||
|
Subroutine
as_sparql: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1184 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1185 | 0 | my ($path) = @{ $self->children }; | |||||||||||||||||||||||||||||||
| 1186 | 0 | return $self->path->as_sparql . '?'; | |||||||||||||||||||||||||||||||
| 1187 | } | ||||||||||||||||||||||||||||||||
| 1188 | |||||||||||||||||||||||||||||||||
| 1189 | 2 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1190 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1191 | 2 | my $q = AtteanX::SPARQL::Token->question; | |||||||||||||||||||||||||||||||
| 1192 | 2 | my $l = AtteanX::SPARQL::Token->lparen; | |||||||||||||||||||||||||||||||
| 1193 | 2 | my $r = AtteanX::SPARQL::Token->rparen; | |||||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||||||
| 1195 | 2 | my @tokens; | |||||||||||||||||||||||||||||||
| 1196 | 2 | foreach my $t (@{ $self->children }) { | |||||||||||||||||||||||||||||||
| 1197 | 2 | push(@tokens, $t->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1198 | } | ||||||||||||||||||||||||||||||||
| 1199 | |||||||||||||||||||||||||||||||||
| 1200 | 2 | ▶ | if (scalar(@tokens) > 1) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1201 | 2 | unshift(@tokens, $l); | |||||||||||||||||||||||||||||||
| 1202 | 2 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 1203 | } | ||||||||||||||||||||||||||||||||
| 1204 | 2 | push(@tokens, $q); | |||||||||||||||||||||||||||||||
| 1205 | |||||||||||||||||||||||||||||||||
| 1206 | 2 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 1207 | } | ||||||||||||||||||||||||||||||||
| 1208 | } | ||||||||||||||||||||||||||||||||
| 1209 | |||||||||||||||||||||||||||||||||
| 1210 | =item * L<Attean::Algebra::Table> | ||||||||||||||||||||||||||||||||
| 1211 | |||||||||||||||||||||||||||||||||
| 1212 | =cut | ||||||||||||||||||||||||||||||||
| 1213 | |||||||||||||||||||||||||||||||||
| 1214 | 50 | package Attean::Algebra::Table 0.040 { | |||||||||||||||||||||||||||||||
| 1215 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1216 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1217 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1218 | 50 | ▶ | use Types::Standard qw(ArrayRef ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1219 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1220 | |||||||||||||||||||||||||||||||||
| 1221 | 50 | with 'Attean::API::Algebra', 'Attean::API::NullaryQueryTree'; | |||||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||||||
| 1223 | 50 | has variables => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::Variable']]); | |||||||||||||||||||||||||||||||
| 1224 | 50 | has rows => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::Result']]); | |||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||
| 1226 | 2 | ▶ | sub BUILD { | ||||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1227 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1228 | 2 | my %seen; | |||||||||||||||||||||||||||||||
| 1229 | 2 | foreach my $v (@{ $self->variables }) { | |||||||||||||||||||||||||||||||
| 1230 | 2 | ▶ | if ($seen{$v->value}++) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1231 | 0 | die "Repeated use of variable " . $v->value . " in VALUES clause"; | |||||||||||||||||||||||||||||||
| 1232 | } | ||||||||||||||||||||||||||||||||
| 1233 | } | ||||||||||||||||||||||||||||||||
| 1234 | } | ||||||||||||||||||||||||||||||||
| 1235 | |||||||||||||||||||||||||||||||||
| 1236 | 2 | ▶ | sub in_scope_variables { | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1237 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1238 | 2 | return map { $_->value } @{ $self->variables }; | |||||||||||||||||||||||||||||||
| 1239 | } | ||||||||||||||||||||||||||||||||
| 1240 | 0 | ▶ | sub tree_attributes { return qw(variables rows) }; | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1241 | 1 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1242 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1243 | 1 | return sprintf('Table (%d rows)', scalar(@{ $self->rows })); | |||||||||||||||||||||||||||||||
| 1244 | } | ||||||||||||||||||||||||||||||||
| 1245 | |||||||||||||||||||||||||||||||||
| 1246 | 2 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1247 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1248 | 2 | my $values = AtteanX::SPARQL::Token->keyword('VALUES'); | |||||||||||||||||||||||||||||||
| 1249 | 2 | my $lparen = AtteanX::SPARQL::Token->lparen; | |||||||||||||||||||||||||||||||
| 1250 | 2 | my $rparen = AtteanX::SPARQL::Token->rparen; | |||||||||||||||||||||||||||||||
| 1251 | 2 | my $lbrace = AtteanX::SPARQL::Token->lbrace; | |||||||||||||||||||||||||||||||
| 1252 | 2 | my $rbrace = AtteanX::SPARQL::Token->rbrace; | |||||||||||||||||||||||||||||||
| 1253 | |||||||||||||||||||||||||||||||||
| 1254 | 2 | my @tokens; | |||||||||||||||||||||||||||||||
| 1255 | 2 | push(@tokens, $values); | |||||||||||||||||||||||||||||||
| 1256 | 2 | push(@tokens, $lparen); | |||||||||||||||||||||||||||||||
| 1257 | 2 | foreach my $var (@{ $self->variables }) { | |||||||||||||||||||||||||||||||
| 1258 | 2 | push(@tokens, $var->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1259 | } | ||||||||||||||||||||||||||||||||
| 1260 | 2 | push(@tokens, $rparen); | |||||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||||||
| 1262 | 2 | push(@tokens, $lbrace); | |||||||||||||||||||||||||||||||
| 1263 | 2 | foreach my $row (@{ $self->rows }) { | |||||||||||||||||||||||||||||||
| 1264 | 4 | push(@tokens, $lparen); | |||||||||||||||||||||||||||||||
| 1265 | 4 | foreach my $val ($row->values) { | |||||||||||||||||||||||||||||||
| 1266 | # TODO: verify correct serialization of UNDEF | ||||||||||||||||||||||||||||||||
| 1267 | 4 | push(@tokens, $val->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1268 | } | ||||||||||||||||||||||||||||||||
| 1269 | 4 | push(@tokens, $rparen); | |||||||||||||||||||||||||||||||
| 1270 | } | ||||||||||||||||||||||||||||||||
| 1271 | 2 | push(@tokens, $rbrace); | |||||||||||||||||||||||||||||||
| 1272 | |||||||||||||||||||||||||||||||||
| 1273 | 2 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 1274 | } | ||||||||||||||||||||||||||||||||
| 1275 | } | ||||||||||||||||||||||||||||||||
| 1276 | |||||||||||||||||||||||||||||||||
| 1277 | =item * L<Attean::Algebra::Ask> | ||||||||||||||||||||||||||||||||
| 1278 | |||||||||||||||||||||||||||||||||
| 1279 | =cut | ||||||||||||||||||||||||||||||||
| 1280 | |||||||||||||||||||||||||||||||||
| 1281 | 50 | package Attean::Algebra::Ask 0.040 { | |||||||||||||||||||||||||||||||
| 1282 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1283 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1284 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1285 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1286 | |||||||||||||||||||||||||||||||||
| 1287 | 50 | with 'Attean::API::SPARQLQuerySerializable'; | |||||||||||||||||||||||||||||||
| 1288 | 50 | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | |||||||||||||||||||||||||||||||
| 1289 | |||||||||||||||||||||||||||||||||
| 1290 | 0 | ▶ | sub in_scope_variables { return; } | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||||||
| 1292 | 1 | ▶ | sub algebra_as_string { return 'Ask' } | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1293 | } | ||||||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||||||
| 1295 | =item * L<Attean::Algebra::Construct> | ||||||||||||||||||||||||||||||||
| 1296 | |||||||||||||||||||||||||||||||||
| 1297 | =cut | ||||||||||||||||||||||||||||||||
| 1298 | |||||||||||||||||||||||||||||||||
| 1299 | 50 | package Attean::Algebra::Construct 0.040 { | |||||||||||||||||||||||||||||||
| 1300 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1301 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1302 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1303 | 50 | ▶ | use Types::Standard qw(ArrayRef ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1304 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1305 | |||||||||||||||||||||||||||||||||
| 1306 | 50 | with 'Attean::API::SPARQLQuerySerializable'; | |||||||||||||||||||||||||||||||
| 1307 | 50 | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | |||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||
| 1309 | 50 | has 'triples' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::TriplePattern']]); | |||||||||||||||||||||||||||||||
| 1310 | |||||||||||||||||||||||||||||||||
| 1311 | 0 | ▶ | sub in_scope_variables { return qw(subject predicate object); } | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1312 | 0 | ▶ | sub tree_attributes { return; } | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1313 | 3 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1314 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1315 | 3 | my $triples = $self->triples; | |||||||||||||||||||||||||||||||
| 1316 | 3 | return sprintf('Construct { %s }', join(' ', map { $_->as_string } @$triples)); | |||||||||||||||||||||||||||||||
| 1317 | } | ||||||||||||||||||||||||||||||||
| 1318 | } | ||||||||||||||||||||||||||||||||
| 1319 | |||||||||||||||||||||||||||||||||
| 1320 | =item * L<Attean::Algebra::Describe> | ||||||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||||||
| 1322 | =cut | ||||||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||||||
| 1324 | 50 | package Attean::Algebra::Describe 0.040 { | |||||||||||||||||||||||||||||||
| 1325 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1326 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1327 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1328 | 50 | ▶ | use Types::Standard qw(ArrayRef ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1329 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||||||
| 1331 | 50 | with 'Attean::API::SPARQLQuerySerializable'; | |||||||||||||||||||||||||||||||
| 1332 | 50 | with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree'; | |||||||||||||||||||||||||||||||
| 1333 | |||||||||||||||||||||||||||||||||
| 1334 | 50 | has 'terms' => (is => 'ro', isa => ArrayRef[ConsumerOf['Attean::API::TermOrVariable']]); | |||||||||||||||||||||||||||||||
| 1335 | |||||||||||||||||||||||||||||||||
| 1336 | 0 | ▶ | sub in_scope_variables { return qw(subject predicate object); } | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1337 | 0 | ▶ | sub tree_attributes { return; } | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1338 | 0 | ▶ | sub algebra_as_string { return 'Describe' } | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1339 | } | ||||||||||||||||||||||||||||||||
| 1340 | |||||||||||||||||||||||||||||||||
| 1341 | =item * L<Attean::Algebra::Load> | ||||||||||||||||||||||||||||||||
| 1342 | |||||||||||||||||||||||||||||||||
| 1343 | =cut | ||||||||||||||||||||||||||||||||
| 1344 | |||||||||||||||||||||||||||||||||
| 1345 | 50 | package Attean::Algebra::Load 0.040 { | |||||||||||||||||||||||||||||||
| 1346 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1347 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1348 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1349 | 50 | ▶ | use Types::Standard qw(Bool ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1350 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1351 | |||||||||||||||||||||||||||||||||
| 1352 | 50 | with 'Attean::API::Algebra', 'Attean::API::NullaryQueryTree'; | |||||||||||||||||||||||||||||||
| 1353 | |||||||||||||||||||||||||||||||||
| 1354 | 50 | has 'silent' => (is => 'ro', isa => Bool, default => 0); | |||||||||||||||||||||||||||||||
| 1355 | 50 | has 'url' => (is => 'ro', isa => ConsumerOf['Attean::API::IRI'], required => 1); | |||||||||||||||||||||||||||||||
| 1356 | 50 | has 'graph' => (is => 'ro', isa => ConsumerOf['Attean::API::Term'], predicate => 'has_graph'); | |||||||||||||||||||||||||||||||
| 1357 | |||||||||||||||||||||||||||||||||
| 1358 | 0 | ▶ | sub in_scope_variables { return; } | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1359 | 0 | ▶ | sub tree_attributes { return; } | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1360 | 0 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1361 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1362 | 0 | return 'Load ' . $self->url->as_string; | |||||||||||||||||||||||||||||||
| 1363 | } | ||||||||||||||||||||||||||||||||
| 1364 | |||||||||||||||||||||||||||||||||
| 1365 | 0 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1366 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1367 | |||||||||||||||||||||||||||||||||
| 1368 | 0 | my @tokens; | |||||||||||||||||||||||||||||||
| 1369 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('LOAD')); | |||||||||||||||||||||||||||||||
| 1370 | 0 | ▶ | if ($self->silent) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1371 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('SILENT')); | |||||||||||||||||||||||||||||||
| 1372 | } | ||||||||||||||||||||||||||||||||
| 1373 | 0 | push(@tokens, $self->url->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1374 | |||||||||||||||||||||||||||||||||
| 1375 | 0 | ▶ | if ($self->has_graph) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1376 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('INTO')); | |||||||||||||||||||||||||||||||
| 1377 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('GRAPH')); | |||||||||||||||||||||||||||||||
| 1378 | 0 | push(@tokens, $self->graph->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1379 | } | ||||||||||||||||||||||||||||||||
| 1380 | 0 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 1381 | } | ||||||||||||||||||||||||||||||||
| 1382 | } | ||||||||||||||||||||||||||||||||
| 1383 | |||||||||||||||||||||||||||||||||
| 1384 | =item * L<Attean::Algebra::Clear> | ||||||||||||||||||||||||||||||||
| 1385 | |||||||||||||||||||||||||||||||||
| 1386 | =cut | ||||||||||||||||||||||||||||||||
| 1387 | |||||||||||||||||||||||||||||||||
| 1388 | 50 | package Attean::Algebra::Clear 0.040 { | |||||||||||||||||||||||||||||||
| 1389 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1390 | 50 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1391 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1392 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1393 | 50 | ▶ | use Types::Standard qw(Enum Bool ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1394 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1395 | |||||||||||||||||||||||||||||||||
| 1396 | 50 | with 'Attean::API::Algebra', 'Attean::API::NullaryQueryTree'; | |||||||||||||||||||||||||||||||
| 1397 | |||||||||||||||||||||||||||||||||
| 1398 | 50 | has 'drop' => (is => 'ro', isa => Bool, default => 0); | |||||||||||||||||||||||||||||||
| 1399 | 50 | has 'silent' => (is => 'ro', isa => Bool, default => 0); | |||||||||||||||||||||||||||||||
| 1400 | 50 | has 'target' => (is => 'ro', isa => Enum[qw(GRAPH DEFAULT NAMED ALL)], required => 1); | |||||||||||||||||||||||||||||||
| 1401 | 50 | has 'graph' => (is => 'ro', isa => ConsumerOf['Attean::API::Term']); | |||||||||||||||||||||||||||||||
| 1402 | |||||||||||||||||||||||||||||||||
| 1403 | 0 | ▶ | sub BUILD { | ||||||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1404 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1405 | 0 | ▶ | if ($self->target eq 'GRAPH') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1406 | 0 | ▶ | unless (blessed($self->graph)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1407 | 0 | die "Attean::Algebra::Clear operations with a GRAPH target must include a graph IRI"; | |||||||||||||||||||||||||||||||
| 1408 | } | ||||||||||||||||||||||||||||||||
| 1409 | } | ||||||||||||||||||||||||||||||||
| 1410 | } | ||||||||||||||||||||||||||||||||
| 1411 | |||||||||||||||||||||||||||||||||
| 1412 | 0 | ▶ | sub in_scope_variables { return; } | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1413 | 0 | ▶ | sub tree_attributes { return; } | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1414 | 0 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1415 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1416 | 0 | ▶ | return $self->drop ? 'Drop' : 'Clear'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1417 | } | ||||||||||||||||||||||||||||||||
| 1418 | |||||||||||||||||||||||||||||||||
| 1419 | 0 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1420 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1421 | |||||||||||||||||||||||||||||||||
| 1422 | 0 | my @tokens; | |||||||||||||||||||||||||||||||
| 1423 | 0 | ▶ | push(@tokens, AtteanX::SPARQL::Token->keyword($self->drop ? 'DROP' : 'CLEAR')); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1424 | 0 | ▶ | if ($self->silent) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1425 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('SILENT')); | |||||||||||||||||||||||||||||||
| 1426 | } | ||||||||||||||||||||||||||||||||
| 1427 | |||||||||||||||||||||||||||||||||
| 1428 | 0 | ▶ | if ($self->target =~ /^(DEFAULT|NAMED|ALL)$/) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1429 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword($self->target)); | |||||||||||||||||||||||||||||||
| 1430 | } else { | ||||||||||||||||||||||||||||||||
| 1431 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('GRAPH')); | |||||||||||||||||||||||||||||||
| 1432 | 0 | push(@tokens, $self->graph->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1433 | } | ||||||||||||||||||||||||||||||||
| 1434 | 0 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 1435 | } | ||||||||||||||||||||||||||||||||
| 1436 | } | ||||||||||||||||||||||||||||||||
| 1437 | |||||||||||||||||||||||||||||||||
| 1438 | =item * L<Attean::Algebra::Create> | ||||||||||||||||||||||||||||||||
| 1439 | |||||||||||||||||||||||||||||||||
| 1440 | =cut | ||||||||||||||||||||||||||||||||
| 1441 | |||||||||||||||||||||||||||||||||
| 1442 | 50 | package Attean::Algebra::Create 0.040 { | |||||||||||||||||||||||||||||||
| 1443 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1444 | 50 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1445 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1446 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1447 | 50 | ▶ | use Types::Standard qw(Bool ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1448 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1449 | |||||||||||||||||||||||||||||||||
| 1450 | 50 | with 'Attean::API::Algebra', 'Attean::API::NullaryQueryTree'; | |||||||||||||||||||||||||||||||
| 1451 | |||||||||||||||||||||||||||||||||
| 1452 | 50 | has 'silent' => (is => 'ro', isa => Bool, default => 0); | |||||||||||||||||||||||||||||||
| 1453 | 50 | has 'graph' => (is => 'ro', isa => ConsumerOf['Attean::API::Term'], required => 1); | |||||||||||||||||||||||||||||||
| 1454 | |||||||||||||||||||||||||||||||||
| 1455 | 0 | ▶ | sub in_scope_variables { return; } | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1456 | 0 | ▶ | sub tree_attributes { return; } | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1457 | 0 | ▶ | sub algebra_as_string { return 'Create' } | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1458 | |||||||||||||||||||||||||||||||||
| 1459 | 0 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1460 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||||||
| 1462 | 0 | my @tokens; | |||||||||||||||||||||||||||||||
| 1463 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('CREATE')); | |||||||||||||||||||||||||||||||
| 1464 | 0 | ▶ | if ($self->silent) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1465 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('SILENT')); | |||||||||||||||||||||||||||||||
| 1466 | } | ||||||||||||||||||||||||||||||||
| 1467 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('GRAPH')); | |||||||||||||||||||||||||||||||
| 1468 | 0 | push(@tokens, $self->graph->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1469 | 0 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 1470 | } | ||||||||||||||||||||||||||||||||
| 1471 | } | ||||||||||||||||||||||||||||||||
| 1472 | |||||||||||||||||||||||||||||||||
| 1473 | =item * L<Attean::Algebra::Add> | ||||||||||||||||||||||||||||||||
| 1474 | |||||||||||||||||||||||||||||||||
| 1475 | =cut | ||||||||||||||||||||||||||||||||
| 1476 | |||||||||||||||||||||||||||||||||
| 1477 | 50 | package Attean::Algebra::Add 0.040 { | |||||||||||||||||||||||||||||||
| 1478 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1479 | 50 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1480 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1481 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1482 | 50 | ▶ | use Types::Standard qw(Enum Bool ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1483 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1484 | |||||||||||||||||||||||||||||||||
| 1485 | 50 | with 'Attean::API::Algebra', 'Attean::API::NullaryQueryTree'; | |||||||||||||||||||||||||||||||
| 1486 | |||||||||||||||||||||||||||||||||
| 1487 | 50 | has 'silent' => (is => 'ro', isa => Bool, default => 0); | |||||||||||||||||||||||||||||||
| 1488 | 50 | has 'drop_source' => (is => 'ro', isa => Bool, default => 0); | |||||||||||||||||||||||||||||||
| 1489 | 50 | has 'drop_destination' => (is => 'ro', isa => Bool, default => 0); | |||||||||||||||||||||||||||||||
| 1490 | |||||||||||||||||||||||||||||||||
| 1491 | 50 | has 'source' => (is => 'ro', isa => ConsumerOf['Attean::API::Term'], predicate => 'has_source'); | |||||||||||||||||||||||||||||||
| 1492 | 50 | has 'destination' => (is => 'ro', isa => ConsumerOf['Attean::API::Term'], predicate => 'has_destination'); | |||||||||||||||||||||||||||||||
| 1493 | |||||||||||||||||||||||||||||||||
| 1494 | 1 | ▶ | sub in_scope_variables { return; } | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1495 | 0 | ▶ | sub tree_attributes { return; } | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1496 | 3 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=4 SCAR=16.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1497 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1498 | 3 | ▶ | return ($self->drop_source and $self->drop_destination) ? 'Move' : ($self->drop_destination) ? 'Copy' : 'Add'; | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$self->drop_source and $self->drop_destination
MC/DC0%0/2
$self->drop_source and $self->drop_destination
$self->drop_source
$self->drop_destination
Truth table33%1/3
A and B
A= $self->drop_sourceB= $self->drop_destination
| |||||||||||||||||||||||||||||||||
| 1499 | } | ||||||||||||||||||||||||||||||||
| 1500 | |||||||||||||||||||||||||||||||||
| 1501 | 0 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1502 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1503 | |||||||||||||||||||||||||||||||||
| 1504 | 0 | my @tokens; | |||||||||||||||||||||||||||||||
| 1505 | 0 | ▶ | my $op = ($self->drop_source and $self->drop_destination) ? 'MOVE' : ($self->drop_destination) ? 'COPY' : 'ADD'; | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$self->drop_source and $self->drop_destination
MC/DC0%0/2
$self->drop_source and $self->drop_destination
$self->drop_source
$self->drop_destination
Truth table0%0/3
A and B
A= $self->drop_sourceB= $self->drop_destination
| |||||||||||||||||||||||||||||||||
| 1506 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword($op)); | |||||||||||||||||||||||||||||||
| 1507 | 0 | ▶ | if ($self->silent) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1508 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('SILENT')); | |||||||||||||||||||||||||||||||
| 1509 | } | ||||||||||||||||||||||||||||||||
| 1510 | |||||||||||||||||||||||||||||||||
| 1511 | 0 | ▶ | if ($self->has_source) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1512 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('GRAPH')); | |||||||||||||||||||||||||||||||
| 1513 | 0 | push(@tokens, $self->source->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1514 | } else { | ||||||||||||||||||||||||||||||||
| 1515 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('DEFAULT')); | |||||||||||||||||||||||||||||||
| 1516 | } | ||||||||||||||||||||||||||||||||
| 1517 | |||||||||||||||||||||||||||||||||
| 1518 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('TO')); | |||||||||||||||||||||||||||||||
| 1519 | |||||||||||||||||||||||||||||||||
| 1520 | 0 | ▶ | if ($self->has_destination) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1521 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('GRAPH')); | |||||||||||||||||||||||||||||||
| 1522 | 0 | push(@tokens, $self->destination->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1523 | } else { | ||||||||||||||||||||||||||||||||
| 1524 | 0 | push(@tokens, AtteanX::SPARQL::Token->keyword('DEFAULT')); | |||||||||||||||||||||||||||||||
| 1525 | } | ||||||||||||||||||||||||||||||||
| 1526 | |||||||||||||||||||||||||||||||||
| 1527 | 0 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 1528 | } | ||||||||||||||||||||||||||||||||
| 1529 | } | ||||||||||||||||||||||||||||||||
| 1530 | |||||||||||||||||||||||||||||||||
| 1531 | =item * L<Attean::Algebra::Modify> | ||||||||||||||||||||||||||||||||
| 1532 | |||||||||||||||||||||||||||||||||
| 1533 | =cut | ||||||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||||||
| 1535 | 50 | package Attean::Algebra::Modify 0.040 { | |||||||||||||||||||||||||||||||
| 1536 | 50 | ▶ | use Moo; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1537 | 50 | ▶ | use Scalar::Util qw(blessed reftype); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1538 | 50 | ▶ | use AtteanX::SPARQL::Constants; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1539 | 50 | ▶ | use AtteanX::SPARQL::Token; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1540 | 50 | ▶ | use List::Util qw(all any); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1541 | 50 | ▶ | use Types::Standard qw(Bool HashRef ArrayRef ConsumerOf); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1542 | 50 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1543 | |||||||||||||||||||||||||||||||||
| 1544 | 50 | with 'Attean::API::Algebra', 'Attean::API::QueryTree'; | |||||||||||||||||||||||||||||||
| 1545 | |||||||||||||||||||||||||||||||||
| 1546 | 2 | ▶ | has 'dataset' => (is => 'ro', isa => HashRef, default => sub { +{} }); | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1547 | 6 | ▶ | has 'insert' => (is => 'ro', isa => ConsumerOf['Attean::API::MixedPatternIterator'], default => sub { Attean::ListIterator->new(values => [], item_type => 'Attean::API::TripleOrQuadPattern') }); | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1548 | 2 | ▶ | has 'delete' => (is => 'ro', isa => ConsumerOf['Attean::API::MixedPatternIterator'], default => sub { Attean::ListIterator->new(values => [], item_type => 'Attean::API::TripleOrQuadPattern') }); | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1549 | 50 | has 'specifies_dataset' => (is => 'ro', isa => Bool, default => 0); | |||||||||||||||||||||||||||||||
| 1550 | |||||||||||||||||||||||||||||||||
| 1551 | 1 | ▶ | sub in_scope_variables { return; } | ||||||||||||||||||||||||||||||
|
Subroutine
in_scope_variables: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1552 | 0 | ▶ | sub tree_attributes { return; } | ||||||||||||||||||||||||||||||
|
Subroutine
tree_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1553 | |||||||||||||||||||||||||||||||||
| 1554 | 8 | ▶ | around 'BUILDARGS' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||
| 1555 | 8 | my $orig = shift; | |||||||||||||||||||||||||||||||
| 1556 | 8 | my $class = shift; | |||||||||||||||||||||||||||||||
| 1557 | 8 | my @args = @_; | |||||||||||||||||||||||||||||||
| 1558 | 8 | my $args = {@args}; | |||||||||||||||||||||||||||||||
| 1559 | |||||||||||||||||||||||||||||||||
| 1560 | 8 | ▶ | if (my $insert = $args->{'insert'} and reftype($args->{'insert'}) eq 'ARRAY') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
my $insert = $args->{"insert"} and builtin::reftype($args->{"insert"}) eq "ARRAY"
MC/DC50%1/2
my $insert = $args->{"insert"} and builtin::reftype($args->{"insert"}) eq "ARRAY"
my $insert = $args->{"insert"}
builtin::reftype($args->{"insert"}) eq "ARRAY"
Truth table66%2/3
A and B
A= my $insert = $args->{"insert"}B= builtin::reftype($args->{"insert"}) eq "ARRAY"
| |||||||||||||||||||||||||||||||||
| 1561 | 2 | $args->{'insert'} = Attean::ListIterator->new(values => $insert, item_type => 'Attean::API::TripleOrQuadPattern'); | |||||||||||||||||||||||||||||||
| 1562 | } | ||||||||||||||||||||||||||||||||
| 1563 | 8 | ▶ | if (my $delete = $args->{'delete'} and reftype($args->{'delete'}) eq 'ARRAY') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
my $delete = $args->{"delete"} and builtin::reftype($args->{"delete"}) eq "ARRAY"
MC/DC50%1/2
my $delete = $args->{"delete"} and builtin::reftype($args->{"delete"}) eq "ARRAY"
my $delete = $args->{"delete"}
builtin::reftype($args->{"delete"}) eq "ARRAY"
Truth table66%2/3
A and B
A= my $delete = $args->{"delete"}B= builtin::reftype($args->{"delete"}) eq "ARRAY"
| |||||||||||||||||||||||||||||||||
| 1564 | 6 | $args->{'delete'} = Attean::ListIterator->new(values => $delete, item_type => 'Attean::API::TripleOrQuadPattern'); | |||||||||||||||||||||||||||||||
| 1565 | } | ||||||||||||||||||||||||||||||||
| 1566 | |||||||||||||||||||||||||||||||||
| 1567 | 8 | return $orig->( $class, $args ); | |||||||||||||||||||||||||||||||
| 1568 | 50 | }; | |||||||||||||||||||||||||||||||
| 1569 | |||||||||||||||||||||||||||||||||
| 1570 | 18 | ▶ | sub materialize { | ||||||||||||||||||||||||||||||
|
Subroutine
materialize: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1571 | 18 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1572 | 18 | $self->{'insert'} = $self->insert->materialize; | |||||||||||||||||||||||||||||||
| 1573 | 18 | $self->{'delete'} = $self->delete->materialize; | |||||||||||||||||||||||||||||||
| 1574 | 18 | return $self; | |||||||||||||||||||||||||||||||
| 1575 | } | ||||||||||||||||||||||||||||||||
| 1576 | |||||||||||||||||||||||||||||||||
| 1577 | 8 | ▶ | sub _op_type { | ||||||||||||||||||||||||||||||
|
Subroutine
_op_type: called CC=9 SCAR=22.6
| |||||||||||||||||||||||||||||||||
| 1578 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1579 | 8 | $self->materialize; | |||||||||||||||||||||||||||||||
| 1580 | 8 | my $insert = $self->insert; | |||||||||||||||||||||||||||||||
| 1581 | 8 | my $delete = $self->delete; | |||||||||||||||||||||||||||||||
| 1582 | 8 | my $i = $insert->size; | |||||||||||||||||||||||||||||||
| 1583 | 8 | my $d = $delete->size; | |||||||||||||||||||||||||||||||
| 1584 | 8 | my $w = scalar(@{ $self->children }); | |||||||||||||||||||||||||||||||
| 1585 | 8 | ▶ | my $ig = all { $_->is_ground } $insert->elements; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1586 | 8 | ▶ | my $dg = all { $_->is_ground } $delete->elements; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 1587 | 8 | ▶ | if ($i and not $d) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$i and not $d
MC/DC50%1/2
$i and not $d
$i
not $d
Truth table66%2/3
A and not(B)
A= $iB= not $d
| |||||||||||||||||||||||||||||||||
| 1588 | # INSERT | ||||||||||||||||||||||||||||||||
| 1589 | 2 | ▶ | return ($ig and not $w) ? 'ID' : 'I'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$ig and not $w
MC/DC50%1/2
$ig and not $w
$ig
not $w
Truth table66%2/3
A and not(B)
A= $igB= not $w
| |||||||||||||||||||||||||||||||||
| 1590 | ▶ | } elsif ($d and not $i) { | |||||||||||||||||||||||||||||||
|
Condition33%1/3
$d and not $i
MC/DC0%0/2
$d and not $i
$d
not $i
Truth table33%1/3
A and not(B)
A= $dB= not $i
| |||||||||||||||||||||||||||||||||
| 1591 | # DELETE | ||||||||||||||||||||||||||||||||
| 1592 | 6 | ▶ | return ($dg and not $w) ? 'DD' : 'D'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$dg and not $w
MC/DC50%1/2
$dg and not $w
$dg
not $w
Truth table66%2/3
A and not(B)
A= $dgB= not $w
| |||||||||||||||||||||||||||||||||
| 1593 | } else { | ||||||||||||||||||||||||||||||||
| 1594 | # INSERT + DELETE | ||||||||||||||||||||||||||||||||
| 1595 | 0 | return 'U' | |||||||||||||||||||||||||||||||
| 1596 | } | ||||||||||||||||||||||||||||||||
| 1597 | } | ||||||||||||||||||||||||||||||||
| 1598 | |||||||||||||||||||||||||||||||||
| 1599 | 2 | ▶ | around 'blank_nodes' => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||
| 1600 | 2 | my $orig = shift; | |||||||||||||||||||||||||||||||
| 1601 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1602 | 2 | my @blanks = $orig->($self, @_); | |||||||||||||||||||||||||||||||
| 1603 | 2 | $self->materialize; | |||||||||||||||||||||||||||||||
| 1604 | 0 | my %seen = map { $_->value => 1 } @blanks; | |||||||||||||||||||||||||||||||
| 1605 | 2 | foreach my $data ($self->insert, $self->delete) { | |||||||||||||||||||||||||||||||
| 1606 | 4 | my @triples = $data->elements; | |||||||||||||||||||||||||||||||
| 1607 | 4 | my @b = grep { $_->does('Attean::API::Blank') } map { $_->values } @triples; | |||||||||||||||||||||||||||||||
| 1608 | 0 | push(@blanks, grep { not $seen{$_->value}++ } @b); | |||||||||||||||||||||||||||||||
| 1609 | } | ||||||||||||||||||||||||||||||||
| 1610 | 2 | return @blanks; | |||||||||||||||||||||||||||||||
| 1611 | 50 | }; | |||||||||||||||||||||||||||||||
| 1612 | |||||||||||||||||||||||||||||||||
| 1613 | 1 | ▶ | sub algebra_as_string { | ||||||||||||||||||||||||||||||
|
Subroutine
algebra_as_string: called CC=7 SCAR=20.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1614 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1615 | 1 | my $level = shift; | |||||||||||||||||||||||||||||||
| 1616 | 1 | my $indent = ' ' x ($level + 1); | |||||||||||||||||||||||||||||||
| 1617 | 1 | state $S = { | |||||||||||||||||||||||||||||||
| 1618 | 'ID' => 'Insert Data', | ||||||||||||||||||||||||||||||||
| 1619 | 'I' => 'Insert', | ||||||||||||||||||||||||||||||||
| 1620 | 'DD' => 'Delete Data', | ||||||||||||||||||||||||||||||||
| 1621 | 'D' => 'Delete', | ||||||||||||||||||||||||||||||||
| 1622 | 'U' => 'Update', | ||||||||||||||||||||||||||||||||
| 1623 | }; | ||||||||||||||||||||||||||||||||
| 1624 | |||||||||||||||||||||||||||||||||
| 1625 | 1 | $self->materialize; | |||||||||||||||||||||||||||||||
| 1626 | 1 | my $op = $self->_op_type(); | |||||||||||||||||||||||||||||||
| 1627 | 1 | my $s = $S->{ $op }; | |||||||||||||||||||||||||||||||
| 1628 | 1 | my @data; | |||||||||||||||||||||||||||||||
| 1629 | 1 | my $ic = $self->insert->size; | |||||||||||||||||||||||||||||||
| 1630 | 1 | my $dc = $self->delete->size; | |||||||||||||||||||||||||||||||
| 1631 | 1 | ▶ | if ($ic) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1632 | 1 | ▶ | my $name = $dc ? 'Insert Data' : 'Data'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1633 | 1 | push(@data, [$name, $self->insert]); | |||||||||||||||||||||||||||||||
| 1634 | } | ||||||||||||||||||||||||||||||||
| 1635 | 1 | ▶ | if ($dc) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1636 | 0 | ▶ | my $name = $ic ? 'Delete Data' : 'Data'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1637 | 0 | push(@data, [$name, $self->delete]); | |||||||||||||||||||||||||||||||
| 1638 | } | ||||||||||||||||||||||||||||||||
| 1639 | 1 | foreach my $data (@data) { | |||||||||||||||||||||||||||||||
| 1640 | 1 | my ($name, $quads) = @$data; | |||||||||||||||||||||||||||||||
| 1641 | 1 | $s .= "\n-${indent} $name"; | |||||||||||||||||||||||||||||||
| 1642 | 1 | foreach my $q ($quads->elements) { | |||||||||||||||||||||||||||||||
| 1643 | 1 | $s .= "\n-${indent} " . $q->as_string; | |||||||||||||||||||||||||||||||
| 1644 | } | ||||||||||||||||||||||||||||||||
| 1645 | } | ||||||||||||||||||||||||||||||||
| 1646 | 1 | return $s; | |||||||||||||||||||||||||||||||
| 1647 | } | ||||||||||||||||||||||||||||||||
| 1648 | |||||||||||||||||||||||||||||||||
| 1649 | 7 | ▶ | sub sparql_tokens { | ||||||||||||||||||||||||||||||
|
Subroutine
sparql_tokens: called CC=21 SCAR=32.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1650 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||
| 1651 | 7 | my $op = $self->_op_type(); | |||||||||||||||||||||||||||||||
| 1652 | 7 | my $l = AtteanX::SPARQL::Token->lbrace; | |||||||||||||||||||||||||||||||
| 1653 | 7 | my $r = AtteanX::SPARQL::Token->rbrace; | |||||||||||||||||||||||||||||||
| 1654 | 7 | my $dot = AtteanX::SPARQL::Token->dot; | |||||||||||||||||||||||||||||||
| 1655 | 7 | my $data = AtteanX::SPARQL::Token->keyword('DATA'); | |||||||||||||||||||||||||||||||
| 1656 | 7 | my $insert = AtteanX::SPARQL::Token->keyword('INSERT'); | |||||||||||||||||||||||||||||||
| 1657 | 7 | my $delete = AtteanX::SPARQL::Token->keyword('DELETE'); | |||||||||||||||||||||||||||||||
| 1658 | 7 | my $where = AtteanX::SPARQL::Token->keyword('WHERE'); | |||||||||||||||||||||||||||||||
| 1659 | 7 | my $using = AtteanX::SPARQL::Token->keyword('USING'); | |||||||||||||||||||||||||||||||
| 1660 | 7 | my $named = AtteanX::SPARQL::Token->keyword('NAMED'); | |||||||||||||||||||||||||||||||
| 1661 | |||||||||||||||||||||||||||||||||
| 1662 | # TODO: Support 'DELETE WHERE' shortcut syntax | ||||||||||||||||||||||||||||||||
| 1663 | # TODO: Support WITH | ||||||||||||||||||||||||||||||||
| 1664 | |||||||||||||||||||||||||||||||||
| 1665 | 7 | $self->materialize; | |||||||||||||||||||||||||||||||
| 1666 | |||||||||||||||||||||||||||||||||
| 1667 | 7 | my @dataset; | |||||||||||||||||||||||||||||||
| 1668 | 7 | my $dataset = $self->dataset; | |||||||||||||||||||||||||||||||
| 1669 | 7 | ▶ | my @default = @{ $dataset->{default} || [] }; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$dataset->{'default'} || []
MC/DC100%1/1
$dataset->{'default'} || []
$dataset->{'default'}
Truth table100%2/2
A
A= $dataset->{'default'}
| |||||||||||||||||||||||||||||||||
| 1670 | 7 | ▶ | my @named = values %{ $dataset->{named} || {} }; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$dataset->{'named'} || {}
MC/DC100%1/1
$dataset->{'named'} || {}
$dataset->{'named'}
Truth table100%2/2
A
A= $dataset->{'named'}
| |||||||||||||||||||||||||||||||||
| 1671 | 7 | ▶ | if (scalar(@default) or scalar(@named)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
scalar @default or scalar @named
MC/DC100%1/1
scalar @default or scalar @named
scalar @default
Truth table100%2/2
A
A= scalar @default
| |||||||||||||||||||||||||||||||||
| 1672 | 4 | foreach my $g (sort { $a->as_string cmp $b->as_string } @default) { | |||||||||||||||||||||||||||||||
| 1673 | 6 | push(@dataset, $using, $g->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1674 | } | ||||||||||||||||||||||||||||||||
| 1675 | 4 | foreach my $g (sort { $a->as_string cmp $b->as_string } @named) { | |||||||||||||||||||||||||||||||
| 1676 | 3 | push(@dataset, $using, $named, $g->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1677 | } | ||||||||||||||||||||||||||||||||
| 1678 | } | ||||||||||||||||||||||||||||||||
| 1679 | |||||||||||||||||||||||||||||||||
| 1680 | 7 | my @tokens; | |||||||||||||||||||||||||||||||
| 1681 | 7 | ▶ | if ($op eq 'ID' or $op eq 'DD') { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$op eq "ID" or $op eq "DD"
MC/DC100%2/2
$op eq "ID" or $op eq "DD"
$op eq "ID"
$op eq "DD"
Truth table100%3/3
A or B
A= $op eq "ID"B= $op eq "DD"
| |||||||||||||||||||||||||||||||||
| 1682 | 2 | ▶ | my $statements = ($op eq 'ID') ? $self->insert : $self->delete; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1683 | 2 | ▶ | my $kw = ($op eq 'ID') ? $insert : $delete; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1684 | 2 | push(@tokens, $kw); | |||||||||||||||||||||||||||||||
| 1685 | 2 | push(@tokens, $data); | |||||||||||||||||||||||||||||||
| 1686 | 2 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 1687 | 2 | foreach my $t ($statements->elements) { | |||||||||||||||||||||||||||||||
| 1688 | 2 | push(@tokens, $t->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1689 | 2 | push(@tokens, $dot); | |||||||||||||||||||||||||||||||
| 1690 | } | ||||||||||||||||||||||||||||||||
| 1691 | 2 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 1692 | ▶ | } elsif ($op eq 'I' or $op eq 'D') { | |||||||||||||||||||||||||||||||
|
Condition33%1/3
$op eq "I" or $op eq "D"
MC/DC0%0/2
$op eq "I" or $op eq "D"
$op eq "I"
$op eq "D"
Truth table33%1/3
A or B
A= $op eq "I"B= $op eq "D"
| |||||||||||||||||||||||||||||||||
| 1693 | 5 | ▶ | my $statements = ($op eq 'I') ? $self->insert : $self->delete; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1694 | 5 | ▶ | my $kw = ($op eq 'I') ? $insert : $delete; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1695 | 5 | push(@tokens, $kw); | |||||||||||||||||||||||||||||||
| 1696 | 5 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 1697 | 5 | foreach my $t ($statements->elements) { | |||||||||||||||||||||||||||||||
| 1698 | 5 | push(@tokens, $t->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1699 | 5 | push(@tokens, $dot); | |||||||||||||||||||||||||||||||
| 1700 | } | ||||||||||||||||||||||||||||||||
| 1701 | 5 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 1702 | 5 | push(@tokens, @dataset); | |||||||||||||||||||||||||||||||
| 1703 | 5 | push(@tokens, $where); | |||||||||||||||||||||||||||||||
| 1704 | 5 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 1705 | 5 | foreach my $c (@{ $self->children }) { | |||||||||||||||||||||||||||||||
| 1706 | 5 | push(@tokens, $c->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1707 | } | ||||||||||||||||||||||||||||||||
| 1708 | 5 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 1709 | } else { | ||||||||||||||||||||||||||||||||
| 1710 | 0 | foreach my $x ([$delete, $self->delete], [$insert, $self->insert]) { | |||||||||||||||||||||||||||||||
| 1711 | 0 | my ($kw, $statements) = @$x; | |||||||||||||||||||||||||||||||
| 1712 | 0 | push(@tokens, $kw); | |||||||||||||||||||||||||||||||
| 1713 | 0 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 1714 | 0 | foreach my $t ($statements->elements) { | |||||||||||||||||||||||||||||||
| 1715 | 0 | push(@tokens, $t->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1716 | 0 | push(@tokens, $dot); | |||||||||||||||||||||||||||||||
| 1717 | } | ||||||||||||||||||||||||||||||||
| 1718 | 0 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 1719 | } | ||||||||||||||||||||||||||||||||
| 1720 | 0 | push(@tokens, @dataset); | |||||||||||||||||||||||||||||||
| 1721 | 0 | push(@tokens, $where); | |||||||||||||||||||||||||||||||
| 1722 | 0 | push(@tokens, $l); | |||||||||||||||||||||||||||||||
| 1723 | 0 | foreach my $c (@{ $self->children }) { | |||||||||||||||||||||||||||||||
| 1724 | 0 | push(@tokens, $c->sparql_tokens->elements); | |||||||||||||||||||||||||||||||
| 1725 | } | ||||||||||||||||||||||||||||||||
| 1726 | 0 | push(@tokens, $r); | |||||||||||||||||||||||||||||||
| 1727 | } | ||||||||||||||||||||||||||||||||
| 1728 | |||||||||||||||||||||||||||||||||
| 1729 | 7 | return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' ); | |||||||||||||||||||||||||||||||
| 1730 | } | ||||||||||||||||||||||||||||||||
| 1731 | } | ||||||||||||||||||||||||||||||||
| 1732 | |||||||||||||||||||||||||||||||||
| 1733 | 50 | 1; | |||||||||||||||||||||||||||||||
| 1734 | |||||||||||||||||||||||||||||||||
| 1735 | __END__ | ||||||||||||||||||||||||||||||||