Branch Coverage

blib/lib/RDF/Query/Parser/SPARQL11.pm
Criterion Covered Total %
branch 387 694 55.7


line true false branch
117 0 101 unless (defined $input)
142 0 101 if ($baseuri)
193 0 0 if ($baseuri)
235 0 0 if ($baseuri)
263 84 18 if ($self->_test(qr/SELECT/i)) { }
2 16 elsif ($self->_test(qr/CONSTRUCT/i)) { }
2 14 elsif ($self->_test(qr/DESCRIBE/i)) { }
2 12 elsif ($self->_test(qr/ASK/i)) { }
0 12 elsif ($self->_test(qr/CREATE\s+(SILENT\s+)?GRAPH/i)) { }
0 12 elsif ($self->_test(qr/DROP\s+(SILENT\s+)?/i)) { }
2 10 elsif ($self->_test(qr/LOAD\s+(SILENT\s+)?/i)) { }
0 10 elsif ($self->_test(qr/CLEAR\s+(SILENT\s+)?/i)) { }
10 0 elsif ($self->_test(qr/(WITH|INSERT|DELETE)/i)) { }
0 0 elsif ($self->_test(qr/COPY/i)) { }
0 0 elsif ($self->_test(qr/MOVE/i)) { }
0 0 elsif ($self->_test(qr/ADD/i)) { }
0 0 elsif ($self->_test(qr/;/)) { }
0 0 elsif ($self->{'tokens'} eq '') { }
277 0 0 unless $self->{'update'}
281 0 0 unless $self->{'update'}
285 0 2 unless $self->{'update'}
289 0 0 unless $self->{'update'}
293 0 10 unless $self->{'update'}
295 1 9 if ($self->_test(qr/WITH/))
303 6 4 if ($self->_test(qr/INSERT/ism)) { }
4 0 elsif ($self->_test(qr/DELETE/ism)) { }
306 6 0 if ($self->_test(qr/DATA/i)) { }
308 0 6 unless $self->{'update'}
318 0 4 if ($self->_test(qr/DATA/i)) { }
320 0 0 unless $self->{'update'}
337 0 0 if $self->_Query_test
343 0 0 if ($l->is_debug)
349 90 12 if $read_query
351 1 11 if ($self->_test(qr/;/))
354 1 0 if ($self->_Query_test)
365 0 101 if ($remaining =~ /\S/)
369 1 100 if ($count == 0 or $count > 1)
382 1 0 if $self->_test(qr/SELECT|CONSTRUCT|DESCRIBE|ASK|LOAD|CLEAR|DROP|ADD|MOVE|COPY|CREATE|INSERT|DELETE|WITH/i)
394 2 99 if ($self->_test(qr/BASE/i))
411 6 120 if ($ns eq '')
417 1 125 if (@base)
427 2 99 if defined $base
478 0 0 if ($graph)
489 0 0 if ($self->_test(qr/NAMED/i))
496 0 0 if ($named) { }
506 0 0 if ($graph) { }
519 0 0 unless (@ds_keys)
535 0 4 if ($self->_test(qr/WHERE/i)) { }
536 0 0 if ($graph)
552 4 0 if ($self->_test(qr/INSERT/i))
569 0 1 if ($self->_test(qr/NAMED/i))
576 0 1 if ($named) { }
587 1 3 if ($graph) { }
589 0 1 if $delete_where
596 0 3 if $delete_where
603 0 4 if ($delete_where)
608 1 3 if ($graph and not scalar @ds_keys)
619 8 22 if $self->_TriplesBlock_test
620 8 14 if $self->_test(qr/GRAPH/i)
629 2 12 if ($graph)
642 2 14 &blessed($data) ? :
645 0 14 unless &blessed($data)
646 0 14 unless $data->isa('RDF::Query::Algebra::GroupGraphPattern')
654 8 8 if ($self->_TriplesBlock_test) { }
659 2 6 if ($graph)
682 1 1 if ($self->_test(qr/INTO GRAPH/i)) { }
713 0 0 if ($self->_test(qr/GRAPH/i)) { }
0 0 elsif ($self->_test(qr/DEFAULT/i)) { }
0 0 elsif ($self->_test(qr/NAMED/i)) { }
0 0 elsif ($self->_test(qr/ALL/i)) { }
741 0 0 if ($self->_test(qr/GRAPH/i)) { }
0 0 elsif ($self->_test(qr/DEFAULT/i)) { }
0 0 elsif ($self->_test(qr/NAMED/i)) { }
0 0 elsif ($self->_test(qr/ALL/i)) { }
766 0 0 if ($self->_test(qr/DEFAULT/i)) { }
770 0 0 if ($self->_test(qr/GRAPH/))
823 0 0 if ($self->_test(qr/DEFAULT/i)) { }
826 0 0 if ($self->_test(qr/GRAPH/))
836 0 0 if ($self->_test(qr/DEFAULT/i)) { }
839 0 0 if ($self->_test(qr/GRAPH/))
854 0 0 if (defined $from)
865 0 0 if (defined $to)
875 0 0 if ($op eq 'MOVE') { }
0 0 elsif ($op eq 'COPY') { }
892 2 82 if ($self->{'tokens'} =~ /^(DISTINCT|REDUCED)/i)
905 25 59 if ($star)
920 3 81 if ($self->_test(qr/VALUES/i))
928 2 1 if ($self->_test(qr/[(]/))
937 2 1 if ($parens)
943 0 3 if (not $parens and $count == 0) { }
0 5 elsif (not $parens and $count > 1) { }
952 2 1 if (not $short or $short and $self->_Binding_test) { }
978 17 67 if (@agg)
981 9 8 if (scalar @gvars == 0)
984 0 11 if ($v->isa('RDF::Query::Node::Variable'))
1002 25 84 if ($self->_test('*')) { }
1018 84 0 if ($v->isa('RDF::Query::Node::Variable') or $v->isa('RDF::Query::Expression::Alias'))
1020 29 55 if ($v->isa('RDF::Query::Expression::Alias'))
1021 0 29 if ($seen{$name})
1030 0 85 if ($count == 0)
1058 29 140 if $self->_test(qr/[(]/i)
1065 29 55 if ($self->_test('(')) { }
1080 2 0 if ($self->_test(qr/[{]/))
1087 0 2 if ($shortcut) { }
1110 0 2 if ($self->_test('*')) { }
1127 2 0 if ($self->_WhereClause_test) { }
1168 2 0 if ($self->_test(qr/NAMED/i)) { }
1208 90 1 if ($self->_test(qr/WHERE/i))
1226 0 0 if ($self->_TriplesBlock_test)
1252 0 4 unless ($self->_BindingValue_test)
1267 1 6 if $self->_IRIref_test
1268 5 1 if $self->_test(qr/UNDEF|[<'".0-9]|(true|false)\b|_:|\([\n\r\t ]*\)/)
1274 1 5 if ($self->_test(qr/UNDEF/i)) { }
1285 0 8 if $self->_BuiltInCall_test
1286 0 8 if $self->_IRIref_test
1287 0 8 if $self->_test(qr/[(]/i)
1288 0 8 if $self->_test(qr/[\$?]/)
1293 0 8 if ($self->_test('(')) { }
0 8 elsif ($self->_IRIref_test) { }
0 8 elsif ($self->_BuiltInCall_test) { }
1300 0 0 if ($self->_test(qr/AS/i)) { }
1326 8 81 if ($self->_test(qr/GROUP\s+BY/i))
1331 3 86 if ($self->_test(qr/HAVING/i))
1336 8 81 if ($self->_OrderClause_test)
1341 3 86 if ($self->_LimitOffsetClauses_test)
1350 0 8 if ($self->{'build'}{'star'})
1370 8 0 if ($v->isa('RDF::Query::Node::Variable') or $v->isa('RDF::Query::Expression::Alias'))
1376 7 7 if ($v->isa('RDF::Query::Node::Variable')) { }
7 0 elsif ($v->isa('RDF::Query::Expression::Alias')) { }
1378 0 7 unless ($seen{$name})
1384 7 0 if ($expr->isa('RDF::Query::Node::Variable::ExpressionProxy')) { }
0 0 elsif ($expr->isa('RDF::Query::Expression')) { }
1390 0 0 unless ($seen{$name})
1421 3 0 if ($self->_LimitClause_test) { }
1424 1 2 if ($self->_OffsetClause_test)
1430 0 0 if ($self->_LimitClause_test)
1465 0 8 if $self->_test(qr/ASC|DESC|[?\$]/i)
1466 0 8 if $self->_Constraint_test
1473 4 4 if ($self->_test(qr/ASC|DESC/i)) { }
3 1 elsif ($self->_test(qr/[?\$]/)) { }
1521 1 129 if ($self->_SubSelect_test) { }
1537 112 17 if ($self->_TriplesBlock_test)
1546 20 18 if ($self->_GraphPatternNotTriples_test) { }
18 0 elsif ($self->_test(qr/FILTER/i)) { }
1561 5 33 if ($need_dot or $self->_test('.'))
1563 5 0 if ($got_pattern) { }
1572 0 38 if ($self->_TriplesBlock_test)
1574 0 0 if (&blessed($peek) and $peek->isa('RDF::Query::Algebra::BasicGraphPattern')) { }
1578 0 0 if ($rhs->isa('RDF::Query::Algebra::BasicGraphPattern')) { }
1592 0 38 unless $self->_test(qr/\S/)
1595 0 38 if ($pos == $new) { }
1608 17 112 if (@filters)
1620 6 22 if ($class =~ /^RDF::Query::Algebra::(Optional|Minus)$/) { }
0 22 elsif ($class eq 'RDF::Query::Algebra::Table') { }
0 22 elsif ($class eq 'RDF::Query::Algebra::Extend') { }
0 22 elsif ($class eq 'RDF::Query::Algebra::Service') { }
22 0 elsif ($class =~ /RDF::Query::Algebra::(Union|NamedGraph|GroupGraphPattern)$/) { }
1625 0 6 unless ($ggp)
1639 0 0 unless ($ggp)
1646 0 0 if (exists $in_scope{$var})
1654 0 0 if ($endpoint->isa('RDF::Query::Node::Variable')) { }
1660 0 0 unless ($ggp)
1696 0 1 if ($self->{'baseURI'})
1703 0 1 if ($self->{'tokens'} =~ /^(DISTINCT|REDUCED)/i)
1714 0 1 if ($star)
1728 0 1 if ($self->{'build'}{'options'}{'orderby'})
1736 0 1 if ($self->_test(qr/VALUES/i))
1741 0 0 if ($self->_test(qr/[(]/))
1750 0 0 if ($parens)
1756 0 0 if (not $parens and $count == 0) { }
0 0 elsif (not $parens and $count > 1) { }
1765 0 0 if (not $short or $short and $self->_Binding_test) { }
1830 0 95 if ($got_dot)
1836 29 66 if ($self->_TriplesBlock_test)
1848 0 38 if $self->_test(qr/VALUES/i)
1854 0 20 if ($self->_test(qr/VALUES/i)) { }
0 20 elsif ($self->_test(qr/SERVICE/i)) { }
0 20 elsif ($self->_test(qr/MINUS/i)) { }
0 20 elsif ($self->_test(qr/BIND/i)) { }
6 14 elsif ($self->_OptionalGraphPattern_test) { }
7 7 elsif ($self->_GroupOrUnionGraphPattern_test) { }
1878 0 0 if ($self->_test(qr/[(]/))
1888 0 0 if ($parens)
1894 0 0 if (not $parens and $count == 0) { }
0 0 elsif (not $parens and $count > 1) { }
1904 0 0 if (not $short or $short and $self->_Binding_test) { }
1945 0 0 if ($self->_test(qr/[\$?]/)) { }
1959 0 0 $silent ? :
1972 0 6 if (@filters)
1977 0 0 unless ($ggp)
2014 4 11 if ($self->{'__data_pattern'})
2015 0 4 if ($self->{'__graph_nesting_level'}++)
2026 9 6 if ($graph->isa('RDF::Trine::Node::Resource')) { }
2033 4 11 if ($self->{'__data_pattern'})
2055 6 1 if ($self->_test(qr/UNION/i)) { }
2085 0 8 if $self->_test(qr/[(]/)
2086 0 8 if $self->_BuiltInCall_test
2087 0 8 if $self->_FunctionCall_test
2093 21 1 if ($self->_BrackettedExpression_test) { }
0 1 elsif ($self->_BuiltInCall_test) { }
2132 16 0 unless ($self->_test(')'))
2153 2 0 if ($self->_ConstructTriples_test)
2176 0 1 if ($self->_ConstructTriples_test)
2186 0 2 if ($self->_TriplesNode_test) { }
2218 9 140 if ($self->_TriplesNode_test) { }
2258 0 0 if ($self->_Verb_test)
2273 0 0 if ($self->_Verb_test)
2281 149 4 if ($self->_VerbPath_test) { }
2294 51 1 if ($self->_VerbPath_test or $self->_VerbSimple_test)
2295 51 0 if ($self->_VerbPath_test) { }
2313 0 9 if ($self->_Verb_test)
2351 0 2 if ($self->_test(qr/a[\n\t\r <]/)) { }
2364 0 1 if $self->_test(qr/[\$?]/)
2375 209 47 if $self->_IRIref_test
2376 42 5 if $self->_test(qr/\^|[|(a!]/)
2431 5 0 if ($self->_test(qr"/")) { }
2450 2 203 if ($self->_PathMod_test)
2454 2 0 if (defined $mod) { }
2468 0 205 if ($self->_test(qr/\^/)) { }
2482 2 203 if $self->_test(qr/[*?+{]/)
2487 2 0 if ($self->_test(qr/[*?+]/))
2488 0 2 if ($self->_test(qr/[+][.0-9]/)) { }
2528 163 42 if ($self->_IRIref_test) { }
42 0 elsif ($self->_test(qr/a[\n\t\r <]/)) { }
0 0 elsif ($self->_test(qr/[!]/)) { }
2552 0 0 if ($self->_test(qr/[(]/)) { }
2557 0 0 if ($self->_PathOneInPropertyClass_test)
2580 0 0 if $self->_IRIref_test
2581 0 0 if $self->_test(qr/a[|)\n\t\r <]/)
2582 0 0 if $self->_test(qr/\^/)
2589 0 0 if ($self->_test(qr/\^/))
2593 0 0 if ($self->_test(qr/a[|)\n\t\r <]/)) { }
2596 0 0 if ($rev) { }
2603 0 0 if ($rev)
2620 0 13 if ($self->_test(qr/\(/)) { }
2630 0 13 if (my $where = $self->{'__no_bnodes'})
2701 4 204 if ($self->_TriplesNode_test) { }
2711 0 0 if $self->_test(qr/[\$?]/)
2712 0 0 if $self->_IRIref_test
2713 0 0 if $self->_test(qr/[<'".0-9]|(true|false)\b|_:|\([\n\r\t ]*\)/)
2719 225 121 if ($self->{'tokens'} =~ /^[?\$]/) { }
2734 8 11 if ($self->{'tokens'} =~ /^[?\$]/) { }
2744 0 387 if ($self->{'__data_pattern'})
2748 387 0 $self->_test($r_VAR1) ? :
2755 0 126 if ($self->_test(qr/(true|false)\b/)) { }
0 126 elsif ($self->_test('(')) { }
10 116 elsif ($self->_test($r_ANON) or $self->_test('_:')) { }
3 113 elsif ($self->_test(qr/[-+]?\d/)) { }
33 80 elsif ($self->_test(qr/['"]/)) { }
2792 0 113 if (scalar @list > 1) { }
2797 0 113 if scalar @{$self->{'stack'};} == 0
2814 2 111 if (scalar @list > 1) { }
2833 13 102 if ($self->_test(qr/[!<>]?=|[<>]/)) { }
4 98 elsif ($self->_test(qr/(NOT )?IN/)) { }
2834 0 13 if ($self->_test($r_IRI_REF))
2839 2 11 if $op eq '='
2860 3 1 unless ($self->_test(')'))
2917 3 127 if ($self->_test('!')) { }
0 127 elsif ($self->_test('+')) { }
2 125 elsif ($self->_test('-')) { }
2931 0 0 if (&blessed($expr) and $expr->isa('RDF::Trine::Node::Literal') and $expr->is_numeric_type) { }
2945 2 0 if (&blessed($expr) and $expr->isa('RDF::Trine::Node::Literal') and $expr->is_numeric_type) { }
2962 2 128 if ($self->_BrackettedExpression_test) { }
34 94 elsif ($self->_BuiltInCall_test) { }
11 83 elsif ($self->_IRIref_test) { }
47 36 elsif ($self->_test(qr/[\$?]/)) { }
0 36 elsif ($self->_test(qr/(true|false)\b/)) { }
26 10 elsif ($self->_test(qr/[-+]?\d/)) { }
3001 1 20 if ($self->_test(qr/DISTINCT/i))
3008 0 21 if ($self->_test('*')) { }
3013 1 20 if ($op eq 'GROUP_CONCAT')
3022 0 1 if ($self->_test(qr/;/))
3025 0 0 if ($self->{'args'}{'allow_typos'}) { }
3041 21 0 &blessed($_) ? :
3042 1 20 if ($distinct)
3048 1 20 $distinct ? :
3050 21 0 if &blessed($_)
3058 86 67 if ($self->{'__aggregate_call_ok'})
3059 21 65 if $self->_test($r_AGGREGATE_CALL)
3061 3 129 if $self->_test(qr/((NOT\s+)?EXISTS)|COALESCE/i)
3062 0 129 if $self->_test(qr/ABS|CEIL|FLOOR|ROUND|CONCAT|SUBSTR|STRLEN|UCASE|LCASE|ENCODE_FOR_URI|CONTAINS|STRSTARTS|STRENDS|RAND|MD5|SHA1|SHA224|SHA256|SHA384|SHA512|HOURS|MINUTES|SECONDS|DAY|MONTH|YEAR|TIMEZONE|TZ|NOW/i)
3068 21 13 if ($self->{'__aggregate_call_ok'} and $self->_test($r_AGGREGATE_CALL)) { }
1 12 elsif ($self->_test(qr/(NOT\s+)?EXISTS/i)) { }
5 7 elsif ($self->_test(qr/COALESCE|BNODE|CONCAT|SUBSTR|RAND|NOW/i)) { }
2 5 elsif ($self->_RegexExpression_test) { }
3078 1 0 if ($op =~ /^NOT/i) { }
3100 0 5 if ($op =~ /^(STR)?UUID$/i) { }
2 3 elsif ($op =~ /^(STR|URI|IRI|LANG|DATATYPE|isIRI|isURI|isBLANK|isLITERAL|isNumeric|ABS|CEIL|FLOOR|ROUND|STRLEN|UCASE|LCASE|ENCODE_FOR_URI|MD5|SHA1|SHA224|SHA256|SHA384|SHA512|HOURS|MINUTES|SECONDS|DAY|MONTH|YEAR|TIMEZONE|TZ)$/i) { }
0 3 elsif ($op =~ /^(STRDT|STRLANG|LANGMATCHES|sameTerm|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER)$/i) { }
0 3 elsif ($op =~ /^(IF|REPLACE)$/i) { }
3166 0 2 if ($self->_test(','))
3189 10 1 if ($self->_ArgList_test)
3203 0 43 if ($self->_test('@')) { }
0 43 elsif ($self->_test('^^')) { }
3216 0 0 if ($self->{'args'}{'canonicalize'} and &blessed($obj) and $obj->isa('RDF::Trine::Node::Literal'))
3230 0 29 if ($self->_test('+')) { }
0 29 elsif ($self->_test('-')) { }
3240 0 29 if ($self->_test($r_DOUBLE)) { }
8 21 elsif ($self->_test($r_DECIMAL)) { }
3254 0 29 if ($sign)
3259 0 0 if ($self->{'args'}{'canonicalize'} and &blessed($obj) and $obj->isa('RDF::Trine::Node::Literal'))
3271 0 0 if ($self->{'args'}{'canonicalize'} and &blessed($obj) and $obj->isa('RDF::Trine::Node::Literal'))
3281 0 43 if ($self->_test($r_STRING_LITERAL_LONG1)) { }
0 43 elsif ($self->_test($r_STRING_LITERAL_LONG2)) { }
7 36 elsif ($self->_test($r_STRING_LITERAL1)) { }
3313 63 210 if ($self->_test($r_IRI_REF)) { }
3325 210 0 if ($self->_test($r_PNAME_LN)) { }
3328 18 192 if ($ns eq '')
3334 0 210 unless (exists $self->{'namespaces'}{$ns})
3342 0 0 if ($ns eq ':') { }
3348 0 0 unless (exists $self->{'namespaces'}{$ns})
3360 0 10 if (my $where = $self->{'__no_bnodes'})
3363 5 5 if ($self->_test($r_BLANK_NODE_LABEL)) { }
3386 63 22 unless $aggdata
3387 17 68 if (scalar @aggkeys)
3391 3 14 if (my $having = delete $self->{'build'}{'__having'})
3403 25 60 if (scalar @vars)
3409 0 29 if ($bound{$name})
3420 3 82 if ($having_expr)
3426 8 77 if ($self->{'build'}{'options'}{'orderby'})
3439 2 83 if ($self->{'build'}{'options'}{'distinct'})
3446 1 84 if (exists $self->{'build'}{'options'}{'offset'})
3453 3 82 if (exists $self->{'build'}{'options'}{'limit'})
3523 0 5786 unless (length $self->{'tokens'})
3531 5051 735 if (ref $thing and $thing->isa('Regexp')) { }
0 735 elsif (&looks_like_number($thing)) { }
3532 5051 0 if ($self->{'tokens'} =~ /^($thing)/)
3544 735 0 if (substr($self->{'tokens'}, 0, length $thing) eq $thing) { }
3562 0 0 if ($sub =~ /::_([A-Z]\w*)$/)
3569 0 0 if ($l->is_debug)
3575 0 0 if ($thing) { }
3586 7027 5768 if (&blessed($thing) and $thing->isa('Regexp')) { }
3587 2118 4909 if ($self->{'tokens'} =~ /^$thing/) { }
3593 376 5392 if (substr($self->{'tokens'}, 0, length $thing) eq $thing) { }
3603 298 7653 unless (length $self->{'tokens'})
3607 3381 4272 if ($self->{'tokens'} =~ /^[\t\r\n #]/) { }
3617 0 3485 if ($self->_test('#')) { }
3626 1948 2521 if ($self->_ws_test)
3642 2 271 if (defined $build->{'base'}) { }
3652 18 190 if ($self->{'_modify_template'} and my $graph = $self->{'named_graph'} and $self->{'named_graph'}->isa('RDF::Trine::Node::Resource')) { }
3676 10 2 if (&blessed($path)) { }
2 0 elsif (&reftype($path) eq 'ARRAY' and $path->[0] eq 'PATH') { }
3692 206 0 if &reftype(scalar $_->predicate) eq 'ARRAY'
3694 0 120 if (scalar @patterns > scalar(@paths) + scalar(@triples))
3698 5 115 if (@paths) { }
3706 5 0 scalar @p == 1 ? :
3709 2 3 if (scalar @triples) { }