Branch Coverage

blib/lib/Attean/SimpleQueryEvaluator.pm
Criterion Covered Total %
branch 129 484 26.6


line true false branch
101 0 65 unless $algebra
107 0 65 if ($algebra->isa('Attean::Algebra::Query') or $algebra->isa('Attean::Algebra::Update')) { }
21 44 elsif ($algebra->isa('Attean::Algebra::BGP')) { }
1 43 elsif ($algebra->isa('Attean::Algebra::Distinct') or $algebra->isa('Attean::Algebra::Reduced')) { }
2 41 elsif ($algebra->isa('Attean::Algebra::Extend')) { }
1 40 elsif ($algebra->isa('Attean::Algebra::Filter')) { }
3 37 elsif ($algebra->isa('Attean::Algebra::OrderBy')) { }
1 36 elsif ($algebra->isa('Attean::Algebra::Service')) { }
3 33 elsif ($algebra->isa('Attean::Algebra::Graph')) { }
0 33 elsif ($algebra->isa('Attean::Algebra::Group')) { }
2 31 elsif ($algebra->isa('Attean::Algebra::Join')) { }
0 31 elsif ($algebra->isa('Attean::Algebra::LeftJoin')) { }
0 31 elsif ($algebra->isa('Attean::Algebra::Minus')) { }
24 7 elsif ($algebra->isa('Attean::Algebra::Path')) { }
3 4 elsif ($algebra->isa('Attean::Algebra::Project')) { }
3 1 elsif ($algebra->isa('Attean::Algebra::Slice')) { }
0 1 elsif ($algebra->isa('Attean::Algebra::Union')) { }
0 1 elsif ($algebra->isa('Attean::Algebra::Ask')) { }
1 0 elsif ($algebra->isa('Attean::Algebra::Construct')) { }
0 0 elsif ($algebra->isa('Attean::Algebra::Table')) { }
111 0 21 if (scalar @triples == 0) { }
133 2 2 !$seen{$str} ? :
155 0 8 if ($val->does("Attean::API::Binding"))
160 8 0 if $val
171 4 0 $t ? :
187 0 16 if (&blessed($av) and $av->does('Attean::API::Binding') and not defined $bv && $bv->does('Attean::API::Binding')) { }
0 16 elsif (&blessed($bv) and $bv->does('Attean::API::Binding') and not defined $av && $av->does('Attean::API::Binding')) { }
192 16 0 $av ? :
193 0 16 if ($@)
197 6 10 if $dirs[$i] == 0
198 15 1 unless $c == 0
217 2 1 if $graph->does("Attean::API::Term")
223 1 1 if $g->value eq $self->default_graph->value
225 4 0 if (my $result = (shift())->join($gr)) { }
240 0 0 &blessed($_) ? :
244 0 0 if (&blessed($v) and $v->isa("Attean::ValueExpression") and $v->value->does("Attean::API::Variable") and $group_terms[$i])
248 0 0 unless exists $groups{$key}
252 0 0 if scalar @keys == 0
266 0 0 if $term
283 0 0 if (my $j = $lhs->join($rhs))
284 0 0 if ($expr_eval->evaluate_expression($expr, $j, $active_graph, {})->ebv)
290 0 0 unless $joined
301 0 0 if (my $j = $lhs->join($rhs)) { }
310 0 0 if (exists $lhs_dom{$rvar})
320 0 0 unless $compatible[$i] == 0 or $disjoint[$i] == 1
323 0 0 if $keep
333 13 11 if $path->isa("Attean::Algebra::PredicatePath")
334 0 11 if ($path->isa('Attean::Algebra::InversePath')) { }
0 11 elsif ($path->isa('Attean::Algebra::AlternativePath')) { }
1 10 elsif ($path->isa('Attean::Algebra::NegatedPropertySet')) { }
1 9 elsif ($path->isa('Attean::Algebra::SequencePath')) { }
4 5 elsif ($path->isa('Attean::Algebra::ZeroOrMorePath') or $path->isa('Attean::Algebra::OneOrMorePath')) { }
5 0 elsif ($path->isa('Attean::Algebra::ZeroOrOnePath')) { }
351 0 1 if $s->does("Attean::API::Variable")
352 1 0 if $o->does("Attean::API::Variable")
355 0 1 unless $q
360 0 1 if (scalar @children == 1) { }
371 1 0 $i == $#children ? :
384 3 1 if ($s->does('Attean::API::TermOrTriple') and $o->does('Attean::API::Variable')) { }
1 0 elsif ($s->does('Attean::API::Variable') and $o->does('Attean::API::Variable')) { }
0 0 elsif ($s->does('Attean::API::Variable') and $o->does('Attean::API::TermOrTriple')) { }
386 3 0 if ($path->isa('Attean::Algebra::ZeroOrMorePath')) { }
418 0 0 if $v->equals($o)
441 9 0 $t ? :
446 2 1 if $algebra->offset > 0
447 2 1 if $algebra->limit >= 0
459 0 0 $result ? :
468 1 1 unless $r
469 2 0 $t ? :
474 0 3 $_->does('Attean::API::TriplePattern') ? :
478 0 1 unless (&all(sub {
517 2 94 if (not $self->ground_blanks and $v->does('Attean::API::Blank')) { }
518 1 1 unless (exists $$blanks{$v->value})
536 0 6 if exists $$v{$term->as_string}
564 2 3 if ($s_term and $o_term) { }
1 2 elsif ($s_term) { }
1 1 elsif ($o_term) { }
566 1 1 if $s->equals($o)
624 0 127 if ($expr->isa('Attean::ExistsExpression')) { }
88 39 elsif ($expr->isa('Attean::ValueExpression')) { }
0 39 elsif ($expr->isa('Attean::UnaryExpression')) { }
35 4 elsif ($expr->isa('Attean::BinaryExpression')) { }
0 4 elsif ($expr->isa('Attean::FunctionExpression')) { }
0 4 elsif ($expr->isa('Attean::AggregateExpression')) { }
4 0 elsif ($expr->isa('Attean::CastExpression')) { }
632 0 0 $iter->next ? :
636 29 59 if ($node->does('Attean::API::Variable')) { }
644 0 0 if ($op eq '!') { }
0 0 elsif ($op eq '-' or $op eq '+') { }
647 0 0 $term->ebv ? :
652 0 0 unless &blessed($term) and $term->does("Attean::API::NumericLiteral")
661 9 26 if ($op eq '&&') { }
9 17 elsif ($op eq '||') { }
17 0 elsif ($op =~ m[^(?:[-+*/])$]u) { }
0 0 elsif ($op =~ /^!?=$/u) { }
0 0 elsif ($op =~ /^[<>]=?$/u) { }
666 1 8 unless $lbv or $rbv
667 1 1 unless $lbv or $rbv->ebv
668 1 1 unless $rbv or $lbv->ebv
669 2 4 unless $lbv and $rbv
670 1 3 $lbv->ebv && $rbv->ebv ? :
676 3 6 if $lbv and $lbv->ebv
678 2 4 unless $rbv
679 2 2 if $rbv->ebv
680 1 1 if $lbv
687 1 31 unless &blessed($_) and $_->does("Attean::API::NumericLiteral")
696 0 0 unless &blessed($_) and $_->does("Attean::API::TermOrTriple")
698 0 0 if ($lhs->does('Attean::API::Binding')) { }
703 0 0 if $op eq "!="
704 0 0 $ok ? :
711 0 0 unless $_->does("Attean::API::TermOrTriple")
712 0 0 if $_->does("Attean::API::IRI")
716 0 0 if $c < 0 and $op =~ /<=?/u or $c > 0 and $op =~ />=?/u or $c == 0 and $op =~ /=/u
730 0 0 if ($func eq 'IF') { }
0 0 elsif ($func eq 'IN' or $func eq 'NOTIN') { }
0 0 elsif ($func eq 'COALESCE') { }
732 0 0 $term->ebv ? :
734 0 0 if $func eq "NOTIN"
738 0 0 if (my $value = eval {
739 0 0 if $term->equals($value)
746 0 0 if $@
747 0 0 if $t
753 0 0 if ($func =~ /^(STR)$/u) { }
0 0 elsif ($func =~ /^(SUBJECT|PREDICATE|OBJECT)$/u) { }
0 0 elsif ($func =~ /^([UI]RI)$/u) { }
0 0 elsif ($func eq 'BNODE') { }
0 0 elsif ($func eq 'LANG') { }
0 0 elsif ($func eq 'LANGMATCHES') { }
0 0 elsif ($func eq 'DATATYPE') { }
0 0 elsif ($func eq 'BOUND') { }
0 0 elsif ($func eq 'RAND') { }
0 0 elsif ($func eq 'ABS') { }
0 0 elsif ($func =~ /^(?:CEIL|FLOOR)$/u) { }
0 0 elsif ($func eq 'ROUND') { }
0 0 elsif ($func eq 'CONCAT') { }
0 0 elsif ($func eq 'SUBSTR') { }
0 0 elsif ($func eq 'STRLEN') { }
0 0 elsif ($func eq 'REPLACE') { }
0 0 elsif ($func =~ /^[UL]CASE$/u) { }
0 0 elsif ($func eq 'ENCODE_FOR_URI') { }
0 0 elsif ($func eq 'CONTAINS') { }
0 0 elsif ($func eq 'STRSTARTS' or $func eq 'STRENDS') { }
0 0 elsif ($func eq 'STRBEFORE' or $func eq 'STRAFTER') { }
0 0 elsif ($func =~ /^(?:YEAR|MONTH|DAY|HOURS|MINUTES)$/u) { }
0 0 elsif ($func eq 'SECONDS') { }
0 0 elsif ($func eq 'TZ' or $func eq 'TIMEZONE') { }
0 0 elsif ($func eq 'NOW') { }
0 0 elsif ($func =~ /^(?:STR)?UUID$/u) { }
0 0 elsif ($func =~ /^(MD5|SHA1|SHA256|SHA384|SHA512)$/u) { }
0 0 elsif ($func eq 'STRLANG') { }
0 0 elsif ($func eq 'STRDT') { }
0 0 elsif ($func eq 'SAMETERM') { }
0 0 elsif ($func =~ /^IS([UI]RI|BLANK|LITERAL|NUMERIC|TRIPLE)$/u) { }
0 0 elsif ($func eq 'REGEX') { }
0 0 elsif ($func eq 'INVOKE') { }
760 0 0 $expr->has_base ? :
763 0 0 if (scalar @operands)
765 0 0 if (my $b = $row_cache->{'bnodes'}{$name}) { }
775 0 0 unless $operands[0]->does("Attean::API::Literal")
779 0 0 if ($match eq '*') { }
781 0 0 $lang ? :
783 0 0 I18N::LangTags::is_dialect_of($lang, $match) ? :
788 0 0 $operands[0] ? :
795 0 0 $func eq 'CEIL' ? :
803 0 0 unless $n->does("Attean::API::Literal")
804 0 0 if ($n->datatype->value ne 'http://www.w3.org/2001/XMLSchema#string') { }
0 0 elsif ($n->language) { }
808 0 0 if (defined $lang and $lang ne $n->language) { }
819 0 0 if ($all_lang and $lang) { }
0 0 elsif ($all_str) { }
828 0 0 scalar(@args == 1) ? :
834 0 0 unless &blessed($node) and $node->does("Attean::API::Literal")
835 0 0 unless &blessed($pat) and $pat->does("Attean::API::Literal")
836 0 0 unless &blessed($rep) and $rep->does("Attean::API::Literal")
837 0 0 if $node->datatype and $node->datatype->value ne "http://www.w3.org/2001/XMLSchema#string"
839 0 0 if index($pattern, "(?{") != -1 or index($pattern, "(??{") != -1
840 0 0 if index($replace, "(?{") != -1 or index($replace, "(??{") != -1
850 0 0 $func eq 'UCASE' ? :
856 0 0 if $node->language and $pat->language and $node->language ne $pat->language
857 0 0 index($lit, $plit) >= 0 ? :
860 0 0 if ($func eq 'STRENDS') { }
862 0 0 rindex($lit, $plit) == $pos ? :
864 0 0 index($lit, $plit) == 0 ? :
869 0 0 unless &blessed($node) and $node->does("Attean::API::Literal")
870 0 0 unless &blessed($substr) and $substr->does("Attean::API::Literal")
871 0 0 if $node->datatype and $node->datatype->value ne "http://www.w3.org/2001/XMLSchema#string"
875 0 0 if ($lhs_simple and $rhs_simple) { }
0 0 elsif ($node->language and $substr->language and $node->language eq $substr->language) { }
0 0 elsif ($node->language and $rhs_simple) { }
888 0 0 if ($i < 0) { }
891 0 0 if ($func eq 'STRBEFORE') { }
907 0 0 if ($tz->is_floating)
908 0 0 if $func eq "TZ"
911 0 0 if $func eq "TZ" and $tz->is_utc
912 0 0 if ($tz) { }
916 0 0 $func eq 'TZ' ? :
917 0 0 if ($offset < 0)
923 0 0 if ($offset >= 3600)
925 0 0 if $h > 0
929 0 0 if ($offset >= 60)
931 0 0 if $m > 0
937 0 0 if $s > 0 or $duration eq "PT"
939 0 0 $func eq 'TZ' ? :
943 0 0 if $func eq "TZ"
950 0 0 if $func eq "STRUUID"
959 0 0 unless &blessed($str) and $str->does("Attean::API::Literal") and &blessed($lang) and $lang->does("Attean::API::Literal")
960 0 0 unless $str->datatype->value eq "http://www.w3.org/2001/XMLSchema#string" and not $str->language
963 0 0 unless $operands[0]->does("Attean::API::Literal") and not $operands[0]->language
964 0 0 if (my $dt = $operands[0]->datatype)
965 0 0 unless $dt->value eq "http://www.w3.org/2001/XMLSchema#string"
967 0 0 unless $operands[1]->does("Attean::API::IRI")
972 0 0 unless &blessed($operands[0]) and &blessed($operands[1])
973 0 0 if ($a->compare($b))
976 0 0 if ($a->does('Attean::API::Binding')) { }
978 0 0 $ok ? :
981 0 0 $ok ? :
984 0 0 $operands[0]->does("Attean::API::$type_roles{$1}") ? :
987 0 0 $value =~ /$pattern/u ? :
991 0 0 unless (ref $func)
1001 0 0 if ($agg eq 'COUNT') { }
0 0 elsif ($agg =~ /^(?:SAMPLE|MIN|MAX|SUM|AVG|GROUP_CONCAT)$/u) { }
0 0 elsif ($agg eq 'CUSTOM') { }
1002 0 0 if ($child) { }
1007 0 0 if ($expr->distinct)
1021 0 0 if ($agg eq 'SAMPLE') { }
0 0 elsif ($agg eq 'MIN' or $agg eq 'MAX') { }
0 0 elsif ($agg eq 'SUM' or $agg eq 'AVG') { }
0 0 elsif ($agg eq 'GROUP_CONCAT') { }
1027 0 0 $agg eq 'MIN' ? :
1033 0 0 if not $t and $agg eq "MIN"
1034 0 0 unless $t
1035 0 0 if not $extrema or $extrema->compare($t) == $expect
1047 0 0 if ($expr->distinct)
1048 0 0 if $seen{$term->as_string}++
1050 0 0 if ($term->does('Attean::API::NumericLiteral')) { }
1057 0 0 if ($agg eq "AVG")
1058 0 0 !$count ? :
1070 0 0 if ($expr->distinct)
1071 0 0 &blessed($term) ? :
0 0 if $seen{&blessed($term) ? $term->as_string : ""}++
1081 0 0 unless ($data)
1109 4 0 if $cast->does("Attean::API::CanonicalizingLiteral")