| 1 | # RDF::Query::Parser::SPARQL11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | RDF::Query::Parser::SPARQL11 - SPARQL 1.1 Parser. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | This document describes RDF::Query::Parser::SPARQL11 version 2.919. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | use RDF::Query::Parser::SPARQL11; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | my $parser = RDF::Query::Parser::SPARQL11->new(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | my $iterator = $parser->parse( $query, $base_uri ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | Beyond the methods documented below, this class inherits methods from the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | L<RDF::Query::Parser> class. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | package RDF::Query::Parser::SPARQL11; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 35 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 35 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 35 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 35 | ▶ | use base qw(RDF::Query::Parser); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 35 | ▶ | use URI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 35 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 35 | ▶ | use RDF::Query::Error qw(:try); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 35 | ▶ | use RDF::Query::Parser; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 35 | ▶ | use RDF::Query::Algebra; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 35 | ▶ | use RDF::Trine::Namespace qw(rdf); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 35 | ▶ | use Scalar::Util qw(blessed looks_like_number reftype); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 35 | our ($VERSION); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 35 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 35 | $VERSION = '2.919'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 35 | my $rdf = RDF::Trine::Namespace->new('http://www.w3.org/1999/02/22-rdf-syntax-ns#'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 35 | my $xsd = RDF::Trine::Namespace->new('http://www.w3.org/2001/XMLSchema#'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 35 | our $r_ECHAR = qr/\\([tbnrf\\"'])/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 35 | our $r_STRING_LITERAL1 = qr/'(([^\x{27}\x{5C}\x{0A}\x{0D}])|${r_ECHAR})*'/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 35 | our $r_STRING_LITERAL2 = qr/"(([^\x{22}\x{5C}\x{0A}\x{0D}])|${r_ECHAR})*"/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 35 | our $r_STRING_LITERAL_LONG1 = qr/'''(('|'')?([^'\\]|${r_ECHAR}))*'''/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 35 | our $r_STRING_LITERAL_LONG2 = qr/"""(("|"")?([^"\\]|${r_ECHAR}))*"""/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 35 | our $r_LANGTAG = qr/@[a-zA-Z]+(-[a-zA-Z0-9]+)*/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 35 | our $r_IRI_REF = qr/<([^<>"{}|^`\\\x{00}-\x{20}])*>/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 35 | our $r_PN_CHARS_BASE = qr/([A-Z]|[a-z]|[\x{00C0}-\x{00D6}]|[\x{00D8}-\x{00F6}]|[\x{00F8}-\x{02FF}]|[\x{0370}-\x{037D}]|[\x{037F}-\x{1FFF}]|[\x{200C}-\x{200D}]|[\x{2070}-\x{218F}]|[\x{2C00}-\x{2FEF}]|[\x{3001}-\x{D7FF}]|[\x{F900}-\x{FDCF}]|[\x{FDF0}-\x{FFFD}]|[\x{10000}-\x{EFFFF}])/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 35 | our $r_PN_CHARS_U = qr/([_]|${r_PN_CHARS_BASE})/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 35 | our $r_VARNAME = qr/((${r_PN_CHARS_U}|[0-9])(${r_PN_CHARS_U}|[0-9]|\x{00B7}|[\x{0300}-\x{036F}]|[\x{203F}-\x{2040}])*)/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 35 | our $r_VAR1 = qr/[?]${r_VARNAME}/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 35 | our $r_VAR2 = qr/[\$]${r_VARNAME}/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 35 | our $r_PN_CHARS = qr/${r_PN_CHARS_U}|-|[0-9]|\x{00B7}|[\x{0300}-\x{036F}]|[\x{203F}-\x{2040}]/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 35 | our $r_PN_PREFIX = qr/(${r_PN_CHARS_BASE}((${r_PN_CHARS}|[.])*${r_PN_CHARS})?)/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 35 | our $r_PN_LOCAL_ESCAPED = qr{(\\([-~.!&'()*+,;=/?#@%_\$]))|%[0-9A-Fa-f]{2}}o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 35 | our $r_PN_LOCAL = qr/((${r_PN_CHARS_U}|[:0-9]|${r_PN_LOCAL_ESCAPED})((${r_PN_CHARS}|${r_PN_LOCAL_ESCAPED}|[:.])*(${r_PN_CHARS}|[:]|${r_PN_LOCAL_ESCAPED}))?)/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 35 | our $r_PN_LOCAL_BNODE = qr/((${r_PN_CHARS_U}|[0-9])((${r_PN_CHARS}|[.])*${r_PN_CHARS})?)/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 35 | our $r_PNAME_NS = qr/((${r_PN_PREFIX})?:)/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 35 | our $r_PNAME_LN = qr/(${r_PNAME_NS}${r_PN_LOCAL})/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 35 | our $r_EXPONENT = qr/[eE][-+]?\d+/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 35 | our $r_DOUBLE = qr/\d+[.]\d*${r_EXPONENT}|[.]\d+${r_EXPONENT}|\d+${r_EXPONENT}/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 35 | our $r_DECIMAL = qr/(\d+[.]\d*)|([.]\d+)/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 35 | our $r_INTEGER = qr/\d+/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 35 | our $r_BLANK_NODE_LABEL = qr/_:${r_PN_LOCAL_BNODE}/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 35 | our $r_ANON = qr/\[[\t\r\n ]*\]/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 35 | our $r_NIL = qr/\([\n\r\t ]*\)/o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 35 | our $r_AGGREGATE_CALL = qr/(MIN|MAX|COUNT|AVG|SUM|SAMPLE|GROUP_CONCAT)\b/io; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | =item C<< new >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | Returns a new SPARQL 1.1 parser object. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 103 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 103 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 103 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 103 | my $self = bless({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | args => \%args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | bindings => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | bnode_id => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | }, $class); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 103 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | ################################################################################ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | =item C<< parse ( $query, $base_uri, $update_flag ) >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | Parses the C<< $query >>, using the given C<< $base_uri >>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | If C<< $update_flag >> is true, the query will be parsed allowing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | SPARQL 1.1 Update statements. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 103 | ▶ | sub parse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=4 SCAR=15.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 103 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 103 | my $input = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 103 | ▶ | unless (defined($input)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | $self->{build} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $self->{error} = "No query string found to parse"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 103 | my $baseuri = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 103 | ▶ | my $update = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | $input =~ s/\\u([0-9A-Fa-f]{4})/chr(hex($1))/ge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $input =~ s/\\U([0-9A-Fa-f]{8})/chr(hex($1))/ge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 103 | delete $self->{error}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 103 | local($self->{namespaces}) = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 103 | local($self->{blank_ids}) = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 103 | local($self->{baseURI}) = $baseuri; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 103 | local($self->{tokens}) = $input; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 103 | local($self->{stack}) = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 103 | local($self->{filters}) = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 103 | local($self->{pattern_container_stack}) = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 103 | local($self->{update}) = $update; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 103 | my $triples = $self->_push_pattern_container(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 103 | local($self->{build}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 103 | my $build = { sources => [], triples => $triples }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 103 | $self->{build} = $build; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 103 | ▶ | if ($baseuri) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | $self->{build}{base} = $baseuri; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 103 | ▶ | try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 103 | $self->_RW_Query(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | } catch RDF::Query::Error with { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my $e = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | $self->{build} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $build = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $self->{error} = $e->stacktrace | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | } otherwise { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $e = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | $self->{build} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $build = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $self->{error} = $e->stacktrace | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 103 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 103 | delete $self->{build}{star}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 103 | my $data = $build; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # $data->{triples} = $self->_pop_pattern_container(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 103 | return $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | =item C<< parse_pattern ( $pattern, $base_uri, \%namespaces ) >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | Parses the C<< $pattern >>, using the given C<< $base_uri >> and returns a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | RDF::Query::Algebra pattern. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | sub parse_pattern { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_pattern: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | my $input = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | my $baseuri = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | my $ns = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $input =~ s/\\u([0-9A-Fa-f]{4})/chr(hex($1))/ge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $input =~ s/\\U([0-9A-Fa-f]{8})/chr(hex($1))/ge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | delete $self->{error}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | local($self->{namespaces}) = $ns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | local($self->{blank_ids}) = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | local($self->{baseURI}) = $baseuri; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | local($self->{tokens}) = $input; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | local($self->{stack}) = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | local($self->{filters}) = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | local($self->{pattern_container_stack}) = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my $triples = $self->_push_pattern_container(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $self->{build} = { sources => [], triples => $triples }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | if ($baseuri) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $self->{build}{base} = $baseuri; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $self->_GroupGraphPattern(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | } catch RDF::Query::Error with { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my $e = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | $self->{build} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | $self->{error} = $e->text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | my $data = delete $self->{build}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | return $data->{triples}[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | =item C<< parse_expr ( $pattern, $base_uri, \%namespaces ) >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | Parses the C<< $pattern >>, using the given C<< $base_uri >> and returns a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | RDF::Query::Expression pattern. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | sub parse_expr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_expr: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | my $input = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | my $baseuri = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | my $ns = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | $input =~ s/\\u([0-9A-Fa-f]{4})/chr(hex($1))/ge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $input =~ s/\\U([0-9A-Fa-f]{8})/chr(hex($1))/ge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | delete $self->{error}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | local($self->{namespaces}) = $ns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | local($self->{blank_ids}) = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | local($self->{baseURI}) = $baseuri; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | local($self->{tokens}) = $input; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | local($self->{stack}) = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | local($self->{filters}) = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | local($self->{pattern_container_stack}) = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | my $triples = $self->_push_pattern_container(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | $self->{build} = { sources => [], triples => $triples }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | if ($baseuri) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $self->{build}{base} = $baseuri; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $self->_Expression(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | } catch RDF::Query::Error with { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my $e = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | $self->{build} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | $self->{error} = $e->text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my $data = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | return $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | ################################################################################ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | # [1] Query ::= Prologue ( SelectQuery | ConstructQuery | DescribeQuery | AskQuery | LoadUpdate ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 103 | ▶ | sub _RW_Query { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_RW_Query: called CC=35 SCAR=46.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 103 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 103 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 103 | $self->_Prologue; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 103 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 103 | my $read_query = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 103 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 104 | ▶ | if ($self->_test(qr/SELECT/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 14 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 86 | $self->_SelectQuery(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 86 | $read_query++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } elsif ($self->_test(qr/CONSTRUCT/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 2 | $self->_ConstructQuery(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 2 | $read_query++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } elsif ($self->_test(qr/DESCRIBE/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 2 | $self->_DescribeQuery(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 2 | $read_query++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } elsif ($self->_test(qr/ASK/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 2 | $self->_AskQuery(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 2 | $read_query++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } elsif ($self->_test(qr/CREATE\s+(SILENT\s+)?GRAPH/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | throw RDF::Query::Error::PermissionError -text => "CREATE GRAPH update forbidden in read-only queries" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | unless ($self->{update}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | $self->_CreateGraph(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } elsif ($self->_test(qr/DROP\s+(SILENT\s+)?/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | throw RDF::Query::Error::PermissionError -text => "DROP GRAPH update forbidden in read-only queries" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | unless ($self->{update}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | $self->_DropGraph(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } elsif ($self->_test(qr/LOAD\s+(SILENT\s+)?/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | throw RDF::Query::Error::PermissionError -text => "LOAD update forbidden in read-only queries" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 2 | ▶ | unless ($self->{update}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 2 | $self->_LoadUpdate(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } elsif ($self->_test(qr/CLEAR\s+(SILENT\s+)?/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | throw RDF::Query::Error::PermissionError -text => "CLEAR GRAPH update forbidden in read-only queries" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | unless ($self->{update}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | $self->_ClearGraphUpdate(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | } elsif ($self->_test(qr/(WITH|INSERT|DELETE)/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | throw RDF::Query::Error::PermissionError -text => "INSERT/DELETE update forbidden in read-only queries" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 10 | ▶ | unless ($self->{update}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 10 | my ($graph); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 10 | ▶ | if ($self->_test(qr/WITH/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 1 | $self->{build}{custom_update_dataset} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 1 | $self->_eat(qr/WITH/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 1 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 1 | ($graph) = splice( @{ $self->{stack} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 10 | ▶ | if ($self->_test(qr/INSERT/ims)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 6 | $self->_eat(qr/INSERT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 6 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 6 | ▶ | if ($self->_test(qr/DATA/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | throw RDF::Query::Error::PermissionError -text => "INSERT DATA update forbidden in read-only queries" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 6 | ▶ | unless ($self->{update}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 6 | $self->_eat(qr/DATA/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 6 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 6 | $self->_InsertDataUpdate(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $self->_InsertUpdate($graph); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } elsif ($self->_test(qr/DELETE/ims)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 4 | $self->_eat(qr/DELETE/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 4 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 4 | ▶ | if ($self->_test(qr/DATA/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | throw RDF::Query::Error::PermissionError -text => "DELETE DATA update forbidden in read-only queries" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | unless ($self->{update}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | $self->_eat(qr/DATA/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | $self->_DeleteDataUpdate(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 4 | $self->_DeleteUpdate($graph); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } elsif ($self->_test(qr/COPY/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | $self->_CopyUpdate(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | } elsif ($self->_test(qr/MOVE/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | $self->_MoveUpdate(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } elsif ($self->_test(qr/ADD/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $self->_AddUpdate(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | } elsif ($self->_test(qr/;/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | $self->_eat(qr/;/) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | next if ($self->_Query_test); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | } elsif ($self->{tokens} eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | my $l = Log::Log4perl->get_logger("rdf.query"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | if ($l->is_debug) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | $l->logcluck("Syntax error: Expected query type with input <<$self->{tokens}>>"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | throw RDF::Query::Error::ParseError -text => 'Syntax error: Expected query type'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 104 | ▶ | last if ($read_query); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 12 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 12 | ▶ | if ($self->_test(qr/;/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 1 | $self->_eat(qr/;/) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 1 | ▶ | if ($self->_Query_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 11 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | # $self->_eat(qr/;/) if ($self->_test(qr/;/)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 103 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 103 | my $count = scalar(@{ $self->{build}{triples} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 103 | my $remaining = $self->{tokens}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 103 | ▶ | if ($remaining =~ m/\S/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Remaining input after query: $remaining"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 103 | ▶ | if ($count == 0 or $count > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$count == 0 or $count > 1
MC/DC50%1/2
$count == 0 or $count > 1
$count == 0
$count > 1
Truth table66%2/3
A or B
A= $count == 0B= $count > 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 1 | my @patterns = splice(@{ $self->{build}{triples} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 1 | my $pattern = RDF::Query::Algebra::Sequence->new( @patterns ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 1 | $pattern->check_duplicate_blanks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 1 | $self->{build}{triples} = [ $pattern ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | # my %query = (%p, %body); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | # return \%query; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 1 | ▶ | sub _Query_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Query_test: called CC=2 SCAR=8.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 1 | ▶ | return 1 if ($self->_test(qr/SELECT|CONSTRUCT|DESCRIBE|ASK|LOAD|CLEAR|DROP|ADD|MOVE|COPY|CREATE|INSERT|DELETE|WITH/i)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | # [2] Prologue ::= BaseDecl? PrefixDecl* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | # [3] BaseDecl ::= 'BASE' IRI_REF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | # [4] PrefixDecl ::= 'PREFIX' PNAME_NS IRI_REF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 103 | ▶ | sub _Prologue { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Prologue: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 103 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 103 | my $base; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | my @base; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 103 | ▶ | if ($self->_test( qr/BASE/i )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 2 | $self->_eat( qr/BASE/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 2 | my $iriref = $self->_eat( $r_IRI_REF ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 2 | my $iri = substr($iriref,1,length($iriref)-2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 2 | $base = RDF::Query::Node::Resource->new( $iri ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 2 | @base = $base; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 2 | $self->{base} = $base; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 103 | my %namespaces; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 103 | ▶ | while ($self->_test( qr/PREFIX/i )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 126 | $self->_eat( qr/PREFIX/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 126 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 126 | my $prefix = $self->_eat( $r_PNAME_NS ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 126 | my $ns = substr($prefix, 0, length($prefix) - 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 126 | ▶ | if ($ns eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 6 | $ns = '__DEFAULT__'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 126 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 126 | my $iriref = $self->_eat( $r_IRI_REF ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 126 | my $iri = substr($iriref,1,length($iriref)-2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 126 | ▶ | if (@base) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 1 | my $r = RDF::Query::Node::Resource->new( $iri, @base ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 1 | $iri = $r->uri_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 126 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 126 | $namespaces{ $ns } = $iri; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 126 | $self->{namespaces}{$ns} = $iri; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 103 | $self->{build}{namespaces} = \%namespaces; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 103 | ▶ | $self->{build}{base} = $base if (defined($base)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | # push(@data, (base => $base)) if (defined($base)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | # return @data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 6 | ▶ | sub _InsertDataUpdate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_InsertDataUpdate: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 6 | $self->_eat('{'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 6 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 6 | local($self->{__data_pattern}) = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 6 | $self->_ModifyTemplate(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 6 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 6 | my $data = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 6 | $self->_eat('}'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 6 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 6 | my $empty = RDF::Query::Algebra::GroupGraphPattern->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 6 | my $insert = RDF::Query::Algebra::Update->new(undef, $data, $empty, undef, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 6 | $self->_add_patterns( $insert ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 6 | $self->{build}{method} = 'UPDATE'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | ▶ | sub _DeleteDataUpdate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_DeleteDataUpdate: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | $self->_eat('{'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | local($self->{__data_pattern}) = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | local($self->{__no_bnodes}) = "DELETE DATA block"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | $self->_ModifyTemplate(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | my $data = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | $self->_eat('}'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | my $empty = RDF::Query::Algebra::GroupGraphPattern->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | my $delete = RDF::Query::Algebra::Update->new($data, undef, $empty, undef, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | $self->_add_patterns( $delete ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | $self->{build}{method} = 'UPDATE'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | ▶ | sub _InsertUpdate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_InsertUpdate: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | my $graph = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | $self->_eat('{'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | $self->_ModifyTemplate(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | my $data = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | $self->_eat('}'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | if ($graph) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | $data = RDF::Query::Algebra::NamedGraph->new( $graph, $data ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | my %dataset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | while ($self->_test(qr/USING/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | $self->{build}{custom_update_dataset} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | $self->_eat(qr/USING/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | my $named = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | ▶ | if ($self->_test(qr/NAMED/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | $self->_eat(qr/NAMED/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | $named = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | my ($iri) = splice( @{ $self->{stack} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | if ($named) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | $dataset{named}{$iri->uri_value} = $iri; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | push(@{ $dataset{default} }, $iri ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | $self->_eat(qr/WHERE/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | ▶ | if ($graph) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | # local($self->{named_graph}) = $graph; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | $self->_GroupGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | my $ggp = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | $ggp = RDF::Query::Algebra::NamedGraph->new( $graph, $ggp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | $self->_add_patterns( $ggp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | $self->_GroupGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | my $ggp = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | my @ds_keys = keys %dataset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | ▶ | unless (@ds_keys) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | ▶ | $dataset{ default } = [$graph || ()]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$graph || ()
MC/DC0%0/2
$graph || ()
$graph
()
Truth table0%0/3
A || B
A= $graphB= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | my $insert = RDF::Query::Algebra::Update->new(undef, $data, $ggp, \%dataset, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | $self->_add_patterns( $insert ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | $self->{build}{method} = 'UPDATE'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 4 | ▶ | sub _DeleteUpdate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_DeleteUpdate: called CC=14 SCAR=27.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 4 | my $graph = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 4 | my ($delete_data, $insert_data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 4 | my %dataset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 4 | my $delete_where = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 4 | ▶ | if ($self->_test(qr/WHERE/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | ▶ | if ($graph) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: WITH clause cannot be used with DELETE WHERE operations"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | $delete_where = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 4 | local($self->{__no_bnodes}) = "DELETE block"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 4 | $self->_eat('{'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 4 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 4 | $self->_ModifyTemplate( $graph ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 4 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 4 | $self->_eat('}'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 4 | $delete_data = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 4 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 4 | ▶ | if ($self->_test(qr/INSERT/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 4 | $self->_eat(qr/INSERT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 4 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 4 | $self->_eat('{'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 4 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 4 | $self->_ModifyTemplate( $graph ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 4 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 4 | $self->_eat('}'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 4 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 4 | $insert_data = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 4 | ▶ | while ($self->_test(qr/USING/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 1 | $self->{build}{custom_update_dataset} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 1 | $self->_eat(qr/USING/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 1 | my $named = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 1 | ▶ | if ($self->_test(qr/NAMED/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | $self->_eat(qr/NAMED/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | $named = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 1 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 1 | my ($iri) = splice( @{ $self->{stack} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 1 | ▶ | if ($named) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | $dataset{named}{$iri->uri_value} = $iri; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 1 | push(@{ $dataset{default} }, $iri ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 4 | $self->_eat(qr/WHERE/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 4 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 4 | ▶ | if ($graph) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | # local($self->{named_graph}) = $graph; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 1 | ▶ | $self->{__no_bnodes} = "DELETE WHERE block" if ($delete_where); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 1 | $self->_GroupGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 1 | delete $self->{__no_bnodes}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 1 | my $ggp = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 1 | $ggp = RDF::Query::Algebra::NamedGraph->new( $graph, $ggp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 1 | $self->_add_patterns( $ggp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 3 | ▶ | $self->{__no_bnodes} = "DELETE WHERE block" if ($delete_where); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 3 | $self->_GroupGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 3 | delete $self->{__no_bnodes}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 4 | my $ggp = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 4 | ▶ | if ($delete_where) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | $delete_data = $ggp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 4 | my @ds_keys = keys %dataset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 4 | ▶ | if ($graph and not(scalar(@ds_keys))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$graph and not scalar @ds_keys
MC/DC50%1/2
$graph and not scalar @ds_keys
$graph
not scalar @ds_keys
Truth table66%2/3
A and not(B)
A= $graphB= not scalar @ds_keys
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 1 | ▶ | $dataset{ default } = [$graph || ()]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$graph || ()
MC/DC0%0/2
$graph || ()
$graph
()
Truth table33%1/3
A || B
A= $graphB= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 4 | my $insert = RDF::Query::Algebra::Update->new($delete_data, $insert_data, $ggp, \%dataset, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 4 | $self->_add_patterns( $insert ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 4 | $self->{build}{method} = 'UPDATE'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 30 | ▶ | sub _ModifyTemplate_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ModifyTemplate_test: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 30 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 30 | ▶ | return 1 if ($self->_TriplesBlock_test); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 22 | ▶ | return 1 if ($self->_test(qr/GRAPH/i)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 14 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 14 | ▶ | sub _ModifyTemplate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ModifyTemplate: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 14 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 14 | my $graph = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 14 | local($self->{named_graph}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 14 | ▶ | if ($graph) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 2 | $self->{named_graph} = $graph; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | # $self->__ModifyTemplate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | # $self->__consume_ws_opt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | # my $data = $self->_remove_pattern; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | # $data = RDF::Query::Algebra::GroupGraphPattern->new( $data ) unless ($data->isa('RDF::Query::Algebra::GroupGraphPattern')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 14 | my $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 14 | ▶ | while ($self->_ModifyTemplate_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 16 | $self->__ModifyTemplate( $graph ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 16 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 16 | my $d = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 16 | ▶ | my @patterns = blessed($data) ? $data->patterns : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 16 | $data = RDF::Query::Algebra::GroupGraphPattern->new( @patterns, $d ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 14 | ▶ | $data = RDF::Query::Algebra::GroupGraphPattern->new() unless (blessed($data)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 14 | ▶ | $data = RDF::Query::Algebra::GroupGraphPattern->new( $data ) unless ($data->isa('RDF::Query::Algebra::GroupGraphPattern')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 14 | $self->_add_patterns( $data ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 16 | ▶ | sub __ModifyTemplate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ModifyTemplate: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 16 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 16 | my $graph = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 16 | local($self->{_modify_template}) = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 16 | ▶ | if ($self->_TriplesBlock_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 8 | my $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 8 | $self->_push_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 8 | $self->_TriplesBlock; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 8 | ($data) = @{ $self->_pop_pattern_container }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 8 | ▶ | if ($graph) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 2 | my $ggp = RDF::Query::Algebra::GroupGraphPattern->new( $data ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 2 | my $data = RDF::Query::Algebra::NamedGraph->new( $graph, $ggp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 8 | $self->_add_patterns( $data ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 8 | $self->_GraphGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 8 | my (@d) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 8 | $self->__handle_GraphPatternNotTriples( @d ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 2 | ▶ | sub _LoadUpdate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_LoadUpdate: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 2 | my $op = $self->_eat(qr/LOAD\s+(SILENT\s+)?/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 2 | my $silent = ($op =~ /SILENT/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 2 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 2 | my ($iri) = splice( @{ $self->{stack} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 2 | ▶ | if ($self->_test(qr/INTO GRAPH/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 1 | $self->_eat(qr/INTO GRAPH/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 1 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 1 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 1 | my ($graph) = splice( @{ $self->{stack} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 1 | my $pat = RDF::Query::Algebra::Load->new( $iri, $graph, $silent ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 1 | $self->_add_patterns( $pat ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 1 | my $pat = RDF::Query::Algebra::Load->new( $iri, undef, $silent ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 1 | $self->_add_patterns( $pat ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 2 | $self->{build}{method} = 'LOAD'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | ▶ | sub _CreateGraph { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_CreateGraph: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | my $op = $self->_eat(qr/CREATE\s+(SILENT\s+)?GRAPH/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | my $silent = ($op =~ /SILENT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | my ($graph) = splice( @{ $self->{stack} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | my $pat = RDF::Query::Algebra::Create->new( $graph ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | $self->_add_patterns( $pat ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | $self->{build}{method} = 'CREATE'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | ▶ | sub _ClearGraphUpdate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ClearGraphUpdate: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | my $op = $self->_eat(qr/CLEAR(\s+SILENT)?/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | my $silent = ($op =~ /SILENT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | ▶ | if ($self->_test(qr/GRAPH/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | $self->_eat(qr/GRAPH/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | my ($graph) = splice( @{ $self->{stack} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | my $pat = RDF::Query::Algebra::Clear->new( $graph ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | $self->_add_patterns( $pat ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | } elsif ($self->_test(qr/DEFAULT/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | $self->_eat(qr/DEFAULT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | my $pat = RDF::Query::Algebra::Clear->new( RDF::Trine::Node::Nil->new ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | $self->_add_patterns( $pat ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | } elsif ($self->_test(qr/NAMED/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | $self->_eat(qr/NAMED/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 0 | my $pat = RDF::Query::Algebra::Clear->new( RDF::Query::Node::Resource->new('tag:gwilliams@cpan.org,2010-01-01:RT:NAMED') ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | $self->_add_patterns( $pat ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | } elsif ($self->_test(qr/ALL/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | $self->_eat(qr/ALL/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 0 | my $pat = RDF::Query::Algebra::Clear->new( RDF::Query::Node::Resource->new('tag:gwilliams@cpan.org,2010-01-01:RT:ALL') ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | $self->_add_patterns( $pat ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | $self->{build}{method} = 'CLEAR'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | ▶ | sub _DropGraph { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_DropGraph: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | my $op = $self->_eat(qr/DROP(\s+SILENT)?/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | my $silent = ($op =~ /SILENT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | ▶ | if ($self->_test(qr/GRAPH/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | $self->_eat(qr/GRAPH/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | my ($graph) = splice( @{ $self->{stack} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | my $pat = RDF::Query::Algebra::Clear->new( $graph ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | $self->_add_patterns( $pat ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | } elsif ($self->_test(qr/DEFAULT/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | $self->_eat(qr/DEFAULT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | my $pat = RDF::Query::Algebra::Clear->new( RDF::Trine::Node::Nil->new ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | $self->_add_patterns( $pat ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | } elsif ($self->_test(qr/NAMED/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | $self->_eat(qr/NAMED/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | my $pat = RDF::Query::Algebra::Clear->new( RDF::Query::Node::Resource->new('tag:gwilliams@cpan.org,2010-01-01:RT:NAMED') ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | $self->_add_patterns( $pat ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | } elsif ($self->_test(qr/ALL/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | $self->_eat(qr/ALL/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | my $pat = RDF::Query::Algebra::Clear->new( RDF::Query::Node::Resource->new('tag:gwilliams@cpan.org,2010-01-01:RT:ALL') ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | $self->_add_patterns( $pat ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | $self->{build}{method} = 'CLEAR'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | ▶ | sub __graph { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__graph: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | ▶ | if ($self->_test(qr/DEFAULT/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | $self->_eat(qr/DEFAULT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | return RDF::Trine::Node::Nil->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 0 | ▶ | if ($self->_test(qr/GRAPH/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | $self->_eat(qr/GRAPH/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | my ($g) = splice( @{ $self->{stack} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | return $g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | ▶ | sub _CopyUpdate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_CopyUpdate: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | my $op = $self->_eat(qr/COPY(\s+SILENT)?/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 0 | my $silent = ($op =~ /SILENT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 0 | my $from = $self->__graph(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 0 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | $self->_eat(qr/TO/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 0 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | my $to = $self->__graph(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | my $pattern = RDF::Query::Algebra::Copy->new( $from, $to, $silent ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 0 | $self->_add_patterns( $pattern ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | $self->{build}{method} = 'UPDATE'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | ▶ | sub _MoveUpdate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_MoveUpdate: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | my $op = $self->_eat(qr/MOVE(\s+SILENT)?/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 0 | my $silent = ($op =~ /SILENT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | my $from = $self->__graph(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 0 | $self->_eat(qr/TO/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 0 | my $to = $self->__graph(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | my $pattern = RDF::Query::Algebra::Move->new( $from, $to, $silent ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | $self->_add_patterns( $pattern ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | $self->{build}{method} = 'UPDATE'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | ▶ | sub _AddUpdate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_AddUpdate: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | my $op = $self->_eat(qr/ADD(\s+SILENT)?/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | my $silent = ($op =~ /SILENT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | return $self->__UpdateShortcuts( 'ADD', $silent ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | ▶ | sub __UpdateShortcuts { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__UpdateShortcuts: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | my $op = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | my $silent = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | my ($from, $to); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 0 | ▶ | if ($self->_test(qr/DEFAULT/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | $self->_eat(qr/DEFAULT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | ▶ | if ($self->_test(qr/GRAPH/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | $self->_eat(qr/GRAPH/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | ($from) = splice( @{ $self->{stack} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 0 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | $self->_eat(qr/TO/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 0 | ▶ | if ($self->_test(qr/DEFAULT/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | $self->_eat(qr/DEFAULT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | ▶ | if ($self->_test(qr/GRAPH/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 0 | $self->_eat(qr/GRAPH/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | ($to) = splice( @{ $self->{stack} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | my $from_pattern = RDF::Query::Algebra::GroupGraphPattern->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | RDF::Query::Algebra::BasicGraphPattern->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | RDF::Query::Algebra::Triple->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | map { RDF::Query::Node::Variable->new( $_ ) } qw(s p o) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 0 | ▶ | if (defined($from)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | $from_pattern = RDF::Query::Algebra::NamedGraph->new( $from, $from_pattern ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | my $to_pattern = RDF::Query::Algebra::GroupGraphPattern->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | RDF::Query::Algebra::BasicGraphPattern->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | RDF::Query::Algebra::Triple->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | map { RDF::Query::Node::Variable->new( $_ ) } qw(s p o) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | ▶ | if (defined($to)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 0 | $to_pattern = RDF::Query::Algebra::NamedGraph->new( $to, $to_pattern ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | ▶ | my $to_graph = $to || RDF::Trine::Node::Nil->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$to || 'RDF::Trine::Node::Nil'->new
MC/DC0%0/2
$to || 'RDF::Trine::Node::Nil'->new
$to
'RDF::Trine::Node::Nil'->new
Truth table0%0/3
A || B
A= $toB= 'RDF::Trine::Node::Nil'->new
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | ▶ | my $from_graph = $from || RDF::Trine::Node::Nil->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$from || 'RDF::Trine::Node::Nil'->new
MC/DC0%0/2
$from || 'RDF::Trine::Node::Nil'->new
$from
'RDF::Trine::Node::Nil'->new
Truth table0%0/3
A || B
A= $fromB= 'RDF::Trine::Node::Nil'->new
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | my $drop_to = RDF::Query::Algebra::Clear->new( $to_graph, $silent ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | my $update = RDF::Query::Algebra::Update->new( undef, $to_pattern, $from_pattern, undef, 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | my $drop_from = RDF::Query::Algebra::Clear->new( $from_graph ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | my $pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 0 | ▶ | if ($op eq 'MOVE') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 0 | $pattern = RDF::Query::Algebra::Sequence->new( $drop_to, $update, $drop_from ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | } elsif ($op eq 'COPY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | $pattern = RDF::Query::Algebra::Sequence->new( $drop_to, $update ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | $pattern = $update; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | $self->_add_patterns( $pattern ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | $self->{build}{method} = 'UPDATE'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | # [5] SelectQuery ::= 'SELECT' ( 'DISTINCT' | 'REDUCED' )? ( Var+ | '*' ) DatasetClause* WhereClause SolutionModifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 86 | ▶ | sub _SelectQuery { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_SelectQuery: called CC=23 SCAR=31.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 86 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 86 | $self->_eat(qr/SELECT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 86 | $self->__consume_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 86 | ▶ | if ($self->{tokens} =~ m/^(DISTINCT|REDUCED)/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 2 | my $mod = $self->_eat( qr/DISTINCT|REDUCED/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 2 | $self->__consume_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 2 | $self->{build}{options}{lc($mod)} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 86 | my $star = $self->__SelectVars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 86 | $self->_DatasetClause(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 86 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 86 | $self->_WhereClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 86 | ▶ | if ($star) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 27 | ▶ | my $triples = $self->{build}{triples} || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'build'}{'triples'} || []
MC/DC0%0/1
$self->{'build'}{'triples'} || []
$self->{'build'}{'triples'}
Truth table50%1/2
A
A= $self->{'build'}{'triples'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 27 | my @vars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 27 | foreach my $t (@$triples) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 28 | my @v = $t->potentially_bound; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 28 | push(@vars, @v); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 27 | @vars = RDF::Query::_uniq( @vars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 27 | push( @{ $self->{build}{variables} }, map { $self->new_variable($_) } @vars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 86 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 86 | $self->_SolutionModifier(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 86 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 86 | ▶ | if ($self->_test( qr/VALUES/i )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 3 | $self->_eat( qr/VALUES/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 3 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 3 | my @vars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | # $self->_Var; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | # push( @vars, splice(@{ $self->{stack} })); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | # $self->__consume_ws_opt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 3 | my $parens = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 3 | ▶ | if ($self->_test(qr/[(]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 2 | $self->_eat( qr/[(]/ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 2 | $parens = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 3 | ▶ | while ($self->_test(qr/[\$?]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 5 | $self->_Var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 5 | push( @vars, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 5 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 3 | ▶ | if ($parens) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 2 | $self->_eat( qr/[)]/ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 3 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 3 | my $count = scalar(@vars); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 3 | ▶ | if (not($parens) and $count == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
not $parens and $count == 0
MC/DC0%0/2
not $parens and $count == 0
not $parens
$count == 0
Truth table66%2/3
not(A) and B
A= not $parensB= $count == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Expected VAR in inline data declaration"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | ▶ | } elsif (not($parens) and $count > 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
not $parens and $count > 1
MC/DC0%0/2
not $parens and $count > 1
not $parens
$count > 1
Truth table66%2/3
not(A) and B
A= not $parensB= $count > 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Inline data declaration can only have one variable when parens are omitted"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 3 | ▶ | my $short = (not($parens) and $count == 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
!$parens && $count == 1
MC/DC50%1/2
!$parens && $count == 1
!$parens
$count == 1
Truth table66%2/3
not(A) && B
A= !$parensB= $count == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 3 | $self->_eat('{'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 3 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 3 | ▶ | if (not($short) or ($short and $self->_Binding_test)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
not $short or $short and $self->_Binding_test
$short and $self->_Binding_test
MC/DC33%1/3
not $short or $short and $self->_Binding_test
not $short
$short
$self->_Binding_test
Truth table50%2/4
not(A) or B and C
A= not $shortB= $shortC= $self->_Binding_test
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 2 | ▶ | while ($self->_Binding_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 2 | my $terms = $self->_Binding($count); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 2 | push( @{ $self->{build}{bindings}{terms} }, $terms ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 1 | ▶ | while ($self->_BindingValue_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 2 | $self->_BindingValue; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 2 | my ($term) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 2 | push( @{ $self->{build}{bindings}{terms} }, [$term] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 3 | $self->_eat('}'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | 3 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 3 | $self->{build}{bindings}{vars} = \@vars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 86 | $self->__solution_modifiers( $star ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 86 | my $pattern = $self->{build}{triples}[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 86 | my @agg = $pattern->subpatterns_of_type( 'RDF::Query::Algebra::Aggregate', 'RDF::Query::Algebra::SubSelect' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 86 | ▶ | if (@agg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 17 | my ($agg) = @agg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 17 | my @gvars = $agg->groupby; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 17 | ▶ | if (scalar(@gvars) == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | # aggregate query with no explicit group keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 9 | foreach my $v (@{ $self->{build}{variables} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 11 | ▶ | if ($v->isa('RDF::Query::Node::Variable')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 0 | my $name = $v->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Variable used in projection but not present in aggregate grouping ($name)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 86 | delete $self->{build}{options}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 86 | $self->{build}{method} = 'SELECT'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 87 | ▶ | sub __SelectVars { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__SelectVars: called CC=10 SCAR=23.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 87 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 87 | my $star = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 87 | my @vars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 87 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 87 | ▶ | while ($self->_test('*') or $self->__SelectVar_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->_test("*") or $self->__SelectVar_test
MC/DC100%2/2
$self->_test("*") or $self->__SelectVar_test
$self->_test("*")
$self->__SelectVar_test
Truth table100%3/3
A or B
A= $self->_test("*")B= $self->__SelectVar_test
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 111 | ▶ | if ($self->_test('*')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 27 | $self->{build}{star}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 27 | $self->_eat('*'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 27 | $star = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 27 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 27 | $count++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 84 | $self->__SelectVar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 84 | push( @vars, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 84 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 84 | $count++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 87 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 87 | foreach my $v (@vars) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 84 | ▶ | if ($v->isa('RDF::Query::Node::Variable') or $v->isa('RDF::Query::Expression::Alias')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$v->isa("RDF::Query::Node::Variable") or $v->isa("RDF::Query::Expression::Alias")
MC/DC0%0/2
$v->isa("RDF::Query::Node::Variable") or $v->isa("RDF::Query::Expression::Alias")
$v->isa("RDF::Query::Node::Variable")
$v->isa("RDF::Query::Expression::Alias")
Truth table66%2/3
A or B
A= $v->isa("RDF::Query::Node::Variable")B= $v->isa("RDF::Query::Expression::Alias")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 84 | my $name = $v->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 84 | ▶ | if ($v->isa('RDF::Query::Expression::Alias')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 29 | ▶ | if ($seen{ $name }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Repeated variable ($name) used in projection list"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 84 | $seen{ $name }++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 87 | $self->{build}{variables} = \@vars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 87 | ▶ | if ($count == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: No select variable or expression specified"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 87 | return $star; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 29 | ▶ | sub _BrackettedAliasExpression { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_BrackettedAliasExpression: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 29 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 29 | $self->_eat('('); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 29 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 29 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 29 | my ($expr) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 29 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 29 | $self->_eat(qr/AS/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 29 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 29 | $self->_Var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 29 | my ($var) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 29 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 29 | $self->_eat(')'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 29 | my $alias = $self->new_alias_expression( $var, $expr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 29 | $self->_add_stack( $alias ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 171 | ▶ | sub __SelectVar_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__SelectVar_test: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 171 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 171 | local($self->{__aggregate_call_ok}) = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | # return 1 if $self->_BuiltInCall_test; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 171 | ▶ | return 1 if $self->_test( qr/[(]/i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 142 | return $self->{tokens} =~ m'^[?$]'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 84 | ▶ | sub __SelectVar { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__SelectVar: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 84 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 84 | local($self->{__aggregate_call_ok}) = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 84 | ▶ | if ($self->_test('(')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | 29 | $self->_BrackettedAliasExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | # } elsif ($self->_BuiltInCall_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | # $self->_BuiltInCall; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 55 | $self->_Var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | # [6] ConstructQuery ::= 'CONSTRUCT' ConstructTemplate DatasetClause* WhereClause SolutionModifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | 2 | ▶ | sub _ConstructQuery { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ConstructQuery: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | 2 | $self->_eat(qr/CONSTRUCT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 2 | my $shortcut = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 2 | ▶ | if ($self->_test( qr/[{]/ )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 2 | $shortcut = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 2 | $self->_ConstructTemplate; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 2 | $self->_DatasetClause(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 2 | ▶ | if ($shortcut) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 0 | $self->_TriplesWhereClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 2 | $self->_WhereClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | 2 | $self->_SolutionModifier(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 2 | my $pattern = $self->{build}{triples}[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 2 | my $triples = delete $self->{build}{construct_triples}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 2 | my $construct = RDF::Query::Algebra::Construct->new( $pattern, $triples ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 2 | $self->{build}{triples}[0] = $construct; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 2 | $self->{build}{method} = 'CONSTRUCT'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | # [7] DescribeQuery ::= 'DESCRIBE' ( VarOrIRIref+ | '*' ) DatasetClause* WhereClause? SolutionModifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 2 | ▶ | sub _DescribeQuery { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_DescribeQuery: called CC=4 SCAR=15.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 2 | $self->_eat(qr/DESCRIBE/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 2 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 2 | ▶ | if ($self->_test('*')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | 0 | $self->_eat('*'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | 0 | $self->{build}{variables} = ['*']; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 2 | $self->_VarOrIRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 2 | ▶ | while ($self->_VarOrIRIref_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 0 | $self->_VarOrIRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 2 | $self->{build}{variables} = [ splice(@{ $self->{stack} }) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 2 | $self->_DatasetClause(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 2 | ▶ | if ($self->_WhereClause_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 2 | $self->_WhereClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | 0 | my $pattern = RDF::Query::Algebra::GroupGraphPattern->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 0 | $self->_add_patterns( $pattern ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 2 | $self->_SolutionModifier(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | 2 | $self->{build}{method} = 'DESCRIBE'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | # [8] AskQuery ::= 'ASK' DatasetClause* WhereClause | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 2 | ▶ | sub _AskQuery { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_AskQuery: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 2 | $self->_eat(qr/ASK/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | 2 | $self->_DatasetClause(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 2 | $self->_WhereClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | 2 | $self->{build}{variables} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | 2 | $self->{build}{method} = 'ASK'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 0 | ▶ | sub _DatasetClause_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_DatasetClause_test: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 0 | return $self->_test( qr/FROM/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | # [9] DatasetClause ::= 'FROM' ( DefaultGraphClause | NamedGraphClause ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | 92 | ▶ | sub _DatasetClause { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_DatasetClause: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 92 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | # my @dataset; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 92 | $self->{build}{sources} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 92 | ▶ | while ($self->_test( qr/FROM/i )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 2 | $self->_eat( qr/FROM/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 2 | $self->__consume_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | 2 | ▶ | if ($self->_test( qr/NAMED/i )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | 2 | $self->_NamedGraphClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 0 | $self->_DefaultGraphClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | # [10] DefaultGraphClause ::= SourceSelector | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | 0 | ▶ | sub _DefaultGraphClause { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_DefaultGraphClause: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | 0 | $self->_SourceSelector; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | 0 | my ($source) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | 0 | push( @{ $self->{build}{sources} }, [$source] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | # [11] NamedGraphClause ::= 'NAMED' SourceSelector | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | 2 | ▶ | sub _NamedGraphClause { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_NamedGraphClause: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | 2 | $self->_eat( qr/NAMED/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | 2 | $self->_SourceSelector; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | 2 | my ($source) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | 2 | push( @{ $self->{build}{sources} }, [$source, 'NAMED'] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | # [12] SourceSelector ::= IRIref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | 2 | ▶ | sub _SourceSelector { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_SourceSelector: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | 2 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | # [13] WhereClause ::= 'WHERE'? GroupGraphPattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 2 | ▶ | sub _WhereClause_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_WhereClause_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | 2 | return $self->_test( qr/WHERE|{/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | 93 | ▶ | sub _WhereClause { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_WhereClause: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 93 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | 93 | ▶ | if ($self->_test( qr/WHERE/i )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 92 | $self->_eat( qr/WHERE/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 93 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | 93 | $self->_GroupGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | 93 | my $ggp = $self->_peek_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 93 | $ggp->check_duplicate_blanks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | 0 | ▶ | sub _TriplesWhereClause { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_TriplesWhereClause: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | 0 | $self->_push_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | 0 | $self->_eat( qr/WHERE/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | 0 | $self->_eat(qr/{/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | 0 | ▶ | if ($self->_TriplesBlock_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | 0 | $self->_TriplesBlock; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | 0 | $self->_eat(qr/}/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 0 | my $cont = $self->_pop_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | 0 | $self->{build}{construct_triples} = $cont->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 0 | my $pattern = RDF::Query::Algebra::GroupGraphPattern->new( @$cont ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 0 | $self->_add_patterns( $pattern ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | 5 | ▶ | sub _Binding_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Binding_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | 5 | return $self->_test( '(' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 2 | ▶ | sub _Binding { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Binding: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 2 | my $count = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | 2 | $self->_eat( '(' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | 2 | my @terms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | 2 | foreach my $i (1..$count) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | 4 | ▶ | unless ($self->_BindingValue_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | 0 | my $found = $i-1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Expected $count BindingValues but only found $found"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | 4 | $self->_BindingValue; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | 4 | push( @terms, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | 4 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | 2 | $self->_eat( ')' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | 2 | return \@terms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 7 | ▶ | sub _BindingValue_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_BindingValue_test: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | 7 | ▶ | return 1 if ($self->_IRIref_test); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | 6 | ▶ | return 1 if ($self->_test(qr/UNDEF|[<'".0-9]|(true|false)\b|_:|\([\n\r\t ]*\)/)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | 6 | ▶ | sub _BindingValue { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_BindingValue: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | 6 | ▶ | if ($self->_test(qr/UNDEF/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | 1 | $self->_eat(qr/UNDEF/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | 1 | push(@{ $self->{stack} }, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | 5 | $self->_GraphTerm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | # [20] GroupCondition ::= ( BuiltInCall | FunctionCall | '(' Expression ( 'AS' Var )? ')' | Var ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | 8 | ▶ | sub __GroupByVar_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__GroupByVar_test: called CC=5 SCAR=17.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | 8 | ▶ | return 1 if ($self->_BuiltInCall_test); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | 8 | ▶ | return 1 if ($self->_IRIref_test); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | 8 | ▶ | return 1 if ($self->_test( qr/[(]/i )); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | 8 | ▶ | return 1 if ($self->_test(qr/[\$?]/)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | 8 | ▶ | sub __GroupByVar { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__GroupByVar: called CC=5 SCAR=28.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | 8 | ▶ | if ($self->_test('(')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | 0 | $self->_eat('('); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | 0 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | 0 | my ($expr) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | 0 | ▶ | if ($self->_test(qr/AS/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | 0 | $self->_eat('AS'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | 0 | $self->_Var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | 0 | my ($var) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | 0 | my $alias = $self->new_alias_expression( $var, $expr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | 0 | $self->_add_stack( $alias ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | 0 | $self->_add_stack( $expr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | 0 | $self->_eat(')'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | } elsif ($self->_IRIref_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | 0 | $$self->_FunctionCall; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | } elsif ($self->_BuiltInCall_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 0 | $self->_BuiltInCall; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | 8 | $self->_Var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | # [14] SolutionModifier ::= OrderClause? LimitOffsetClauses? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | 91 | ▶ | sub _SolutionModifier { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_SolutionModifier: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | 91 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | 91 | ▶ | if ($self->_test( qr/GROUP\s+BY/i )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | 8 | $self->_GroupClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | 8 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | 91 | ▶ | if ($self->_test( qr/HAVING/i )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | 3 | $self->_HavingClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | 3 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | 91 | ▶ | if ($self->_OrderClause_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | 8 | $self->_OrderClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | 8 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | 91 | ▶ | if ($self->_LimitOffsetClauses_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | 3 | $self->_LimitOffsetClauses; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | 8 | ▶ | sub _GroupClause { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_GroupClause: called CC=15 SCAR=33.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | 8 | $self->_eat( qr/GROUP\s+BY/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | 8 | ▶ | if ($self->{build}{star}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: SELECT * cannot be used with aggregate grouping"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | 8 | ▶ | $self->{build}{__aggregate} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"build"}{"__aggregate"} ||= {}
MC/DC100%1/1
$self->{"build"}{"__aggregate"} ||= {}
$self->{"build"}{"__aggregate"}
Truth table100%2/2
A
A= $self->{"build"}{"__aggregate"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | 8 | my @vars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | 8 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | 8 | $self->__GroupByVar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | 8 | my ($v) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | 8 | push( @vars, $v ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | 8 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | 8 | ▶ | while ($self->__GroupByVar_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | 0 | $self->__GroupByVar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | 0 | my ($v) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | 0 | push( @vars, $v ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | 8 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | 8 | foreach my $v (@vars) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | 8 | ▶ | if ($v->isa('RDF::Query::Node::Variable') or $v->isa('RDF::Query::Expression::Alias')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$v->isa("RDF::Query::Node::Variable") or $v->isa("RDF::Query::Expression::Alias")
MC/DC0%0/2
$v->isa("RDF::Query::Node::Variable") or $v->isa("RDF::Query::Expression::Alias")
$v->isa("RDF::Query::Node::Variable")
$v->isa("RDF::Query::Expression::Alias")
Truth table33%1/3
A or B
A= $v->isa("RDF::Query::Node::Variable")B= $v->isa("RDF::Query::Expression::Alias")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | 8 | my $name = $v->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | 8 | $seen{ $name }++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | 8 | foreach my $v (@{ $self->{build}{variables} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | 14 | ▶ | if ($v->isa('RDF::Query::Node::Variable')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | 7 | my $name = $v->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | 7 | ▶ | unless ($seen{ $name }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Variable used in projection but not present in aggregate grouping ($name)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | } elsif ($v->isa('RDF::Query::Expression::Alias')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | 7 | my $expr = $v->expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | # warn 'expression: ' . Dumper($expr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | 7 | ▶ | if ($expr->isa('RDF::Query::Node::Variable::ExpressionProxy')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | # RDF::Query::Node::Variable::ExpressionProxy is used for aggregate operations. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | # we can ignore these because any variable used in an aggreate is valid, even if it's not mentioned in the grouping keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | } elsif ($expr->isa('RDF::Query::Expression')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | 0 | my @vars = $expr->nonaggregated_referenced_variables; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | 0 | foreach my $name (@vars) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | 0 | ▶ | unless ($seen{ $name }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Variable used in projection but not present in aggregate grouping ($name)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | 8 | $self->{build}{__group_by} = \@vars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | 8 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | 3 | ▶ | sub _HavingClause { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_HavingClause: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | 3 | $self->_eat(qr/HAVING/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | 3 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | 3 | ▶ | $self->{build}{__aggregate} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"build"}{"__aggregate"} ||= {}
MC/DC0%0/1
$self->{"build"}{"__aggregate"} ||= {}
$self->{"build"}{"__aggregate"}
Truth table50%1/2
A
A= $self->{"build"}{"__aggregate"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | 3 | local($self->{__aggregate_call_ok}) = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | 3 | $self->_Constraint; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | 3 | my ($expr) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | 3 | $self->{build}{__having} = $expr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | # [15] LimitOffsetClauses ::= ( LimitClause OffsetClause? | OffsetClause LimitClause? ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | 91 | ▶ | sub _LimitOffsetClauses_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_LimitOffsetClauses_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | 91 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | 91 | return $self->_test( qr/LIMIT|OFFSET/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | 3 | ▶ | sub _LimitOffsetClauses { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_LimitOffsetClauses: called CC=4 SCAR=16.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | 3 | ▶ | if ($self->_LimitClause_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | 3 | $self->_LimitClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | 3 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | 3 | ▶ | if ($self->_OffsetClause_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | 1 | $self->_OffsetClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | 0 | $self->_OffsetClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | 0 | ▶ | if ($self->_LimitClause_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | 0 | $self->_LimitClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | # [16] OrderClause ::= 'ORDER' 'BY' OrderCondition+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | 91 | ▶ | sub _OrderClause_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_OrderClause_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | 91 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | 91 | return $self->_test( qr/ORDER[\n\r\t ]+BY/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | 8 | ▶ | sub _OrderClause { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_OrderClause: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | 8 | $self->_eat( qr/ORDER/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | 8 | $self->__consume_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | 8 | $self->_eat( qr/BY/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | 8 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | 8 | my @order; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | 8 | ▶ | $self->{build}{__aggregate} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"build"}{"__aggregate"} ||= {}
MC/DC100%1/1
$self->{"build"}{"__aggregate"} ||= {}
$self->{"build"}{"__aggregate"}
Truth table100%2/2
A
A= $self->{"build"}{"__aggregate"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | 8 | local($self->{__aggregate_call_ok}) = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | 8 | $self->_OrderCondition; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | 8 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | 8 | push(@order, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | 8 | ▶ | while ($self->_OrderCondition_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | 0 | $self->_OrderCondition; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | 0 | push(@order, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | 8 | $self->{build}{options}{orderby} = \@order; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | # [17] OrderCondition ::= ( ( 'ASC' | 'DESC' ) BrackettedExpression ) | ( Constraint | Var ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | 8 | ▶ | sub _OrderCondition_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_OrderCondition_test: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | 8 | ▶ | return 1 if $self->_test( qr/ASC|DESC|[?\$]/i ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | 8 | ▶ | return 1 if $self->_Constraint_test; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | 8 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | 8 | ▶ | sub _OrderCondition { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_OrderCondition: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | 8 | my $dir = 'ASC'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | 8 | ▶ | if ($self->_test( qr/ASC|DESC/i )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | 4 | $dir = uc( $self->_eat( qr/ASC|DESC/i ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | 4 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | 4 | $self->_BrackettedExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | } elsif ($self->_test( qr/[?\$]/ )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | 3 | $self->_Var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | 1 | $self->_Constraint; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | 8 | my ($expr) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | 8 | $self->_add_stack( [ $dir, $expr ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | # [18] LimitClause ::= 'LIMIT' INTEGER | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | 3 | ▶ | sub _LimitClause_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_LimitClause_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | 3 | return $self->_test( qr/LIMIT/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | 3 | ▶ | sub _LimitClause { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_LimitClause: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | 3 | $self->_eat( qr/LIMIT/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | 3 | $self->__consume_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | 3 | my $limit = $self->_eat( $r_INTEGER ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | 3 | $self->{build}{options}{limit} = $limit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | # [19] OffsetClause ::= 'OFFSET' INTEGER | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | 3 | ▶ | sub _OffsetClause_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_OffsetClause_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | 3 | return $self->_test( qr/OFFSET/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | 1 | ▶ | sub _OffsetClause { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_OffsetClause: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | 1 | $self->_eat( qr/OFFSET/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | 1 | $self->__consume_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | 1 | my $off = $self->_eat( $r_INTEGER ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | 1 | $self->{build}{options}{offset} = $off; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | # [20] GroupGraphPattern ::= '{' TriplesBlock? ( ( GraphPatternNotTriples | Filter ) '.'? TriplesBlock? )* '}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | 132 | ▶ | sub _GroupGraphPattern { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_GroupGraphPattern: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | 132 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | 132 | $self->_eat('{'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | 132 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | 132 | ▶ | if ($self->_SubSelect_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | 1 | $self->_SubSelect; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | 131 | $self->_GroupGraphPatternSub; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | 132 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | 132 | $self->_eat('}'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | 131 | ▶ | sub _GroupGraphPatternSub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_GroupGraphPatternSub: called CC=16 SCAR=31.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | 131 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | 131 | $self->_push_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | 131 | my $got_pattern = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | 131 | my $need_dot = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | 131 | ▶ | if ($self->_TriplesBlock_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | 114 | $need_dot = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | 114 | $got_pattern++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 114 | $self->_TriplesBlock; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | 114 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | 131 | my $pos = length($self->{tokens}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | 131 | ▶ | while (not $self->_test('}')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | 40 | ▶ | if ($self->_GraphPatternNotTriples_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | 20 | $need_dot = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | 20 | $got_pattern++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | 20 | $self->_GraphPatternNotTriples; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | 20 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | 20 | my (@data) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | 20 | $self->__handle_GraphPatternNotTriples( @data ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | 20 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | } elsif ($self->_test( qr/FILTER/i )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | 20 | $got_pattern++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | 20 | $need_dot = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | 20 | $self->_Filter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | 20 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | 40 | ▶ | if ($need_dot or $self->_test('.')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$need_dot or $self->_test(".")
MC/DC50%1/2
$need_dot or $self->_test(".")
$need_dot
$self->_test(".")
Truth table66%2/3
A or B
A= $need_dotB= $self->_test(".")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | 7 | $self->_eat('.'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | 7 | ▶ | if ($got_pattern) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | 7 | $need_dot = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | 7 | $got_pattern = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Extra dot found without preceding pattern"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | 7 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | 40 | ▶ | if ($self->_TriplesBlock_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | 0 | my $peek = $self->_peek_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | 0 | ▶ | if (blessed($peek) and $peek->isa('RDF::Query::Algebra::BasicGraphPattern')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
builtin::blessed($peek) and $peek->isa("RDF::Query::Algebra::BasicGraphPattern")
MC/DC0%0/2
builtin::blessed($peek) and $peek->isa("RDF::Query::Algebra::BasicGraphPattern")
builtin::blessed($peek)
$peek->isa("RDF::Query::Algebra::BasicGraphPattern")
Truth table0%0/3
A and B
A= builtin::blessed($peek)B= $peek->isa("RDF::Query::Algebra::BasicGraphPattern")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | 0 | $self->_TriplesBlock; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | 0 | my $rhs = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | 0 | my $lhs = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | 0 | ▶ | if ($rhs->isa('RDF::Query::Algebra::BasicGraphPattern')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | 0 | my $merged = $self->__new_bgp( map { $_->triples } ($lhs, $rhs) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | 0 | $self->_add_patterns( $merged ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | 0 | my $merged = RDF::Query::Algebra::GroupGraphPattern->new($lhs, $rhs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | 0 | $self->_add_patterns( $merged ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | 0 | $self->_TriplesBlock; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | 40 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | 40 | ▶ | last unless ($self->_test( qr/\S/ )); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | 40 | my $new = length($self->{tokens}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | 40 | ▶ | if ($pos == $new) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | # we haven't progressed, and so would infinite loop if we don't break out and throw an error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | 0 | $self->_syntax_error(''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | 40 | $pos = $new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | 131 | my $cont = $self->_pop_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | 131 | my @filters = splice(@{ $self->{filters} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | 131 | my @patterns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | 131 | my $pattern = RDF::Query::Algebra::GroupGraphPattern->new( @$cont ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | 131 | ▶ | if (@filters) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | 19 | ▶ | while (my $f = shift @filters) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | 20 | $pattern = RDF::Query::Algebra::Filter->new( $f, $pattern ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | 131 | $self->_add_patterns( $pattern ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | 28 | ▶ | sub __handle_GraphPatternNotTriples { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__handle_GraphPatternNotTriples: called CC=11 SCAR=39.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | 28 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | 28 | my $data = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | 28 | my ($class, @args) = @$data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | 28 | ▶ | if ($class =~ /^RDF::Query::Algebra::(Optional|Minus)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | 6 | my $cont = $self->_pop_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | 6 | my $ggp = RDF::Query::Algebra::GroupGraphPattern->new( @$cont ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | 6 | $self->_push_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | # my $ggp = $self->_remove_pattern(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | 6 | ▶ | unless ($ggp) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | 0 | $ggp = RDF::Query::Algebra::GroupGraphPattern->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | 6 | my $opt = $class->new( $ggp, @args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | 6 | $self->_add_patterns( $opt ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | } elsif ($class eq 'RDF::Query::Algebra::Table') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | 0 | my ($table) = @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | 0 | $self->_add_patterns( $table ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | } elsif ($class eq 'RDF::Query::Algebra::Extend') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | 0 | my $cont = $self->_pop_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | 0 | my $ggp = RDF::Query::Algebra::GroupGraphPattern->new( @$cont ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | 0 | $self->_push_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | # my $ggp = $self->_remove_pattern(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | 0 | ▶ | unless ($ggp) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | 0 | $ggp = RDF::Query::Algebra::GroupGraphPattern->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | 0 | my $alias = $args[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | 0 | my %in_scope = map { $_ => 1 } $ggp->potentially_bound(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | 0 | my $var = $alias->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | 0 | ▶ | if (exists $in_scope{ $var }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | 0 | throw RDF::Query::Error::QueryPatternError -text => "Syntax error: BIND used with variable already in scope"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | 0 | my $bind = $class->new( $ggp, [$alias] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | 0 | $self->_add_patterns( $bind ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | } elsif ($class eq 'RDF::Query::Algebra::Service') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | 0 | my ($endpoint, $pattern, $silent) = @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | 0 | ▶ | if ($endpoint->isa('RDF::Query::Node::Variable')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1655 | # SERVICE ?var | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1656 | 0 | my $cont = $self->_pop_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1657 | 0 | my $ggp = RDF::Query::Algebra::GroupGraphPattern->new( @$cont ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1658 | 0 | $self->_push_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1659 | # my $ggp = $self->_remove_pattern(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1660 | 0 | ▶ | unless ($ggp) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1661 | 0 | $ggp = RDF::Query::Algebra::GroupGraphPattern->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1662 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1663 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1664 | 0 | my $service = $class->new( $endpoint, $pattern, $silent, $ggp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1665 | 0 | $self->_add_patterns( $service ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1666 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1667 | # SERVICE <endpoint> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1668 | # no-op | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1669 | 0 | my $service = $class->new( $endpoint, $pattern, $silent ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1670 | 0 | $self->_add_patterns( $service ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1671 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1672 | } elsif ($class =~ /RDF::Query::Algebra::(Union|NamedGraph|GroupGraphPattern)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1673 | # no-op | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1674 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1675 | 0 | throw RDF::Query::Error::ParseError 'Unrecognized GraphPattern: ' . $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1676 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1677 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1679 | 132 | ▶ | sub _SubSelect_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_SubSelect_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1680 | 132 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1681 | 132 | return $self->_test(qr/SELECT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1682 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1683 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1684 | 1 | ▶ | sub _SubSelect { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_SubSelect: called CC=21 SCAR=52.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1685 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1686 | 1 | my $pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1687 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1688 | 1 | local($self->{error}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1689 | 1 | local($self->{namespaces}) = $self->{namespaces}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1690 | 1 | local($self->{blank_ids}) = $self->{blank_ids}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1691 | 1 | local($self->{stack}) = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1692 | 1 | local($self->{filters}) = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1693 | 1 | local($self->{pattern_container_stack}) = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1694 | 1 | my $triples = $self->_push_pattern_container(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1695 | 1 | local($self->{build}) = { triples => $triples}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1696 | 1 | ▶ | if ($self->{baseURI}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1697 | 0 | $self->{build}{base} = $self->{baseURI}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1698 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1700 | 1 | $self->_eat(qr/SELECT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1701 | 1 | $self->__consume_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1702 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1703 | 1 | ▶ | if ($self->{tokens} =~ m/^(DISTINCT|REDUCED)/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1704 | 0 | my $mod = $self->_eat( qr/DISTINCT|REDUCED/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1705 | 0 | $self->__consume_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1706 | 0 | $self->{build}{options}{lc($mod)} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1707 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1708 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1709 | 1 | my $star = $self->__SelectVars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1711 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1712 | 1 | $self->_WhereClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1713 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1714 | 1 | ▶ | if ($star) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1715 | 0 | ▶ | my $triples = $self->{build}{triples} || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'build'}{'triples'} || []
MC/DC0%0/1
$self->{'build'}{'triples'} || []
$self->{'build'}{'triples'}
Truth table0%0/2
A
A= $self->{'build'}{'triples'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1716 | 0 | my @vars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1717 | 0 | foreach my $t (@$triples) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1718 | 0 | my @v = $t->potentially_bound; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1719 | 0 | push(@vars, @v); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1720 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1721 | 0 | @vars = RDF::Query::_uniq( @vars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1722 | 0 | push( @{ $self->{build}{variables} }, map { $self->new_variable($_) } @vars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1723 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1725 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1726 | 1 | $self->_SolutionModifier(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1727 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1728 | 1 | ▶ | if ($self->{build}{options}{orderby}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1729 | 0 | my $order = delete $self->{build}{options}{orderby}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1730 | 0 | my $pattern = pop(@{ $self->{build}{triples} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1731 | 0 | my $sort = RDF::Query::Algebra::Sort->new( $pattern, @$order ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1732 | 0 | push(@{ $self->{build}{triples} }, $sort); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1733 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1735 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1736 | 1 | ▶ | if ($self->_test( qr/VALUES/i )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1737 | 0 | $self->_eat( qr/VALUES/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1738 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1739 | 0 | my @vars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1740 | 0 | my $parens = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1741 | 0 | ▶ | if ($self->_test(qr/[(]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1742 | 0 | $self->_eat( qr/[(]/ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1743 | 0 | $parens = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1744 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1745 | 0 | ▶ | while ($self->_test(qr/[\$?]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1746 | 0 | $self->_Var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1747 | 0 | push( @vars, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1748 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1749 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1750 | 0 | ▶ | if ($parens) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1751 | 0 | $self->_eat( qr/[)]/ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1752 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1753 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1754 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1755 | 0 | my $count = scalar(@vars); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1756 | 0 | ▶ | if (not($parens) and $count == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
not $parens and $count == 0
MC/DC0%0/2
not $parens and $count == 0
not $parens
$count == 0
Truth table0%0/3
not(A) and B
A= not $parensB= $count == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1757 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Expected VAR in inline data declaration"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1758 | ▶ | } elsif (not($parens) and $count > 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not $parens and $count > 1
MC/DC0%0/2
not $parens and $count > 1
not $parens
$count > 1
Truth table0%0/3
not(A) and B
A= not $parensB= $count > 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1759 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Inline data declaration can only have one variable when parens are omitted"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1760 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1761 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1762 | 0 | ▶ | my $short = (not($parens) and $count == 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
!$parens && $count == 1
MC/DC0%0/2
!$parens && $count == 1
!$parens
$count == 1
Truth table0%0/3
not(A) && B
A= !$parensB= $count == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1763 | 0 | $self->_eat('{'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1764 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1765 | 0 | ▶ | if (not($short) or ($short and $self->_Binding_test)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not $short or $short and $self->_Binding_test
$short and $self->_Binding_test
MC/DC0%0/3
not $short or $short and $self->_Binding_test
not $short
$short
$self->_Binding_test
Truth table0%0/4
not(A) or B and C
A= not $shortB= $shortC= $self->_Binding_test
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1766 | 0 | ▶ | while ($self->_Binding_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1767 | 0 | my $terms = $self->_Binding($count); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1768 | 0 | push( @{ $self->{build}{bindings}{terms} }, $terms ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1769 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1770 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1771 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1772 | 0 | ▶ | while ($self->_BindingValue_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1773 | 0 | $self->_BindingValue; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1774 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1775 | 0 | my ($term) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1776 | 0 | push( @{ $self->{build}{bindings}{terms} }, [$term] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1777 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1778 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1779 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1780 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1781 | 0 | $self->_eat('}'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1782 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1783 | 0 | $self->{build}{bindings}{vars} = \@vars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1784 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1786 | 1 | $self->__solution_modifiers( $star ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1787 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1788 | 1 | delete $self->{build}{options}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1789 | 1 | my $data = delete $self->{build}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1790 | 1 | $data->{method} = 'SELECT'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1791 | my $query = RDF::Query->_new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1792 | base => $self->{baseURI}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1793 | # parser => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1794 | 1 | parsed => { %$data }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1795 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1796 | 1 | $pattern = RDF::Query::Algebra::SubSelect->new( $query ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1797 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1798 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1799 | 1 | $self->_add_patterns( $pattern ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1800 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1801 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1802 | # [21] TriplesBlock ::= TriplesSameSubject ( '.' TriplesBlock? )? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1803 | 317 | ▶ | sub _TriplesBlock_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_TriplesBlock_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1804 | 317 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1805 | # VarOrTerm | TriplesNode -> (Var | GraphTerm) | (Collection | BlankNodePropertyList) -> Var | IRIref | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL | Collection | BlankNodePropertyList | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1806 | # but since a triple can't start with a literal, this is reduced to: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1807 | # Var | IRIref | BlankNode | NIL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1808 | 317 | return $self->_test(qr/[\$?]|<|_:|\[[\n\r\t ]*\]|\([\n\r\t ]*\)|\[|[[(]|${r_PNAME_NS}/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1809 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1811 | 122 | ▶ | sub _TriplesBlock { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_TriplesBlock: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1812 | 122 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1813 | 122 | $self->_push_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1814 | 122 | $self->__TriplesBlock; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1815 | 122 | my $triples = $self->_pop_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1816 | 122 | my $bgp = $self->__new_bgp( @$triples ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1817 | 122 | $self->_add_patterns( $bgp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1818 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1819 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1820 | ## this one (with two underscores) doesn't pop patterns off the stack and make a BGP. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1821 | ## instead, things are left on the stack so we can recurse without doing the wrong thing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1822 | ## the one with one underscore (_TriplesBlock) will pop everything off and make the BGP. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1823 | 122 | ▶ | sub __TriplesBlock { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__TriplesBlock: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1824 | 122 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1825 | 122 | my $got_dot = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1826 | 151 | TRIPLESBLOCKLOOP: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1827 | $self->_TriplesSameSubjectPath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1828 | 151 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1829 | 151 | ▶ | while ($self->_test('.')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1830 | 97 | ▶ | if ($got_dot) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1831 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: found extra DOT after TriplesBlock"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1832 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1833 | 97 | $self->_eat('.'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1834 | 97 | $got_dot++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1835 | 97 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1836 | 97 | ▶ | if ($self->_TriplesBlock_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1837 | 29 | $got_dot = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1838 | 29 | goto TRIPLESBLOCKLOOP; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1839 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1840 | 68 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1841 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1842 | 122 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1843 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1844 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1845 | # [22] GraphPatternNotTriples ::= OptionalGraphPattern | GroupOrUnionGraphPattern | GraphGraphPattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1846 | 40 | ▶ | sub _GraphPatternNotTriples_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_GraphPatternNotTriples_test: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1847 | 40 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1848 | 40 | ▶ | return 1 if $self->_test(qr/VALUES/i); # InlineDataClause | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1849 | 40 | return $self->_test(qr/BIND|SERVICE|MINUS|OPTIONAL|{|GRAPH/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1850 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1851 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1852 | 20 | ▶ | sub _GraphPatternNotTriples { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_GraphPatternNotTriples: called CC=7 SCAR=22.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1853 | 20 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1854 | 20 | ▶ | if ($self->_test(qr/VALUES/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1855 | 0 | $self->_InlineDataClause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1856 | } elsif ($self->_test(qr/SERVICE/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1857 | 0 | $self->_ServiceGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1858 | } elsif ($self->_test(qr/MINUS/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1859 | 0 | $self->_MinusGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1860 | } elsif ($self->_test(qr/BIND/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1861 | 0 | $self->_Bind; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1862 | } elsif ($self->_OptionalGraphPattern_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1863 | 6 | $self->_OptionalGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1864 | } elsif ($self->_GroupOrUnionGraphPattern_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1865 | 7 | $self->_GroupOrUnionGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1866 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1867 | 7 | $self->_GraphGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1868 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1869 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1870 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1871 | 0 | ▶ | sub _InlineDataClause { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_InlineDataClause: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1872 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1873 | 0 | $self->_eat( qr/VALUES/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1874 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1875 | 0 | my @vars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1876 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1877 | 0 | my $parens = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1878 | 0 | ▶ | if ($self->_test(qr/[(]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1879 | 0 | $self->_eat( qr/[(]/ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1880 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1881 | 0 | $parens = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1882 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1883 | 0 | ▶ | while ($self->_test(qr/[\$?]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1884 | 0 | $self->_Var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1885 | 0 | push( @vars, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1886 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1887 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1888 | 0 | ▶ | if ($parens) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1889 | 0 | $self->_eat( qr/[)]/ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1890 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1891 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1892 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1893 | 0 | my $count = scalar(@vars); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1894 | 0 | ▶ | if (not($parens) and $count == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
not $parens and $count == 0
MC/DC0%0/2
not $parens and $count == 0
not $parens
$count == 0
Truth table0%0/3
not(A) and B
A= not $parensB= $count == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1895 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Expected VAR in inline data declaration"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1896 | ▶ | } elsif (not($parens) and $count > 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not $parens and $count > 1
MC/DC0%0/2
not $parens and $count > 1
not $parens
$count > 1
Truth table0%0/3
not(A) and B
A= not $parensB= $count > 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1897 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Inline data declaration can only have one variable when parens are omitted"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1898 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1899 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1900 | 0 | ▶ | my $short = (not($parens) and $count == 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
!$parens && $count == 1
MC/DC0%0/2
!$parens && $count == 1
!$parens
$count == 1
Truth table0%0/3
not(A) && B
A= !$parensB= $count == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1901 | 0 | $self->_eat('{'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1902 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1903 | 0 | my @rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1904 | 0 | ▶ | if (not($short) or ($short and $self->_Binding_test)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not $short or $short and $self->_Binding_test
$short and $self->_Binding_test
MC/DC0%0/3
not $short or $short and $self->_Binding_test
not $short
$short
$self->_Binding_test
Truth table0%0/4
not(A) or B and C
A= not $shortB= $shortC= $self->_Binding_test
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1905 | # { (term) (term) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1906 | 0 | ▶ | while ($self->_Binding_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1907 | 0 | my $terms = $self->_Binding($count); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1908 | 0 | push( @rows, $terms ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1909 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1910 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1911 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1912 | # { term term } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1913 | 0 | ▶ | while ($self->_BindingValue_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1914 | 0 | $self->_BindingValue; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1915 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1916 | 0 | my ($term) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1917 | 0 | push( @rows, [$term] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1918 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1919 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1920 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1921 | 0 | $self->_eat('}'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1922 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1923 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1924 | 0 | my @vbs = map { my %d; @d{ map { $_->name } @vars } = @$_; RDF::Query::VariableBindings->new(\%d) } @rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1925 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1926 | 0 | my $table = RDF::Query::Algebra::Table->new( [ map { $_->name } @vars ], @vbs ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1927 | 0 | $self->_add_stack( ['RDF::Query::Algebra::Table', $table] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1928 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1929 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1930 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1931 | 0 | ▶ | sub _Bind { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Bind: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1932 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1933 | 0 | $self->_eat(qr/BIND/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1934 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1935 | 0 | $self->_BrackettedAliasExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1936 | 0 | my ($alias) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1937 | 0 | $self->_add_stack( ['RDF::Query::Algebra::Extend', $alias] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1938 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1939 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1940 | 0 | ▶ | sub _ServiceGraphPattern { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ServiceGraphPattern: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1941 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1942 | 0 | my $op = $self->_eat( qr/SERVICE(\s+SILENT)?/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1943 | 0 | my $silent = ($op =~ /SILENT/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1944 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1945 | 0 | $self->__close_bgp_with_filters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1946 | 0 | ▶ | if ($self->_test(qr/[\$?]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1947 | 0 | $self->_Var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1948 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1949 | 0 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1950 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1951 | 0 | my ($endpoint) = splice( @{ $self->{stack} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1952 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1953 | 0 | $self->_GroupGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1954 | 0 | my $ggp = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1955 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1956 | # my $pattern = RDF::Query::Algebra::Service->new( $endpoint, $ggp, $silent ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1957 | # $self->_add_patterns( $pattern ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1958 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1959 | 0 | ▶ | my $opt = ['RDF::Query::Algebra::Service', $endpoint, $ggp, ($silent ? 1 : 0)]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1960 | 0 | $self->_add_stack( $opt ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1961 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1962 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1963 | # [23] OptionalGraphPattern ::= 'OPTIONAL' GroupGraphPattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1964 | 20 | ▶ | sub _OptionalGraphPattern_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_OptionalGraphPattern_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1965 | 20 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1966 | 20 | return $self->_test( qr/OPTIONAL/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1967 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1968 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1969 | 6 | ▶ | sub __close_bgp_with_filters { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__close_bgp_with_filters: called CC=4 SCAR=23.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1970 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1971 | 6 | my @filters = splice(@{ $self->{filters} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1972 | 6 | ▶ | if (@filters) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1973 | 0 | my $cont = $self->_pop_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1974 | 0 | my $ggp = RDF::Query::Algebra::GroupGraphPattern->new( @$cont ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1975 | 0 | $self->_push_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1976 | # my $ggp = $self->_remove_pattern(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1977 | 0 | ▶ | unless ($ggp) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1978 | 0 | $ggp = RDF::Query::Algebra::GroupGraphPattern->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1979 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1980 | 0 | ▶ | while (my $f = shift @filters) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1981 | 0 | $ggp = RDF::Query::Algebra::Filter->new( $f, $ggp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1982 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1983 | 0 | $self->_add_patterns($ggp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1984 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1985 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1986 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1987 | 6 | ▶ | sub _OptionalGraphPattern { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_OptionalGraphPattern: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1988 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1989 | 6 | $self->_eat( qr/OPTIONAL/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1990 | 6 | $self->__close_bgp_with_filters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1991 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1992 | 6 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1993 | 6 | $self->_GroupGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1994 | 6 | my $ggp = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1995 | 6 | my $opt = ['RDF::Query::Algebra::Optional', $ggp]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1996 | 6 | $self->_add_stack( $opt ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1997 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1998 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1999 | 0 | ▶ | sub _MinusGraphPattern { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_MinusGraphPattern: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2000 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2001 | 0 | $self->_eat( qr/MINUS/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2002 | 0 | $self->__close_bgp_with_filters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2003 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2004 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2005 | 0 | $self->_GroupGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2006 | 0 | my $ggp = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2007 | 0 | my $opt = ['RDF::Query::Algebra::Minus', $ggp]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2008 | 0 | $self->_add_stack( $opt ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2009 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2010 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2011 | # [24] GraphGraphPattern ::= 'GRAPH' VarOrIRIref GroupGraphPattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2012 | 15 | ▶ | sub _GraphGraphPattern { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_GraphGraphPattern: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2013 | 15 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2014 | 15 | ▶ | if ($self->{__data_pattern}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2015 | 4 | ▶ | if ($self->{__graph_nesting_level}++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2016 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Nested named GRAPH blocks not allowed in data template."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2017 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2018 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2019 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2020 | 15 | $self->_eat( qr/GRAPH\b/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2021 | 15 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2022 | 15 | $self->_VarOrIRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2023 | 15 | my ($graph) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2024 | 15 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2025 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2026 | 15 | ▶ | if ($graph->isa('RDF::Trine::Node::Resource')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2027 | 9 | local($self->{named_graph}) = $graph; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2028 | 9 | $self->_GroupGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2029 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2030 | 6 | $self->_GroupGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2031 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2032 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2033 | 15 | ▶ | if ($self->{__data_pattern}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2034 | 4 | $self->{__graph_nesting_level}--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2035 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2036 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2037 | 15 | my $ggp = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2038 | 15 | my $pattern = RDF::Query::Algebra::NamedGraph->new( $graph, $ggp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2039 | 15 | $self->_add_patterns( $pattern ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2040 | 15 | $self->_add_stack( [ 'RDF::Query::Algebra::NamedGraph' ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2041 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2042 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2043 | # [25] GroupOrUnionGraphPattern ::= GroupGraphPattern ( 'UNION' GroupGraphPattern )* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2044 | 14 | ▶ | sub _GroupOrUnionGraphPattern_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_GroupOrUnionGraphPattern_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2045 | 14 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2046 | 14 | return $self->_test('{'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2047 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2048 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2049 | 7 | ▶ | sub _GroupOrUnionGraphPattern { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_GroupOrUnionGraphPattern: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2050 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2051 | 7 | $self->_GroupGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2052 | 7 | my $ggp = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2053 | 7 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2054 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2055 | 7 | ▶ | if ($self->_test( qr/UNION/i )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2056 | 6 | ▶ | while ($self->_test( qr/UNION/i )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2057 | 6 | $self->_eat( qr/UNION/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2058 | 6 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2059 | 6 | $self->_GroupGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2060 | 6 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2061 | 6 | my $rhs = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2062 | 6 | $ggp = RDF::Query::Algebra::Union->new( $ggp, $rhs ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2063 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2064 | 6 | $self->_add_patterns( $ggp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2065 | 6 | $self->_add_stack( [ 'RDF::Query::Algebra::Union' ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2066 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2067 | 1 | $self->_add_patterns( $ggp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2068 | 1 | $self->_add_stack( [ 'RDF::Query::Algebra::GroupGraphPattern' ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2069 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2070 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2071 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2072 | # [26] Filter ::= 'FILTER' Constraint | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2073 | 20 | ▶ | sub _Filter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Filter: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2074 | 20 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2075 | 20 | $self->_eat( qr/FILTER/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2076 | 20 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2077 | 20 | $self->_Constraint; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2078 | 20 | my ($expr) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2079 | 20 | $self->_add_filter( $expr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2080 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2081 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2082 | # [27] Constraint ::= BrackettedExpression | BuiltInCall | FunctionCall | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2083 | 8 | ▶ | sub _Constraint_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Constraint_test: called CC=4 SCAR=14.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2084 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2085 | 8 | ▶ | return 1 if $self->_test( qr/[(]/ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2086 | 8 | ▶ | return 1 if $self->_BuiltInCall_test; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2087 | 8 | ▶ | return 1 if $self->_FunctionCall_test; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2088 | 8 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2089 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2090 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2091 | 24 | ▶ | sub _Constraint { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Constraint: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2092 | 24 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2093 | 24 | ▶ | if ($self->_BrackettedExpression_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2094 | 23 | $self->_BrackettedExpression(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2095 | } elsif ($self->_BuiltInCall_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2096 | 0 | $self->_BuiltInCall(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2097 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2098 | 1 | $self->_FunctionCall(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2099 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2102 | # [28] FunctionCall ::= IRIref ArgList | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2103 | 8 | ▶ | sub _FunctionCall_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_FunctionCall_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2104 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2105 | 8 | return $self->_IRIref_test; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2108 | 1 | ▶ | sub _FunctionCall { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_FunctionCall: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2109 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2110 | 1 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2111 | 1 | my ($iri) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2113 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2115 | 1 | $self->_ArgList; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2116 | 1 | my @args = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2117 | 1 | my $func = $self->new_function_expression( $iri, @args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2118 | 1 | $self->_add_stack( $func ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2121 | # [29] ArgList ::= ( NIL | '(' Expression ( ',' Expression )* ')' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2122 | 11 | ▶ | sub _ArgList_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ArgList_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2123 | 11 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2124 | 11 | return $self->_test('('); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2127 | 16 | ▶ | sub _ArgList { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ArgList: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2128 | 16 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2129 | 16 | $self->_eat('('); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2130 | 16 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2131 | 16 | my @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2132 | 16 | ▶ | unless ($self->_test(')')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2133 | 16 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2134 | 16 | push( @args, splice(@{ $self->{stack} }) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2135 | 16 | ▶ | while ($self->_test(',')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2136 | 7 | $self->_eat(','); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2137 | 7 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2138 | 7 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2139 | 7 | push( @args, splice(@{ $self->{stack} }) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2142 | 16 | $self->_eat(')'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2143 | 16 | $self->_add_stack( @args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2146 | # [30] ConstructTemplate ::= '{' ConstructTriples? '}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2147 | 2 | ▶ | sub _ConstructTemplate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ConstructTemplate: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2148 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2149 | 2 | $self->_push_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2150 | 2 | $self->_eat( '{' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2151 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2153 | 2 | ▶ | if ($self->_ConstructTriples_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2154 | 2 | $self->_ConstructTriples; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2157 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2158 | 2 | $self->_eat( '}' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2159 | 2 | my $cont = $self->_pop_pattern_container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2160 | 2 | $self->{build}{construct_triples} = $cont; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2163 | # [31] ConstructTriples ::= TriplesSameSubject ( '.' ConstructTriples? )? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2164 | 3 | ▶ | sub _ConstructTriples_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ConstructTriples_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2165 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2166 | 3 | return $self->_TriplesBlock_test; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2169 | 2 | ▶ | sub _ConstructTriples { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ConstructTriples: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2170 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2171 | 2 | $self->_TriplesSameSubject; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2172 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2173 | 2 | ▶ | while ($self->_test(qr/[.]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2174 | 1 | $self->_eat( qr/[.]/ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2175 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2176 | 1 | ▶ | if ($self->_ConstructTriples_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2177 | 0 | $self->_TriplesSameSubject; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2182 | # [32] TriplesSameSubject ::= VarOrTerm PropertyListNotEmpty | TriplesNode PropertyList | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2183 | 2 | ▶ | sub _TriplesSameSubject { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_TriplesSameSubject: called CC=4 SCAR=16.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2184 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2185 | 2 | my @triples; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2186 | 2 | ▶ | if ($self->_TriplesNode_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2187 | 0 | $self->_TriplesNode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2188 | 0 | my ($s) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2189 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2190 | 0 | $self->_PropertyList; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2191 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2193 | 0 | my @list = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2194 | 0 | foreach my $data (@list) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2195 | 0 | push(@triples, $self->__new_statement( $s, @$data )); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2197 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2198 | 2 | $self->_VarOrTerm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2199 | 2 | my ($s) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2201 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2202 | 2 | $self->_PropertyListNotEmpty; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2203 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2204 | 2 | my (@list) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2205 | 2 | foreach my $data (@list) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2206 | 2 | push(@triples, $self->__new_statement( $s, @$data )); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2210 | 2 | $self->_add_patterns( @triples ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2211 | # return @triples; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2214 | # TriplesSameSubjectPath ::= VarOrTerm PropertyListNotEmptyPath | TriplesNode PropertyListPath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2215 | 151 | ▶ | sub _TriplesSameSubjectPath { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_TriplesSameSubjectPath: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2216 | 151 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2217 | 151 | my @triples; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2218 | 151 | ▶ | if ($self->_TriplesNode_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2219 | 9 | $self->_TriplesNode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2220 | 9 | my ($s) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2221 | 9 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2222 | 9 | $self->_PropertyListPath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2223 | 9 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2225 | 9 | my @list = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2226 | 9 | foreach my $data (@list) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2227 | 0 | push(@triples, $self->__new_statement( $s, @$data )); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2229 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2230 | 142 | $self->_VarOrTerm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2231 | 142 | my ($s) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2233 | 142 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2234 | 142 | $self->_PropertyListNotEmptyPath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2235 | 142 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2236 | 142 | my (@list) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2237 | 142 | foreach my $data (@list) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2238 | 187 | push(@triples, $self->__new_statement( $s, @$data )); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2242 | 151 | $self->_add_patterns( @triples ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2243 | # return @triples; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2246 | # [33] PropertyListNotEmpty ::= Verb ObjectList ( ';' ( Verb ObjectList )? )* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2247 | 2 | ▶ | sub _PropertyListNotEmpty { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PropertyListNotEmpty: called CC=3 SCAR=14.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2248 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2249 | 2 | $self->_Verb; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2250 | 2 | my ($v) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2251 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2252 | 2 | $self->_ObjectList; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2253 | 2 | my @l = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2254 | 2 | my @props = map { [$v, $_] } @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2255 | 2 | ▶ | while ($self->_test(qr'\s*;')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2256 | 0 | $self->_eat(';'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2257 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2258 | 0 | ▶ | if ($self->_Verb_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2259 | 0 | $self->_Verb; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2260 | 0 | my ($v) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2261 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2262 | 0 | $self->_ObjectList; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2263 | 0 | my @l = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2264 | 0 | push(@props, map { [$v, $_] } @l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2267 | 2 | $self->_add_stack( @props ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2270 | # [34] PropertyList ::= PropertyListNotEmpty? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2271 | 0 | ▶ | sub _PropertyList { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PropertyList: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2272 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2273 | 0 | ▶ | if ($self->_Verb_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2274 | 0 | $self->_PropertyListNotEmpty; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2278 | # [33] PropertyListNotEmptyPath ::= (VerbPath | VerbSimple) ObjectList ( ';' ( (VerbPath | VerbSimple) ObjectList )? )* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2279 | 155 | ▶ | sub _PropertyListNotEmptyPath { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PropertyListNotEmptyPath: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2280 | 155 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2281 | 155 | ▶ | if ($self->_VerbPath_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2282 | 149 | $self->_VerbPath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2283 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2284 | 6 | $self->_VerbSimple; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2286 | 155 | my ($v) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2287 | 155 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2288 | 155 | $self->_ObjectList; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2289 | 155 | my @l = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2290 | 155 | my @props = map { [$v, $_] } @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2291 | 155 | ▶ | while ($self->_test(qr'\s*;')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2292 | 52 | $self->_eat(';'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2293 | 52 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2294 | 52 | ▶ | if ($self->_VerbPath_test or $self->_VerbSimple_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->_VerbPath_test or $self->_VerbSimple_test
MC/DC50%1/2
$self->_VerbPath_test or $self->_VerbSimple_test
$self->_VerbPath_test
$self->_VerbSimple_test
Truth table66%2/3
A or B
A= $self->_VerbPath_testB= $self->_VerbSimple_test
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2295 | 51 | ▶ | if ($self->_VerbPath_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2296 | 51 | $self->_VerbPath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2297 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2298 | 0 | $self->_VerbSimple; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2300 | 51 | my ($v) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2301 | 51 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2302 | 51 | $self->_ObjectList; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2303 | 51 | my @l = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2304 | 51 | push(@props, map { [$v, $_] } @l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2305 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2307 | 155 | $self->_add_stack( @props ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2310 | # [34] PropertyListPath ::= PropertyListNotEmptyPath? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2311 | 9 | ▶ | sub _PropertyListPath { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PropertyListPath: called CC=2 SCAR=8.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2312 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2313 | 9 | ▶ | if ($self->_Verb_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2314 | 0 | $self->_PropertyListNotEmptyPath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2316 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2318 | # [35] ObjectList ::= Object ( ',' Object )* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2319 | 208 | ▶ | sub _ObjectList { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ObjectList: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2320 | 208 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2322 | 208 | my @list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2323 | 208 | $self->_Object; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2324 | 208 | push(@list, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2326 | 208 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2327 | 208 | ▶ | while ($self->_test(',')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2328 | 2 | $self->_eat(','); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2329 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2330 | 2 | $self->_Object; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2331 | 2 | push(@list, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2332 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2334 | 208 | $self->_add_stack( @list ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2337 | # [36] Object ::= GraphNode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2338 | 210 | ▶ | sub _Object { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Object: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2339 | 210 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2340 | 210 | $self->_GraphNode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2343 | # [37] Verb ::= VarOrIRIref | 'a' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2344 | 9 | ▶ | sub _Verb_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Verb_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2345 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2346 | 9 | return $self->_test( qr/a[\n\t\r <]|[?\$]|<|${r_PNAME_LN}|${r_PNAME_NS}/ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2349 | 2 | ▶ | sub _Verb { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Verb: called CC=2 SCAR=9.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2350 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2351 | 2 | ▶ | if ($self->_test(qr/a[\n\t\r <]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2352 | 0 | $self->_eat('a'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2353 | 0 | $self->__consume_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2354 | 0 | my $type = RDF::Query::Node::Resource->new( $rdf->type->uri_value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2355 | 0 | $self->_add_stack( $type ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2356 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2357 | 2 | $self->_VarOrIRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2358 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2361 | # VerbSimple ::= Var | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2362 | 1 | ▶ | sub _VerbSimple_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_VerbSimple_test: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2363 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2364 | 1 | ▶ | return 1 if ($self->_test(qr/[\$?]/)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2367 | 6 | ▶ | sub _VerbSimple { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_VerbSimple: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2368 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2369 | 6 | $self->_Var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2372 | # VerbPath ::= Path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2373 | 258 | ▶ | sub _VerbPath_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_VerbPath_test: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2374 | 258 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2375 | 258 | ▶ | return 1 if ($self->_IRIref_test); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2376 | 49 | ▶ | return 1 if ($self->_test(qr/\^|[|(a!]/)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2377 | 7 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2378 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2380 | 200 | ▶ | sub _VerbPath { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_VerbPath: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2381 | 200 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2382 | 200 | $self->_Path | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2385 | # [74] Path ::= PathAlternative | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2386 | 200 | ▶ | sub _Path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Path: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2387 | 200 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2388 | # my $distinct = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2389 | # if ($self->_test(qr/DISTINCT[(]/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2390 | # $self->_eat(qr/DISTINCT[(]/i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2391 | # $self->__consume_ws_opt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2392 | # $distinct = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2393 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2394 | 200 | $self->_PathAlternative; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2395 | # if ($distinct) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2396 | # $self->__consume_ws_opt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2397 | # $self->_eat(qr/[)]/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2398 | # $self->__consume_ws_opt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2399 | # my ($path) = splice(@{ $self->{stack} }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2400 | # $self->_add_stack( ['PATH', 'DISTINCT', $path] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2401 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2404 | ################################################################################ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2406 | # [75] PathAlternative ::= PathSequence ( '|' PathSequence )* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2407 | 200 | ▶ | sub _PathAlternative { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PathAlternative: called CC=2 SCAR=11.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2408 | 200 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2409 | 200 | $self->_PathSequence; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2410 | 200 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2411 | 200 | ▶ | while ($self->_test(qr/[|]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2412 | 0 | my ($lhs) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2413 | 0 | $self->_eat(qr/[|]/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2414 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2415 | # $self->_PathOneInPropertyClass; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2416 | 0 | $self->_PathSequence; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2417 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2418 | 0 | my ($rhs) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2419 | 0 | $self->_add_stack( ['PATH', '|', $lhs, $rhs] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2423 | # [76] PathSequence ::= PathEltOrInverse ( '/' PathEltOrInverse | '^' PathElt )* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2424 | 200 | ▶ | sub _PathSequence { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PathSequence: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2425 | 200 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2426 | 200 | $self->_PathEltOrInverse; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2427 | 200 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2428 | 200 | ▶ | while ($self->_test(qr<[/^]>)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2429 | 5 | my $op; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2430 | 5 | my ($lhs) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2431 | 5 | ▶ | if ($self->_test(qr</>)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2432 | 5 | $op = $self->_eat(qr</>); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2433 | 5 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2434 | 5 | $self->_PathEltOrInverse; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2435 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2436 | 0 | $op = $self->_eat(qr<\^>); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2437 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2438 | 0 | $self->_PathElt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2439 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2440 | 5 | my ($rhs) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2441 | 5 | $self->_add_stack( ['PATH', $op, $lhs, $rhs] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2442 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2444 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2445 | # [77] PathElt ::= PathPrimary PathMod? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2446 | 205 | ▶ | sub _PathElt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PathElt: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2447 | 205 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2448 | 205 | $self->_PathPrimary; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2449 | # $self->__consume_ws_opt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2450 | 205 | ▶ | if ($self->_PathMod_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2451 | 2 | my @path = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2452 | 2 | $self->_PathMod; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2453 | 2 | my ($mod) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2454 | 2 | ▶ | if (defined($mod)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2455 | 2 | $self->_add_stack( ['PATH', $mod, @path] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2456 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2457 | # this might happen if we descend into _PathMod by mistaking a + as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2458 | # a path modifier, but _PathMod figures out it's actually part of a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2459 | # signed numeric object that follows the path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2460 | 0 | $self->_add_stack( @path ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2461 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2465 | # [78] PathEltOrInverse ::= PathElt | '^' PathElt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2466 | 205 | ▶ | sub _PathEltOrInverse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PathEltOrInverse: called CC=2 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2467 | 205 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2468 | 205 | ▶ | if ($self->_test(qr/\^/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2469 | 0 | $self->_eat(qr<\^>); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2470 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2471 | 0 | $self->_PathElt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2472 | 0 | my @props = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2473 | 0 | $self->_add_stack( [ 'PATH', '^', @props ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2474 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2475 | 205 | $self->_PathElt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2476 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2477 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2479 | # [79] PathMod ::= ( '*' | '?' | '+' | '{' ( Integer ( ',' ( '}' | Integer '}' ) | '}' ) ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2480 | 205 | ▶ | sub _PathMod_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PathMod_test: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2481 | 205 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2482 | 205 | ▶ | return 1 if ($self->_test(qr/[*?+{]/)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2483 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2485 | 2 | ▶ | sub _PathMod { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PathMod: called CC=3 SCAR=11.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2486 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2487 | 2 | ▶ | if ($self->_test(qr/[*?+]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2488 | 2 | ▶ | if ($self->_test(qr/[+][.0-9]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2489 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2490 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2491 | 2 | $self->_add_stack( $self->_eat(qr/[*?+]/) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2492 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2494 | ### path repetition range syntax :path{n,m}; removed from 1.1 Query 2LC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2495 | # } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2496 | # $self->_eat(qr/{/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2497 | # $self->__consume_ws_opt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2498 | # my $value = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2499 | # if ($self->_test(qr/}/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2500 | # throw RDF::Query::Error::ParseError -text => "Syntax error: Empty Path Modifier"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2501 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2502 | # if ($self->_test($r_INTEGER)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2503 | # $value = $self->_eat( $r_INTEGER ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2504 | # $self->__consume_ws_opt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2505 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2506 | # if ($self->_test(qr/,/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2507 | # $self->_eat(qr/,/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2508 | # $self->__consume_ws_opt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2509 | # if ($self->_test(qr/}/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2510 | # $self->_eat(qr/}/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2511 | # $self->_add_stack( "$value-" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2512 | # } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2513 | # my $end = $self->_eat( $r_INTEGER ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2514 | # $self->__consume_ws_opt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2515 | # $self->_eat(qr/}/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2516 | # $self->_add_stack( "$value-$end" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2517 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2518 | # } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2519 | # $self->_eat(qr/}/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2520 | # $self->_add_stack( "$value" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2521 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2525 | # [80] PathPrimary ::= ( IRIref | 'a' | '!' PathNegatedPropertyClass | '(' Path ')' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2526 | 205 | ▶ | sub _PathPrimary { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PathPrimary: called CC=4 SCAR=20.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2527 | 205 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2528 | 205 | ▶ | if ($self->_IRIref_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2529 | 163 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2530 | } elsif ($self->_test(qr/a[\n\t\r <]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2531 | 42 | $self->_eat(qr/a/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2532 | 42 | my $type = RDF::Query::Node::Resource->new( $rdf->type->uri_value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2533 | 42 | $self->_add_stack( $type ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2534 | } elsif ($self->_test(qr/[!]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2535 | 0 | $self->_eat(qr/[!]/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2536 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2537 | 0 | $self->_PathNegatedPropertyClass; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2538 | 0 | my (@path) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2539 | 0 | $self->_add_stack( ['PATH', '!', @path] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2540 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2541 | 0 | $self->_eat(qr/[(]/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2542 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2543 | 0 | $self->_Path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2544 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2545 | 0 | $self->_eat(qr/[)]/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2546 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2547 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2549 | # [81] PathNegatedPropertyClass ::= ( PathOneInPropertyClass | '(' ( PathOneInPropertyClass ( '|' PathOneInPropertyClass )* )? ')' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2550 | 0 | ▶ | sub _PathNegatedPropertyClass { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PathNegatedPropertyClass: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2551 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2552 | 0 | ▶ | if ($self->_test(qr/[(]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2553 | 0 | $self->_eat(qr/[(]/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2554 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2555 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2556 | 0 | my @nodes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2557 | 0 | ▶ | if ($self->_PathOneInPropertyClass_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2558 | 0 | $self->_PathOneInPropertyClass; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2559 | 0 | push(@nodes, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2560 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2561 | 0 | ▶ | while ($self->_test(qr/[|]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2562 | 0 | $self->_eat(qr/[|]/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2563 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2564 | 0 | $self->_PathOneInPropertyClass; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2565 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2566 | 0 | push(@nodes, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2567 | # $self->_add_stack( ['PATH', '|', $lhs, $rhs] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2568 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2570 | 0 | $self->_eat(qr/[)]/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2571 | 0 | $self->_add_stack( @nodes ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2572 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2573 | 0 | $self->_PathOneInPropertyClass; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2574 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2575 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2577 | # [82] PathOneInPropertyClass ::= IRIref | 'a' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2578 | 0 | ▶ | sub _PathOneInPropertyClass_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PathOneInPropertyClass_test: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2579 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2580 | 0 | ▶ | return 1 if $self->_IRIref_test; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2581 | 0 | ▶ | return 1 if ($self->_test(qr/a[|)\n\t\r <]/)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2582 | 0 | ▶ | return 1 if ($self->_test(qr/\^/)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2583 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2584 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2586 | 0 | ▶ | sub _PathOneInPropertyClass { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PathOneInPropertyClass: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2587 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2588 | 0 | my $rev = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2589 | 0 | ▶ | if ($self->_test(qr/\^/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2590 | 0 | $self->_eat(qr/\^/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2591 | 0 | $rev = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2592 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2593 | 0 | ▶ | if ($self->_test(qr/a[|)\n\t\r <]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2594 | 0 | $self->_eat(qr/a/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2595 | 0 | my $type = RDF::Query::Node::Resource->new( $rdf->type->uri_value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2596 | 0 | ▶ | if ($rev) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2597 | 0 | $self->_add_stack( [ 'PATH', '^', $type ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2598 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2599 | 0 | $self->_add_stack( $type ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2600 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2601 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2602 | 0 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2603 | 0 | ▶ | if ($rev) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2604 | 0 | my ($path) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2605 | 0 | $self->_add_stack( [ 'PATH', '^', $path ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2606 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2607 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2608 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2609 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2610 | ################################################################################ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2611 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2612 | # [38] TriplesNode ::= Collection | BlankNodePropertyList | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2613 | 363 | ▶ | sub _TriplesNode_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_TriplesNode_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2614 | 363 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2615 | 363 | return $self->_test(qr/[[(](?![\n\r\t ]*\])(?![\n\r\t ]*\))/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2616 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2618 | 13 | ▶ | sub _TriplesNode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_TriplesNode: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2619 | 13 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2620 | 13 | ▶ | if ($self->_test(qr/\(/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2621 | 0 | $self->_Collection; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2622 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2623 | 13 | $self->_BlankNodePropertyList; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2624 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2625 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2626 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2627 | # [39] BlankNodePropertyList ::= '[' PropertyListNotEmpty ']' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2628 | 13 | ▶ | sub _BlankNodePropertyList { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_BlankNodePropertyList: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2629 | 13 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2630 | 13 | ▶ | if (my $where = $self->{__no_bnodes}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2631 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Blank nodes not allowed in $where"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2632 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2633 | 13 | $self->_eat('['); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2634 | 13 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2635 | # $self->_PropertyListNotEmpty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2636 | 13 | $self->_PropertyListNotEmptyPath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2637 | 13 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2638 | 13 | $self->_eat(']'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2639 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2640 | 13 | my @props = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2641 | 13 | my $subj = $self->new_blank; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2642 | 13 | my @triples = map { $self->__new_statement( $subj, @$_ ) } @props; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2643 | 13 | $self->_add_patterns( @triples ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2644 | 13 | $self->_add_stack( $subj ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2645 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2647 | # [40] Collection ::= '(' GraphNode+ ')' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2648 | 0 | ▶ | sub _Collection { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Collection: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2649 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2650 | 0 | $self->_eat('('); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2651 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2652 | 0 | $self->_GraphNode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2653 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2655 | 0 | my @nodes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2656 | 0 | push(@nodes, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2657 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2658 | 0 | ▶ | while ($self->_GraphNode_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2659 | 0 | $self->_GraphNode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2660 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2661 | 0 | push(@nodes, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2662 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2663 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2664 | 0 | $self->_eat(')'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2665 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2666 | 0 | my $subj = $self->new_blank; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2667 | 0 | my $cur = $subj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2668 | 0 | my $last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2669 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2670 | 0 | my $first = RDF::Query::Node::Resource->new( $rdf->first->uri_value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2671 | 0 | my $rest = RDF::Query::Node::Resource->new( $rdf->rest->uri_value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2672 | 0 | my $nil = RDF::Query::Node::Resource->new( $rdf->nil->uri_value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2674 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2675 | 0 | my @triples; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2676 | 0 | foreach my $node (@nodes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2677 | 0 | push(@triples, $self->__new_statement( $cur, $first, $node ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2678 | 0 | my $new = $self->new_blank; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2679 | 0 | push(@triples, $self->__new_statement( $cur, $rest, $new ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2680 | 0 | $last = $cur; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2681 | 0 | $cur = $new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2682 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2683 | 0 | pop(@triples); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2684 | 0 | push(@triples, $self->__new_statement( $last, $rest, $nil )); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2685 | 0 | $self->_add_patterns( @triples ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2686 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2687 | 0 | $self->_add_stack( $subj ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2688 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2689 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2690 | # [41] GraphNode ::= VarOrTerm | TriplesNode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2691 | 0 | ▶ | sub _GraphNode_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_GraphNode_test: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2692 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2693 | # VarOrTerm | TriplesNode -> (Var | GraphTerm) | (Collection | BlankNodePropertyList) -> Var | IRIref | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL | Collection | BlankNodePropertyList | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2694 | # but since a triple can't start with a literal, this is reduced to: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2695 | # Var | IRIref | BlankNode | NIL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2696 | 0 | return $self->_test(qr/[\$?]|<|['"]|(true\b|false\b)|([+-]?\d)|_:|${r_ANON}|${r_NIL}|\[|[[(]/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2697 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2698 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2699 | 210 | ▶ | sub _GraphNode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_GraphNode: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2700 | 210 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2701 | 210 | ▶ | if ($self->_TriplesNode_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2702 | 4 | $self->_TriplesNode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2703 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2704 | 206 | $self->_VarOrTerm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2705 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2706 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2708 | # [42] VarOrTerm ::= Var | GraphTerm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2709 | 0 | ▶ | sub _VarOrTerm_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_VarOrTerm_test: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2710 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2711 | 0 | ▶ | return 1 if ($self->_test(qr/[\$?]/)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2712 | 0 | ▶ | return 1 if ($self->_IRIref_test); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2713 | 0 | ▶ | return 1 if ($self->_test(qr/[<'".0-9]|(true|false)\b|_:|\([\n\r\t ]*\)/)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2714 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2715 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2716 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2717 | 350 | ▶ | sub _VarOrTerm { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_VarOrTerm: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2718 | 350 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2719 | 350 | ▶ | if ($self->{tokens} =~ m'^[?$]') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2720 | 229 | $self->_Var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2721 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2722 | 121 | $self->_GraphTerm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2723 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2724 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2725 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2726 | # [43] VarOrIRIref ::= Var | IRIref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2727 | 2 | ▶ | sub _VarOrIRIref_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_VarOrIRIref_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2728 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2729 | 2 | return $self->_test(qr/[\$?]|<|${r_PNAME_LN}|${r_PNAME_NS}/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2732 | 19 | ▶ | sub _VarOrIRIref { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_VarOrIRIref: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2733 | 19 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2734 | 19 | ▶ | if ($self->{tokens} =~ m'^[?$]') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2735 | 8 | $self->_Var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2736 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2737 | 11 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2738 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2739 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2740 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2741 | # [44] Var ::= VAR1 | VAR2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2742 | 395 | ▶ | sub _Var { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Var: called CC=3 SCAR=12.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2743 | 395 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2744 | 395 | ▶ | if ($self->{__data_pattern}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2745 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Variable found where Term expected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2746 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2748 | 395 | ▶ | my $var = ($self->_test( $r_VAR1 )) ? $self->_eat( $r_VAR1 ) : $self->_eat( $r_VAR2 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2749 | 395 | $self->_add_stack( RDF::Query::Node::Variable->new( substr($var,1) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2750 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2752 | # [45] GraphTerm ::= IRIref | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2753 | 126 | ▶ | sub _GraphTerm { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_GraphTerm: called CC=7 SCAR=19.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2754 | 126 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2755 | 126 | ▶ | if ($self->_test(qr/(true|false)\b/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2756 | 0 | $self->_BooleanLiteral; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2757 | } elsif ($self->_test('(')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2758 | 0 | $self->_NIL; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2759 | ▶ | } elsif ($self->_test( $r_ANON ) or $self->_test('_:')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$self->_test($RDF::Query::Parser::SPARQL11::r_ANON) or $self->_test("_:")
MC/DC100%2/2
$self->_test($RDF::Query::Parser::SPARQL11::r_ANON) or $self->_test("_:")
$self->_test($RDF::Query::Parser::SPARQL11::r_ANON)
$self->_test("_:")
Truth table100%3/3
A or B
A= $self->_test($RDF::Query::Parser::SPARQL11::r_ANON)B= $self->_test("_:")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2760 | 10 | $self->_BlankNode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2761 | } elsif ($self->_test(qr/[-+]?\d/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2762 | 3 | $self->_NumericLiteral; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2763 | } elsif ($self->_test(qr/['"]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2764 | 33 | $self->_RDFLiteral; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2765 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2766 | 80 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2767 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2768 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2769 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2770 | # [46] Expression ::= ConditionalOrExpression | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2771 | 120 | ▶ | sub _Expression { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Expression: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2772 | 120 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2773 | 120 | $self->_ConditionalOrExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2774 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2775 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2776 | # [47] ConditionalOrExpression ::= ConditionalAndExpression ( '||' ConditionalAndExpression )* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2777 | 120 | ▶ | sub _ConditionalOrExpression { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ConditionalOrExpression: called CC=4 SCAR=16.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2778 | 120 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2779 | 120 | my @list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2780 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2781 | 120 | $self->_ConditionalAndExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2782 | 120 | push(@list, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2783 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2784 | 120 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2785 | 120 | ▶ | while ($self->_test('||')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2786 | 0 | $self->_eat('||'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2787 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2788 | 0 | $self->_ConditionalAndExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2789 | 0 | push(@list, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2791 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2792 | 120 | ▶ | if (scalar(@list) > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2793 | 0 | $self->_add_stack( $self->new_function_expression( 'sparql:logical-or', @list ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2794 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2795 | 120 | $self->_add_stack( @list ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2796 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2797 | 120 | ▶ | Carp::confess $self->{tokens} if (scalar(@{ $self->{stack} }) == 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2798 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2799 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2800 | # [48] ConditionalAndExpression ::= ValueLogical ( '&&' ValueLogical )* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2801 | 120 | ▶ | sub _ConditionalAndExpression { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ConditionalAndExpression: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2802 | 120 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2803 | 120 | $self->_ValueLogical; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2804 | 120 | my @list = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2806 | 120 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2807 | 120 | ▶ | while ($self->_test('&&')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2808 | 2 | $self->_eat('&&'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2809 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2810 | 2 | $self->_ValueLogical; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2811 | 2 | push(@list, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2812 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2813 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2814 | 120 | ▶ | if (scalar(@list) > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2815 | 2 | $self->_add_stack( $self->new_function_expression( 'sparql:logical-and', @list ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2816 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2817 | 118 | $self->_add_stack( @list ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2818 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2819 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2820 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2821 | # [49] ValueLogical ::= RelationalExpression | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2822 | 122 | ▶ | sub _ValueLogical { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ValueLogical: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2823 | 122 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2824 | 122 | $self->_RelationalExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2825 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2827 | # [50] RelationalExpression ::= NumericExpression ( '=' NumericExpression | '!=' NumericExpression | '<' NumericExpression | '>' NumericExpression | '<=' NumericExpression | '>=' NumericExpression )? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2828 | 122 | ▶ | sub _RelationalExpression { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_RelationalExpression: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2829 | 122 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2830 | 122 | $self->_NumericExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2831 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2832 | 122 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2833 | 122 | ▶ | if ($self->_test(qr/[!<>]?=|[<>]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2834 | 13 | ▶ | if ($self->_test( $r_IRI_REF )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2835 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: IRI found where expression expected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2836 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2837 | 13 | my @list = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2838 | 13 | my $op = $self->_eat(qr/[!<>]?=|[<>]/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2839 | 13 | ▶ | $op = '==' if ($op eq '='); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2840 | 13 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2841 | 13 | $self->_NumericExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2842 | 13 | push(@list, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2843 | 13 | $self->_add_stack( $self->new_binary_expression( $op, @list ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2844 | } elsif ($self->_test(qr/(NOT )?IN/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2845 | 4 | my @list = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2846 | 4 | my $op = lc($self->_eat(qr/(NOT )?IN/i)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2847 | 4 | $op =~ s/\s+//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2848 | 4 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2849 | 4 | $self->_ExpressionList(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2850 | 4 | push(@list, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2851 | 4 | $self->_add_stack( $self->new_function_expression( "sparql:$op", @list ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2852 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2853 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2854 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2855 | 4 | ▶ | sub _ExpressionList { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ExpressionList: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2856 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2857 | 4 | $self->_eat('('); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2858 | 4 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2859 | 4 | my @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2860 | 4 | ▶ | unless ($self->_test(')')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2861 | 3 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2862 | 3 | push( @args, splice(@{ $self->{stack} }) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2863 | 3 | ▶ | while ($self->_test(',')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2864 | 4 | $self->_eat(','); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2865 | 4 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2866 | 4 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2867 | 4 | push( @args, splice(@{ $self->{stack} }) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2868 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2869 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2870 | 4 | $self->_eat(')'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2871 | 4 | $self->_add_stack( @args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2872 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2873 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2874 | # [51] NumericExpression ::= AdditiveExpression | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2875 | 135 | ▶ | sub _NumericExpression { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_NumericExpression: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2876 | 135 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2877 | 135 | $self->_AdditiveExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2878 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2880 | # [52] AdditiveExpression ::= MultiplicativeExpression ( '+' MultiplicativeExpression | '-' MultiplicativeExpression | NumericLiteralPositive | NumericLiteralNegative )* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2881 | 135 | ▶ | sub _AdditiveExpression { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_AdditiveExpression: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2882 | 135 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2883 | 135 | $self->_MultiplicativeExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2884 | 135 | my ($expr) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2885 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2886 | 135 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2887 | 135 | ▶ | while ($self->_test(qr/[-+]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2888 | 1 | my $op = $self->_eat(qr/[-+]/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2889 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2890 | 1 | $self->_MultiplicativeExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2891 | 1 | my ($rhs) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2892 | 1 | $expr = $self->new_binary_expression( $op, $expr, $rhs ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2893 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2894 | 135 | $self->_add_stack( $expr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2895 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2896 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2897 | # [53] MultiplicativeExpression ::= UnaryExpression ( '*' UnaryExpression | '/' UnaryExpression )* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2898 | 136 | ▶ | sub _MultiplicativeExpression { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_MultiplicativeExpression: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2899 | 136 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2900 | 136 | $self->_UnaryExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2901 | 136 | my ($expr) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2902 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2903 | 136 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2904 | 136 | ▶ | while ($self->_test(qr#[*/]#)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2905 | 1 | my $op = $self->_eat(qr#[*/]#); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2906 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2907 | 1 | $self->_UnaryExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2908 | 1 | my ($rhs) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2909 | 1 | $expr = $self->new_binary_expression( $op, $expr, $rhs ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2910 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2911 | 136 | $self->_add_stack( $expr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2912 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2913 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2914 | # [54] UnaryExpression ::= '!' PrimaryExpression | '+' PrimaryExpression | '-' PrimaryExpression | PrimaryExpression | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2915 | 137 | ▶ | sub _UnaryExpression { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_UnaryExpression: called CC=10 SCAR=31.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2916 | 137 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2917 | 137 | ▶ | if ($self->_test('!')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2918 | 3 | $self->_eat('!'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2919 | 3 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2920 | 3 | $self->_PrimaryExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2921 | 3 | my ($expr) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2922 | 3 | my $not = $self->new_unary_expression( '!', $expr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2923 | 3 | $self->_add_stack( $not ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2924 | } elsif ($self->_test('+')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2925 | 0 | $self->_eat('+'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2926 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2927 | 0 | $self->_PrimaryExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2928 | 0 | my ($expr) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2929 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2930 | ### if it's just a literal, force the positive down into the literal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2931 | 0 | ▶ | if (blessed($expr) and $expr->isa('RDF::Trine::Node::Literal') and $expr->is_numeric_type) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
builtin::blessed($expr) and $expr->isa("RDF::Trine::Node::Literal") and $expr->is_numeric_type
builtin::blessed($expr) and $expr->isa("RDF::Trine::Node::Literal")
MC/DC0%0/3
builtin::blessed($expr) and $expr->isa("RDF::Trine::Node::Literal") and $expr->is_numeric_type
builtin::blessed($expr)
$expr->isa("RDF::Trine::Node::Literal")
$expr->is_numeric_type
Truth table0%0/4
A and B and C
A= builtin::blessed($expr)B= $expr->isa("RDF::Trine::Node::Literal")C= $expr->is_numeric_type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2932 | 0 | my $value = '+' . $expr->literal_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2933 | 0 | $expr->literal_value( $value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2934 | 0 | $self->_add_stack( $expr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2935 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2936 | 0 | $self->_add_stack( $expr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2937 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2938 | } elsif ($self->_test('-')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2939 | 2 | $self->_eat('-'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2940 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2941 | 2 | $self->_PrimaryExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2942 | 2 | my ($expr) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2943 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2944 | ### if it's just a literal, force the negative down into the literal instead of make an unnecessary multiplication. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2945 | 2 | ▶ | if (blessed($expr) and $expr->isa('RDF::Trine::Node::Literal') and $expr->is_numeric_type) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
builtin::blessed($expr) and $expr->isa("RDF::Trine::Node::Literal") and $expr->is_numeric_type
builtin::blessed($expr) and $expr->isa("RDF::Trine::Node::Literal")
MC/DC0%0/3
builtin::blessed($expr) and $expr->isa("RDF::Trine::Node::Literal") and $expr->is_numeric_type
builtin::blessed($expr)
$expr->isa("RDF::Trine::Node::Literal")
$expr->is_numeric_type
Truth table25%1/4
A and B and C
A= builtin::blessed($expr)B= $expr->isa("RDF::Trine::Node::Literal")C= $expr->is_numeric_type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2946 | 2 | my $value = -1 * $expr->literal_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2947 | 2 | $expr->literal_value( $value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2948 | 2 | $self->_add_stack( $expr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2949 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2950 | 0 | my $int = $xsd->integer->uri_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2951 | 0 | my $neg = $self->new_binary_expression( '*', $self->new_literal('-1', undef, $int), $expr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2952 | 0 | $self->_add_stack( $neg ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2953 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2954 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2955 | 132 | $self->_PrimaryExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2956 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2957 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2958 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2959 | # [55] PrimaryExpression ::= BrackettedExpression | BuiltInCall | IRIrefOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2960 | 137 | ▶ | sub _PrimaryExpression { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PrimaryExpression: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2961 | 137 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2962 | 137 | ▶ | if ($self->_BrackettedExpression_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2963 | 2 | $self->_BrackettedExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2964 | } elsif ($self->_BuiltInCall_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2965 | 37 | $self->_BuiltInCall; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2966 | } elsif ($self->_IRIref_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2967 | 11 | $self->_IRIrefOrFunction; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2968 | } elsif ($self->_test(qr/[\$?]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2969 | 49 | $self->_Var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2970 | } elsif ($self->_test(qr/(true|false)\b/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2971 | 0 | $self->_BooleanLiteral; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2972 | } elsif ($self->_test(qr/[-+]?\d/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2973 | 26 | $self->_NumericLiteral; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2974 | } else { # if ($self->_test(qr/['"]/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2975 | 12 | $self->_RDFLiteral; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2976 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2977 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2978 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2979 | # [56] BrackettedExpression ::= '(' Expression ')' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2980 | 161 | ▶ | sub _BrackettedExpression_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_BrackettedExpression_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2981 | 161 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2982 | 161 | return $self->_test('('); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2983 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2985 | 29 | ▶ | sub _BrackettedExpression { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_BrackettedExpression: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2986 | 29 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2987 | 29 | $self->_eat('('); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2988 | 29 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2989 | 29 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2990 | 29 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2991 | 29 | $self->_eat(')'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2992 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2993 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2994 | 21 | ▶ | sub _Aggregate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Aggregate: called CC=11 SCAR=28.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2995 | 21 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2996 | 21 | my $op = uc( $self->_eat( $r_AGGREGATE_CALL ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2997 | 21 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2998 | 21 | $self->_eat('('); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2999 | 21 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3000 | 21 | my $distinct = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3001 | 21 | ▶ | if ($self->_test( qr/DISTINCT/i )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3002 | 1 | $self->_eat( qr/DISTINCT\s*/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3003 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3004 | 1 | $distinct = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3005 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3006 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3007 | 21 | my (@expr, %options); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3008 | 21 | ▶ | if ($self->_test('*')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3009 | 0 | @expr = $self->_eat('*'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3010 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3011 | 21 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3012 | 21 | push(@expr, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3013 | 21 | ▶ | if ($op eq 'GROUP_CONCAT') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3014 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3015 | 1 | ▶ | while ($self->_test(qr/,/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3016 | 0 | $self->_eat(qr/,/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3017 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3018 | 0 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3019 | 0 | push(@expr, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3020 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3021 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3022 | 1 | ▶ | if ($self->_test(qr/;/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3023 | 0 | $self->_eat(qr/;/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3024 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3025 | 0 | ▶ | if ($self->{args}{allow_typos}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3026 | 0 | $self->_eat(qr/SEP[AE]RATOR/i); # accept common typo | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3027 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3028 | 0 | $self->_eat(qr/SEPARATOR/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3029 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3030 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3031 | 0 | $self->_eat(qr/=/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3032 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3033 | 0 | $self->_String; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3034 | 0 | my ($sep) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3035 | 0 | $options{ seperator } = $sep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3036 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3037 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3038 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3039 | 21 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3040 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3041 | 21 | ▶ | my $arg = join(',', map { blessed($_) ? $_->as_sparql : $_ } @expr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3042 | 21 | ▶ | if ($distinct) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3043 | 1 | $arg = 'DISTINCT ' . $arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3044 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3045 | 21 | my $name = sprintf('%s(%s)', $op, $arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3046 | 21 | $self->_eat(')'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3047 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3048 | 21 | ▶ | $self->{build}{__aggregate}{ $name } = [ (($distinct) ? "${op}-DISTINCT" : $op), \%options, @expr ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3049 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3050 | 21 | ▶ | my @vars = grep { blessed($_) and $_->isa('RDF::Query::Node::Variable') } @expr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
builtin::blessed($_) && $_->isa('RDF::Query::Node::Variable')
MC/DC0%0/2
builtin::blessed($_) && $_->isa('RDF::Query::Node::Variable')
builtin::blessed($_)
$_->isa('RDF::Query::Node::Variable')
Truth table33%1/3
A && B
A= builtin::blessed($_)B= $_->isa('RDF::Query::Node::Variable')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3051 | 21 | $self->_add_stack( RDF::Query::Node::Variable::ExpressionProxy->new($name, @vars) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3052 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3053 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3054 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3055 | # [57] BuiltInCall ::= 'STR' '(' Expression ')' | 'LANG' '(' Expression ')' | 'LANGMATCHES' '(' Expression ',' Expression ')' | 'DATATYPE' '(' Expression ')' | 'BOUND' '(' Var ')' | 'sameTerm' '(' Expression ',' Expression ')' | 'isIRI' '(' Expression ')' | 'isURI' '(' Expression ')' | 'isBLANK' '(' Expression ')' | 'isLITERAL' '(' Expression ')' | RegexExpression | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3056 | 160 | ▶ | sub _BuiltInCall_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_BuiltInCall_test: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3057 | 160 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3058 | 160 | ▶ | if ($self->{__aggregate_call_ok}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3059 | 86 | ▶ | return 1 if ($self->_test( $r_AGGREGATE_CALL )); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3060 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3061 | 139 | ▶ | return 1 if $self->_test(qr/((NOT\s+)?EXISTS)|COALESCE/i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3062 | 136 | ▶ | return 1 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); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3063 | 136 | return $self->_test(qr/UUID|STRUUID|STR|STRDT|STRLANG|STRBEFORE|STRAFTER|REPLACE|BNODE|IRI|URI|LANG|LANGMATCHES|DATATYPE|BOUND|sameTerm|isIRI|isURI|isBLANK|isLITERAL|REGEX|IF|isNumeric/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3064 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3065 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3066 | 37 | ▶ | sub _BuiltInCall { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_BuiltInCall: called CC=11 SCAR=25.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3067 | 37 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3068 | 37 | ▶ | if ($self->{__aggregate_call_ok} and $self->_test( $r_AGGREGATE_CALL )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition100%3/3
$self->{"__aggregate_call_ok"} and $self->_test($RDF::Query::Parser::SPARQL11::r_AGGREGATE_CALL)
MC/DC100%2/2
$self->{"__aggregate_call_ok"} and $self->_test($RDF::Query::Parser::SPARQL11::r_AGGREGATE_CALL)
$self->{"__aggregate_call_ok"}
$self->_test($RDF::Query::Parser::SPARQL11::r_AGGREGATE_CALL)
Truth table100%3/3
A and B
A= $self->{"__aggregate_call_ok"}B= $self->_test($RDF::Query::Parser::SPARQL11::r_AGGREGATE_CALL)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3069 | 21 | $self->_Aggregate; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3070 | } elsif ($self->_test(qr/(NOT\s+)?EXISTS/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3071 | 1 | my $op = $self->_eat(qr/(NOT\s+)?EXISTS/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3072 | 1 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3073 | 1 | local($self->{filters}) = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3074 | 1 | $self->_GroupGraphPattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3075 | 1 | my $cont = $self->_remove_pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3076 | 1 | my $iri = RDF::Query::Node::Resource->new( 'sparql:exists' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3077 | 1 | my $func = $self->new_function_expression($iri, $cont); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3078 | 1 | ▶ | if ($op =~ /^NOT/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3079 | 1 | $self->_add_stack( $self->new_unary_expression( '!', $func ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3080 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3081 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3082 | 0 | $self->_add_stack( $func ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3083 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3084 | } elsif ($self->_test(qr/COALESCE|BNODE|CONCAT|SUBSTR|RAND|NOW/i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3085 | # n-arg functions that take expressions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3086 | 5 | my $op = $self->_eat(qr/COALESCE|BNODE|CONCAT|SUBSTR|RAND|NOW/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3087 | 5 | my $iri = RDF::Query::Node::Resource->new( 'sparql:' . lc($op) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3088 | 5 | $self->_ArgList; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3089 | 5 | my @args = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3090 | 5 | my $func = $self->new_function_expression( $iri, @args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3091 | 5 | $self->_add_stack( $func ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3092 | } elsif ($self->_RegexExpression_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3093 | 2 | $self->_RegexExpression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3094 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3095 | 8 | my $op = $self->_eat( qr/\w+/ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3096 | 8 | my $iri = RDF::Query::Node::Resource->new( 'sparql:' . lc($op) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3097 | 8 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3098 | 8 | $self->_eat('('); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3099 | 8 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3100 | 8 | ▶ | if ($op =~ /^(STR)?UUID$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3101 | # no-arg functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3102 | 0 | $self->_add_stack( $self->new_function_expression($iri) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3103 | } 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) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3104 | ### one-arg functions that take an expression | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3105 | 3 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3106 | 3 | my ($expr) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3107 | 3 | $self->_add_stack( $self->new_function_expression($iri, $expr) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3108 | } elsif ($op =~ /^(STRDT|STRLANG|LANGMATCHES|sameTerm|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER)$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3109 | ### two-arg functions that take expressions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3110 | 2 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3111 | 2 | my ($arg1) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3112 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3113 | 2 | $self->_eat(','); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3114 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3115 | 2 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3116 | 2 | my ($arg2) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3117 | 2 | $self->_add_stack( $self->new_function_expression($iri, $arg1, $arg2) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3118 | } elsif ($op =~ /^(IF|REPLACE)$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3119 | ### three-arg functions that take expressions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3120 | 0 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3121 | 0 | my ($arg1) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3122 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3123 | 0 | $self->_eat(','); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3124 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3125 | 0 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3126 | 0 | my ($arg2) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3127 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3128 | 0 | $self->_eat(','); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3129 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3130 | 0 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3131 | 0 | my ($arg3) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3132 | 0 | $self->_add_stack( $self->new_function_expression($iri, $arg1, $arg2, $arg3) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3133 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3134 | ### BOUND(Var) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3135 | 3 | $self->_Var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3136 | 3 | my ($expr) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3137 | 3 | $self->_add_stack( $self->new_function_expression($iri, $expr) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3139 | 8 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3140 | 8 | $self->_eat(')'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3144 | # [58] RegexExpression ::= 'REGEX' '(' Expression ',' Expression ( ',' Expression )? ')' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3145 | 10 | ▶ | sub _RegexExpression_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_RegexExpression_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3146 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3147 | 10 | return $self->_test( qr/REGEX/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3150 | 2 | ▶ | sub _RegexExpression { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_RegexExpression: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3151 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3152 | 2 | $self->_eat( qr/REGEX/i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3153 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3154 | 2 | $self->_eat('('); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3155 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3156 | 2 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3157 | 2 | my $string = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3159 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3160 | 2 | $self->_eat(','); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3161 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3162 | 2 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3163 | 2 | my $pattern = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3165 | 2 | my @args = ($string, $pattern); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3166 | 2 | ▶ | if ($self->_test(',')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3167 | 0 | $self->_eat(','); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3168 | 0 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3169 | 0 | $self->_Expression; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3170 | 0 | push(@args, splice(@{ $self->{stack} })); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3173 | 2 | $self->__consume_ws_opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3174 | 2 | $self->_eat(')'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3176 | 2 | my $iri = RDF::Query::Node::Resource->new( 'sparql:regex' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3177 | 2 | $self->_add_stack( $self->new_function_expression( $iri, @args ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3180 | # [59] IRIrefOrFunction ::= IRIref ArgList? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3181 | 0 | ▶ | sub _IRIrefOrFunction_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_IRIrefOrFunction_test: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3182 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3183 | 0 | $self->_IRIref_test; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3186 | 11 | ▶ | sub _IRIrefOrFunction { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_IRIrefOrFunction: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3187 | 11 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3188 | 11 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3189 | 11 | ▶ | if ($self->_ArgList_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3190 | 10 | my ($iri) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3191 | 10 | $self->_ArgList; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3192 | 10 | my @args = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3193 | 10 | my $func = $self->new_function_expression( $iri, @args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3194 | 10 | $self->_add_stack( $func ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3198 | # [60] RDFLiteral ::= String ( LANGTAG | ( '^^' IRIref ) )? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3199 | 45 | ▶ | sub _RDFLiteral { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_RDFLiteral: called CC=6 SCAR=25.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3200 | 45 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3201 | 45 | $self->_String; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3202 | 45 | my @args = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3203 | 45 | ▶ | if ($self->_test('@')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3204 | 0 | my $lang = $self->_eat( $r_LANGTAG ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3205 | 0 | substr($lang,0,1) = ''; # remove '@' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3206 | 0 | push(@args, lc($lang)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3207 | } elsif ($self->_test('^^')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3208 | 0 | $self->_eat('^^'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3209 | 0 | push(@args, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3210 | 0 | $self->_IRIref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3211 | 0 | my ($iri) = splice(@{ $self->{stack} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3212 | 0 | push(@args, $iri->uri_value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3215 | 45 | my $obj = RDF::Query::Node::Literal->new( @args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3216 | 45 | ▶ | if ($self->{args}{canonicalize} and blessed($obj) and $obj->isa('RDF::Trine::Node::Literal')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$self->{"args"}{"canonicalize"} and builtin::blessed($obj) and $obj->isa("RDF::Trine::Node::Literal")
$self->{"args"}{"canonicalize"} and builtin::blessed($obj)
MC/DC0%0/3
$self->{"args"}{"canonicalize"} and builtin::blessed($obj) and $obj->isa("RDF::Trine::Node::Literal")
$self->{"args"}{"canonicalize"}
builtin::blessed($obj)
$obj->isa("RDF::Trine::Node::Literal")
Truth table25%1/4
A and B and C
A= $self->{"args"}{"canonicalize"}B= builtin::blessed($obj)C= $obj->isa("RDF::Trine::Node::Literal")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3217 | 0 | $obj = $obj->canonicalize; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3220 | 45 | $self->_add_stack( $obj ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3223 | # [61] NumericLiteral ::= NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3224 | # [62] NumericLiteralUnsigned ::= INTEGER | DECIMAL | DOUBLE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3225 | # [63] NumericLiteralPositive ::= INTEGER_POSITIVE | DECIMAL_POSITIVE | DOUBLE_POSITIVE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3226 | # [64] NumericLiteralNegative ::= INTEGER_NEGATIVE | DECIMAL_NEGATIVE | DOUBLE_NEGATIVE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3227 | 29 | ▶ | sub _NumericLiteral { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_NumericLiteral: called CC=9 SCAR=27.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3228 | 29 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3229 | 29 | my $sign = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3230 | 29 | ▶ | if ($self->_test('+')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3231 | 0 | $self->_eat('+'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3232 | 0 | $sign = '+'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3233 | } elsif ($self->_test('-')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3234 | 0 | $self->_eat('-'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3235 | 0 | $sign = '-'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3238 | 29 | my $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3239 | my $type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3240 | 29 | ▶ | if ($self->_test( $r_DOUBLE )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3241 | 0 | $value = $self->_eat( $r_DOUBLE ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3242 | 0 | my $double = RDF::Query::Node::Resource->new( $xsd->double->uri_value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3243 | 0 | $type = $double | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3244 | } elsif ($self->_test( $r_DECIMAL )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3245 | 8 | $value = $self->_eat( $r_DECIMAL ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3246 | 8 | my $decimal = RDF::Query::Node::Resource->new( $xsd->decimal->uri_value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3247 | 8 | $type = $decimal; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3248 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3249 | 21 | $value = $self->_eat( $r_INTEGER ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3250 | 21 | my $integer = RDF::Query::Node::Resource->new( $xsd->integer->uri_value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3251 | 21 | $type = $integer; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3254 | 29 | ▶ | if ($sign) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3255 | 0 | $value = $sign . $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3258 | 29 | my $obj = RDF::Query::Node::Literal->new( $value, undef, $type->uri_value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3259 | 29 | ▶ | if ($self->{args}{canonicalize} and blessed($obj) and $obj->isa('RDF::Trine::Node::Literal')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$self->{"args"}{"canonicalize"} and builtin::blessed($obj) and $obj->isa("RDF::Trine::Node::Literal")
$self->{"args"}{"canonicalize"} and builtin::blessed($obj)
MC/DC0%0/3
$self->{"args"}{"canonicalize"} and builtin::blessed($obj) and $obj->isa("RDF::Trine::Node::Literal")
$self->{"args"}{"canonicalize"}
builtin::blessed($obj)
$obj->isa("RDF::Trine::Node::Literal")
Truth table25%1/4
A and B and C
A= $self->{"args"}{"canonicalize"}B= builtin::blessed($obj)C= $obj->isa("RDF::Trine::Node::Literal")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3260 | 0 | $obj = $obj->canonicalize; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3262 | 29 | $self->_add_stack( $obj ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3265 | # [65] BooleanLiteral ::= 'true' | 'false' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3266 | 0 | ▶ | sub _BooleanLiteral { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_BooleanLiteral: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3267 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3268 | 0 | my $bool = $self->_eat(qr/(true|false)\b/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3270 | 0 | my $obj = RDF::Query::Node::Literal->new( $bool, undef, $xsd->boolean->uri_value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3271 | 0 | ▶ | if ($self->{args}{canonicalize} and blessed($obj) and $obj->isa('RDF::Trine::Node::Literal')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->{"args"}{"canonicalize"} and builtin::blessed($obj) and $obj->isa("RDF::Trine::Node::Literal")
$self->{"args"}{"canonicalize"} and builtin::blessed($obj)
MC/DC0%0/3
$self->{"args"}{"canonicalize"} and builtin::blessed($obj) and $obj->isa("RDF::Trine::Node::Literal")
$self->{"args"}{"canonicalize"}
builtin::blessed($obj)
$obj->isa("RDF::Trine::Node::Literal")
Truth table0%0/4
A and B and C
A= $self->{"args"}{"canonicalize"}B= builtin::blessed($obj)C= $obj->isa("RDF::Trine::Node::Literal")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3272 | 0 | $obj = $obj->canonicalize; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3273 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3274 | 0 | $self->_add_stack( $obj ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3277 | # [66] String ::= STRING_LITERAL1 | STRING_LITERAL2 | STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3278 | 45 | ▶ | sub _String { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_String: called CC=4 SCAR=14.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3279 | 45 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3280 | 45 | my $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3281 | 45 | ▶ | if ($self->_test( $r_STRING_LITERAL_LONG1 )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3282 | 0 | my $string = $self->_eat( $r_STRING_LITERAL_LONG1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3283 | 0 | $value = substr($string, 3, length($string) - 6); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3284 | } elsif ($self->_test( $r_STRING_LITERAL_LONG2 )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3285 | 0 | my $string = $self->_eat( $r_STRING_LITERAL_LONG2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3286 | 0 | $value = substr($string, 3, length($string) - 6); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3287 | } elsif ($self->_test( $r_STRING_LITERAL1 )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3288 | 7 | my $string = $self->_eat( $r_STRING_LITERAL1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3289 | 7 | $value = substr($string, 1, length($string) - 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3290 | } else { # ($self->_test( $r_STRING_LITERAL2 )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3291 | 38 | my $string = $self->_eat( $r_STRING_LITERAL2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3292 | 38 | $value = substr($string, 1, length($string) - 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3294 | # $value =~ s/(${r_ECHAR})/"$1"/ge; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3295 | 45 | $value =~ s/\\t/\t/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3296 | 45 | $value =~ s/\\b/\n/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3297 | 45 | $value =~ s/\\n/\n/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3298 | 45 | $value =~ s/\\r/\x08/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3299 | 45 | $value =~ s/\\"/"/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3300 | 45 | $value =~ s/\\'/'/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3301 | 45 | $value =~ s/\\\\/\\/g; # backslash must come last, so it doesn't accidentally create a new escape | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3302 | 45 | $self->_add_stack( $value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3305 | # [67] IRIref ::= IRI_REF | PrefixedName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3306 | 592 | ▶ | sub _IRIref_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_IRIref_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3307 | 592 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3308 | 592 | return $self->_test(qr/<|${r_PNAME_LN}|${r_PNAME_NS}/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3311 | 273 | ▶ | sub _IRIref { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_IRIref: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3312 | 273 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3313 | 273 | ▶ | if ($self->_test( $r_IRI_REF )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3314 | 63 | my $iri = $self->_eat( $r_IRI_REF ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3315 | 63 | my $node = RDF::Query::Node::Resource->new( substr($iri,1,length($iri)-2), $self->__base ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3316 | 63 | $self->_add_stack( $node ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3317 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3318 | 210 | $self->_PrefixedName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3320 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3322 | # [68] PrefixedName ::= PNAME_LN | PNAME_NS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3323 | 210 | ▶ | sub _PrefixedName { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PrefixedName: called CC=6 SCAR=24.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3324 | 210 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3325 | 210 | ▶ | if ($self->_test( $r_PNAME_LN )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3326 | 210 | my $ln = $self->_eat( $r_PNAME_LN ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3327 | 210 | my ($ns,$local) = split(/:/, $ln, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3328 | 210 | ▶ | if ($ns eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3329 | 18 | $ns = '__DEFAULT__'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3330 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3332 | 210 | $local =~ s{\\([-~.!&'()*+,;=:/?#@%_\$])}{$1}g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3334 | 210 | ▶ | unless (exists $self->{namespaces}{$ns}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3335 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Use of undefined namespace '$ns'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3336 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3338 | 210 | my $iri = $self->{namespaces}{$ns} . $local; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3339 | 210 | $self->_add_stack( RDF::Query::Node::Resource->new( $iri, $self->__base ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3340 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3341 | 0 | my $ns = $self->_eat( $r_PNAME_NS ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3342 | 0 | ▶ | if ($ns eq ':') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3343 | 0 | $ns = '__DEFAULT__'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3344 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3345 | 0 | chop($ns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3346 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3348 | 0 | ▶ | unless (exists $self->{namespaces}{$ns}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3349 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Use of undefined namespace '$ns'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3350 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3352 | 0 | my $iri = $self->{namespaces}{$ns}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3353 | 0 | $self->_add_stack( RDF::Query::Node::Resource->new( $iri, $self->__base ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3357 | # [69] BlankNode ::= BLANK_NODE_LABEL | ANON | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3358 | 10 | ▶ | sub _BlankNode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_BlankNode: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3359 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3360 | 10 | ▶ | if (my $where = $self->{__no_bnodes}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3361 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Blank nodes not allowed in $where"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3363 | 10 | ▶ | if ($self->_test( $r_BLANK_NODE_LABEL )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3364 | 5 | my $label = $self->_eat( $r_BLANK_NODE_LABEL ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3365 | 5 | my $id = substr($label,2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3366 | 5 | $self->_add_stack( $self->new_blank($id) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3367 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3368 | 5 | $self->_eat( $r_ANON ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3369 | 5 | $self->_add_stack( $self->new_blank ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3373 | 0 | ▶ | sub _NIL { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_NIL: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3374 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3375 | 0 | $self->_eat( $r_NIL ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3376 | 0 | my $nil = RDF::Query::Node::Resource->new( $rdf->nil->uri_value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3377 | 0 | $self->_add_stack( $nil ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3378 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3380 | 87 | ▶ | sub __solution_modifiers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__solution_modifiers: called CC=13 SCAR=25.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3381 | 87 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3382 | 87 | my $star = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3384 | 87 | my $having_expr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3385 | 87 | my $aggdata = delete( $self->{build}{__aggregate} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3386 | 87 | ▶ | my @aggkeys = keys %{ $aggdata || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$aggdata || {}
MC/DC100%1/1
$aggdata || {}
$aggdata
Truth table100%2/2
A
A= $aggdata
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3387 | 87 | ▶ | if (scalar(@aggkeys)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3388 | 17 | ▶ | my $groupby = delete( $self->{build}{__group_by} ) || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
delete $self->{'build'}{'__group_by'} || []
MC/DC100%1/1
delete $self->{'build'}{'__group_by'} || []
delete $self->{'build'}{'__group_by'}
Truth table100%2/2
A
A= delete $self->{'build'}{'__group_by'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3389 | 17 | my $pattern = $self->{build}{triples}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3390 | 17 | my $ggp = shift(@$pattern); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3391 | 17 | ▶ | if (my $having = delete( $self->{build}{__having} )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3392 | 3 | $having_expr = $having; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3395 | 17 | my $agg = RDF::Query::Algebra::Aggregate->new( $ggp, $groupby, { expressions => [%$aggdata] } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3396 | 17 | push(@{ $self->{build}{triples} }, $agg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3399 | 87 | my $vars = [ @{ $self->{build}{variables} } ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3401 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3402 | 87 | my @vars = grep { $_->isa('RDF::Query::Expression::Alias') } @$vars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3403 | 87 | ▶ | if (scalar(@vars)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3404 | 25 | my $pattern = pop(@{ $self->{build}{triples} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3405 | 25 | my @bound = $pattern->potentially_bound; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3406 | 25 | my %bound = map { $_ => 1 } @bound; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3407 | 25 | foreach my $v (@vars) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3408 | 29 | my $name = $v->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3409 | 29 | ▶ | if ($bound{ $name }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3410 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Already-bound variable ($name) used in project expression"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3415 | 25 | my $proj = RDF::Query::Algebra::Extend->new( $pattern, $vars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3416 | 25 | push(@{ $self->{build}{triples} }, $proj); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3420 | 87 | ▶ | if ($having_expr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3421 | 3 | my $pattern = pop(@{ $self->{build}{triples} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3422 | 3 | my $filter = RDF::Query::Algebra::Filter->new( $having_expr, $pattern ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3423 | 3 | push(@{ $self->{build}{triples} }, $filter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3424 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3425 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3426 | 87 | ▶ | if ($self->{build}{options}{orderby}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3427 | 8 | my $order = delete $self->{build}{options}{orderby}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3428 | 8 | my $pattern = pop(@{ $self->{build}{triples} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3429 | 8 | my $sort = RDF::Query::Algebra::Sort->new( $pattern, @$order ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3430 | 8 | push(@{ $self->{build}{triples} }, $sort); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3433 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3434 | 87 | my $pattern = pop(@{ $self->{build}{triples} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3435 | 87 | my $proj = RDF::Query::Algebra::Project->new( $pattern, $vars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3436 | 87 | push(@{ $self->{build}{triples} }, $proj); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3437 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3439 | 87 | ▶ | if ($self->{build}{options}{distinct}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3440 | 2 | delete $self->{build}{options}{distinct}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3441 | 2 | my $pattern = pop(@{ $self->{build}{triples} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3442 | 2 | my $sort = RDF::Query::Algebra::Distinct->new( $pattern ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3443 | 2 | push(@{ $self->{build}{triples} }, $sort); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3444 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3446 | 87 | ▶ | if (exists $self->{build}{options}{offset}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3447 | 1 | my $offset = delete $self->{build}{options}{offset}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3448 | 1 | my $pattern = pop(@{ $self->{build}{triples} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3449 | 1 | my $offseted = RDF::Query::Algebra::Offset->new( $pattern, $offset ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3450 | 1 | push(@{ $self->{build}{triples} }, $offseted); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3453 | 87 | ▶ | if (exists $self->{build}{options}{limit}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3454 | 3 | my $limit = delete $self->{build}{options}{limit}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3455 | 3 | my $pattern = pop(@{ $self->{build}{triples} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3456 | 3 | my $limited = RDF::Query::Algebra::Limit->new( $pattern, $limit ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3457 | 3 | push(@{ $self->{build}{triples} }, $limited); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3459 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3461 | ################################################################################ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3463 | =item C<< error >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3465 | Returns the error encountered during the last parse. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3467 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3469 | 0 | ▶ | sub error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3470 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3471 | 0 | return $self->{error}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3472 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3474 | 483 | ▶ | sub _add_patterns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_patterns: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3475 | 483 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3476 | 483 | my @triples = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3477 | 483 | my $container = $self->{ pattern_container_stack }[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3478 | 483 | push( @{ $container }, @triples ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3479 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3481 | 70 | ▶ | sub _remove_pattern { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_remove_pattern: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3482 | 70 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3483 | 70 | my $container = $self->{ pattern_container_stack }[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3484 | 70 | my $pattern = pop( @{ $container } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3485 | 70 | return $pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3488 | 93 | ▶ | sub _peek_pattern { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_peek_pattern: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3489 | 93 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3490 | 93 | my $container = $self->{ pattern_container_stack }[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3491 | 93 | my $pattern = $container->[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3492 | 93 | return $pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3495 | 373 | ▶ | sub _push_pattern_container { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_push_pattern_container: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3496 | 373 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3497 | 373 | my $cont = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3498 | 373 | unshift( @{ $self->{ pattern_container_stack } }, $cont ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3499 | 373 | return $cont; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3502 | 269 | ▶ | sub _pop_pattern_container { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_pop_pattern_container: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3503 | 269 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3504 | 269 | my $cont = shift( @{ $self->{ pattern_container_stack } } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3505 | 269 | return $cont; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3506 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3508 | 1892 | ▶ | sub _add_stack { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_stack: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3509 | 1892 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3510 | 1892 | my @items = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3511 | 1892 | push( @{ $self->{stack} }, @items ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3514 | 20 | ▶ | sub _add_filter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_filter: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3515 | 20 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3516 | 20 | my @filters = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3517 | 20 | push( @{ $self->{filters} }, @filters ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3518 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3519 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3520 | 5853 | ▶ | sub _eat { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_eat: called CC=7 SCAR=22.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3521 | 5853 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3522 | 5853 | my $thing = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3523 | 5853 | ▶ | if (not(length($self->{tokens}))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3524 | 0 | $self->_syntax_error("No tokens left"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3525 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3527 | # if (substr($self->{tokens}, 0, 1) eq '^') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3528 | # Carp::cluck( "eating $thing with input $self->{tokens}" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3529 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3531 | 5853 | ▶ | if (ref($thing) and $thing->isa('Regexp')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
ref $thing and $thing->isa("Regexp")
MC/DC50%1/2
ref $thing and $thing->isa("Regexp")
ref $thing
$thing->isa("Regexp")
Truth table66%2/3
A and B
A= ref $thingB= $thing->isa("Regexp")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3532 | 5096 | ▶ | if ($self->{tokens} =~ /^($thing)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3533 | 5096 | my $match = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3534 | 5096 | substr($self->{tokens}, 0, length($match)) = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3535 | 5096 | return $match; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3536 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3538 | 0 | $self->_syntax_error( "Expected $thing" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3539 | } elsif (looks_like_number( $thing )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3540 | 0 | my ($token) = substr( $self->{tokens}, 0, $thing, '' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3541 | 0 | return $token | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3542 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3543 | ### thing is a string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3544 | 757 | ▶ | if (substr($self->{tokens}, 0, length($thing)) eq $thing) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3545 | 757 | substr($self->{tokens}, 0, length($thing)) = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3546 | 757 | return $thing; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3547 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3548 | 0 | $self->_syntax_error( "Expected $thing" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3550 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3551 | 0 | print $thing; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3552 | 0 | throw RDF::Query::Error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3553 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3555 | 0 | ▶ | sub _syntax_error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_syntax_error: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3556 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3557 | 0 | my $thing = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3558 | 0 | my $expect = $thing; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3559 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3560 | 0 | my $level = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3561 | 0 | ▶ | while (my $sub = (caller($level++))[3]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3562 | 0 | ▶ | if ($sub =~ m/::_([A-Z]\w*)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3563 | 0 | $expect = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3564 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3565 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3567 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3568 | 0 | my $l = Log::Log4perl->get_logger("rdf.query.parser.sparql"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3569 | 0 | ▶ | if ($l->is_debug) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3570 | 0 | $l->logcluck("Syntax error eating $thing with input <<$self->{tokens}>>"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3571 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3573 | 0 | my $near = "'" . substr($self->{tokens}, 0, 20) . "...'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3574 | 0 | $near =~ s/[\r\n ]+/ /g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3575 | 0 | ▶ | if ($thing) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3576 | # Carp::cluck Dumper($self->{tokens}); # XXX | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3577 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: $thing in $expect near $near"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3578 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3579 | 0 | throw RDF::Query::Error::ParseError -text => "Syntax error: Expected $expect near $near"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3580 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3581 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3582 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3583 | 13019 | ▶ | sub _test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_test: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3584 | 13019 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3585 | 13019 | my $thing = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3586 | 13019 | ▶ | if (blessed($thing) and $thing->isa('Regexp')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($thing) and $thing->isa("Regexp")
MC/DC50%1/2
builtin::blessed($thing) and $thing->isa("Regexp")
builtin::blessed($thing)
$thing->isa("Regexp")
Truth table66%2/3
A and B
A= builtin::blessed($thing)B= $thing->isa("Regexp")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3587 | 7159 | ▶ | if ($self->{tokens} =~ m/^$thing/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3588 | 2141 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3589 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3590 | 5018 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3592 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3593 | 5860 | ▶ | if (substr($self->{tokens}, 0, length($thing)) eq $thing) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3594 | 388 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3595 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3596 | 5472 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3598 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3599 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3600 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3601 | 8075 | ▶ | sub _ws_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ws_test: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3602 | 8075 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3603 | 8075 | ▶ | unless (length($self->{tokens})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3604 | 304 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3607 | 7771 | ▶ | if ($self->{tokens} =~ m/^[\t\r\n #]/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3608 | 3405 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3609 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3610 | 4366 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3614 | 3511 | ▶ | sub _ws { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ws: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3615 | 3511 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3616 | ### #x9 | #xA | #xD | #x20 | comment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3617 | 3511 | ▶ | if ($self->_test('#')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3618 | 0 | $self->_eat(qr/#[^\x0d\x0a]*.?/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3619 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3620 | 3511 | $self->_eat(qr/[\n\r\t ]/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3621 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3622 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3623 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3624 | 4567 | ▶ | sub __consume_ws_opt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__consume_ws_opt: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3625 | 4567 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3626 | 4567 | ▶ | if ($self->_ws_test) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3627 | 1972 | $self->__consume_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3628 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3629 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3630 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3631 | 2075 | ▶ | sub __consume_ws { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__consume_ws: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3632 | 2075 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3633 | 2075 | $self->_ws; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3634 | 2075 | ▶ | while ($self->_ws_test()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3635 | 1433 | $self->_ws() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3636 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3637 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3638 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3639 | 273 | ▶ | sub __base { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__base: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3640 | 273 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3641 | 273 | my $build = $self->{build}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3642 | 273 | ▶ | if (defined($build->{base})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3643 | 2 | return $build->{base}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3644 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3645 | 271 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3646 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3647 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3648 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3649 | 210 | ▶ | sub __new_statement { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__new_statement: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3650 | 210 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3651 | 210 | my @nodes = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3652 | 210 | ▶ | if ($self->{_modify_template} and my $graph = $self->{named_graph} and $self->{named_graph}->isa('RDF::Trine::Node::Resource')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$self->{"_modify_template"} and my $graph = $self->{"named_graph"} and $self->{"named_graph"}->isa("RDF::Trine::Node::Resource")
$self->{"_modify_template"} and my $graph = $self->{"named_graph"}
MC/DC0%0/3
$self->{"_modify_template"} and my $graph = $self->{"named_graph"} and $self->{"named_graph"}->isa("RDF::Trine::Node::Resource")
$self->{"_modify_template"}
my $graph = $self->{"named_graph"}
$self->{"named_graph"}->isa("RDF::Trine::Node::Resource")
Truth table50%2/4
A and B and C
A= $self->{"_modify_template"}B= my $graph = $self->{"named_graph"}C= $self->{"named_graph"}->isa("RDF::Trine::Node::Resource")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3653 | 18 | return RDF::Query::Algebra::Quad->new( @nodes, $graph ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3654 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3655 | 192 | return RDF::Query::Algebra::Triple->_new( @nodes ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3656 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3657 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3659 | 5 | ▶ | sub __new_path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__new_path: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3660 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3661 | 5 | my $start = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3662 | 5 | my $pdata = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3663 | 5 | my $end = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3664 | 5 | (undef, my $op, my @nodes) = @$pdata; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3665 | 5 | @nodes = map { $self->__strip_path( $_ ) } @nodes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3666 | # if (my $graph = $self->{named_graph} and $self->{named_graph}->isa('RDF::Trine::Node::Resource')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3667 | # return RDF::Query::Algebra::Path->new( $start, [$op, @nodes], $end, $graph ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3668 | # } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3669 | 5 | return RDF::Query::Algebra::Path->new( $start, [$op, @nodes], $end ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3670 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3671 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3672 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3673 | 12 | ▶ | sub __strip_path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__strip_path: called CC=4 SCAR=14.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3674 | 12 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3675 | 12 | my $path = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3676 | 12 | ▶ | if (blessed($path)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3677 | 10 | return $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3678 | ▶ | } elsif (reftype($path) eq 'ARRAY' and $path->[0] eq 'PATH') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
builtin::reftype($path) eq "ARRAY" and $path->[0] eq "PATH"
MC/DC0%0/2
builtin::reftype($path) eq "ARRAY" and $path->[0] eq "PATH"
builtin::reftype($path) eq "ARRAY"
$path->[0] eq "PATH"
Truth table33%1/3
A and B
A= builtin::reftype($path) eq "ARRAY"B= $path->[0] eq "PATH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3679 | 2 | (undef, my $op, my @nodes) = @$path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3680 | 2 | return [$op, map { $self->__strip_path($_) } @nodes]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3681 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3682 | 0 | return $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3683 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3684 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3685 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3686 | 122 | ▶ | sub __new_bgp { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__new_bgp: called CC=7 SCAR=19.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3687 | # fix up BGPs that might actually have property paths in them. split those | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3688 | # out as their own path algebra objects, and join them with the bgp with a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3689 | # ggp if necessary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3690 | 122 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3691 | 122 | my @patterns = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3692 | 122 | ▶ | my @paths = grep { reftype($_->predicate) eq 'ARRAY' and $_->predicate->[0] eq 'PATH' } @patterns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
builtin::reftype($_->predicate) eq 'ARRAY' && $_->predicate->[0] eq 'PATH'
MC/DC50%1/2
builtin::reftype($_->predicate) eq 'ARRAY' && $_->predicate->[0] eq 'PATH'
builtin::reftype($_->predicate) eq 'ARRAY'
$_->predicate->[0] eq 'PATH'
Truth table66%2/3
A && B
A= builtin::reftype($_->predicate) eq 'ARRAY'B= $_->predicate->[0] eq 'PATH'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3693 | 122 | my @triples = grep { blessed($_->predicate) } @patterns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3694 | 122 | ▶ | if (scalar(@patterns) > scalar(@paths) + scalar(@triples)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3695 | 0 | Carp::cluck "more than just triples and paths passed to __new_bgp: " . Dumper(\@patterns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3696 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3697 | 122 | my $bgp = RDF::Query::Algebra::BasicGraphPattern->new( @triples ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3698 | 122 | ▶ | if (@paths) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3699 | 5 | my @p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3700 | 5 | foreach my $p (@paths) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3701 | 5 | my $start = $p->subject; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3702 | 5 | my $end = $p->object; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3703 | 5 | my $pdata = $p->predicate; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3704 | 5 | push(@p, $self->__new_path( $start, $pdata, $end )); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3705 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3706 | 5 | ▶ | my $pgroup = (scalar(@p) == 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3707 | ? $p[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3708 | : RDF::Query::Algebra::GroupGraphPattern->new( @p ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3709 | 5 | ▶ | if (scalar(@triples)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3710 | 2 | return RDF::Query::Algebra::GroupGraphPattern->new( $bgp, $pgroup ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3711 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3712 | 3 | return $pgroup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3713 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3714 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3715 | 117 | return $bgp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3716 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3719 | 35 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3721 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||