AtteanX/Functions/CompositeMaps.pm

filter: Statementstmt 15.5% 69 / 443 Branchbran 0.0% 0 / 152 Conditioncond 0.0% 0 / 52 MC/DCmcdc 0.0% 0 / 33 Subroutinesub 42.5% 20 / 47 Podpod 72.0% 18 / 25 totaltotal 14.2% 107 / 752 CC 100 SCAR 48.9
CC
100
Cov
11%
_compare
462.0
equals
306.0
_recursive_lexer_parse_cdt
182.0
CRAP 133.4
« AtteanX/Parser/RDFXML.pm ↑ Summary AtteanX/Functions/CompositeLists.pm »
1 50 ▶use v5.14;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 50 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 50 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 =head1 NAME
6  
7 AtteanX::Functions::CompositeMaps - Functions and aggregates to work with composite maps
8  
9 =head1 VERSION
10  
11 This document describes AtteanX::Functions::CompositeMaps version 0.032
12  
13 =head1 SYNOPSIS
14  
15 use v5.14;
16 use Attean;
17  
18 =head1 DESCRIPTION
19  
20 This is a utility package that defines functions and aggregates to work with
21 composite map datatypes.
22  
23 =over 4
24  
25 =cut
26  
27 50 package AtteanX::Functions::CompositeMaps::TurtleLexerWithNull {
28 50 ▶ use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 50 ▶ use AtteanX::Serializer::TurtleTokens;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 50 ▶ use AtteanX::Parser::Turtle;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 50 ▶ use AtteanX::SPARQL::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 50 extends 'AtteanX::Parser::Turtle::Lexer';
33  
34 0 ▶ sub get_token {
Subroutine get_token: not called CC=8 SCAR=42.8
Pod documented
35 0 my $self = shift;
36 0 while (1) {
37 0 ▶ $self->fill_buffer unless (length($self->buffer));
Branch: 1 branch
BranchTrueFalseTotal
unless length $self->buffer 0 0 0
38  
39 0 my $start_column = $self->column;
40 0 my $start_line = $self->line;
41  
42 0 ▶ if ($self->buffer =~ /^[ \r\n\t]+/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->buffer =~ /^[ \r\n\t]+/ou) 0 0 0
43 0 my $ws = $self->read_length($+[0]);
44 # we're ignoring whitespace tokens, but we could return them here instead of falling through to the 'next':
45 0 ▶ unless ($self->ignore_whitespace) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->ignore_whitespace) 0 0 0
46 0 return $self->new_token(WS, $start_line, $start_column, $ws);
47 }
48 0 next;
49 }
50  
51 0 my $c = $self->peek_char();
52 0 ▶ return unless (defined($c));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $c 0 0 0
53 0 ▶ if ($c eq ':') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c eq ":") 0 0 0
54 0 $self->read_length(1);
55 0 return AtteanX::Parser::Turtle::Token->fast_constructor(PREFIXNAME, -1, -1, -1, -1, [':']);
56 }
57 0 ▶ if ($self->buffer =~ /^null\b/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->buffer =~ /^null\b/u) { } 0 0 0
elsif ($self->buffer =~ /^(true|false)\b/u) { } 0 0 0
58 0 $self->read_length($+[0]);
59 0 return 1;
60 } elsif ($self->buffer =~ /^(true|false)\b/) {
61 0 my $bool = $self->read_length($+[0]);
62 0 return $self->new_token(BOOLEAN, $start_line, $start_column, $bool);
63 }
64 0 return $self->SUPER::get_token();
65 }
66 }
67 }
68  
69 50 package AtteanX::Functions::CompositeMaps 0.032 {
70  
71 50 ▶ use Attean;
Subroutine BEGIN: called CC=1 SCAR=0.0
72 50 ▶ use Attean::RDF;
Subroutine BEGIN: called CC=1 SCAR=0.0
73 50 ▶ use Encode qw(decode_utf8);
Subroutine BEGIN: called CC=1 SCAR=0.0
74 50 ▶ use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
75 50 ▶ use Digest::SHA qw(sha1_hex);
Subroutine BEGIN: called CC=1 SCAR=0.0
76 50 ▶ use AtteanX::Serializer::TurtleTokens;
Subroutine BEGIN: called CC=1 SCAR=0.0
77 50 ▶ use AtteanX::Parser::Turtle;
Subroutine BEGIN: called CC=1 SCAR=0.0
78 50 ▶ use AtteanX::SPARQL::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
79 50 ▶ use AtteanX::Functions::CompositeLists;
Subroutine BEGIN: called CC=1 SCAR=0.0
80
81 50 our $CDT_BASE = 'http://w3id.org/awslabs/neptune/SPARQL-CDTs/';
82 50 our $MAP_TYPE_IRI = "${CDT_BASE}Map";
83  
84 # Assume the opening token of the cdt has already been consumed.
85 # Return either a HASH or ARRAY reference, depending on the closing token.
86 # Does not validate the lexical form with respect to balanced cdt tokens.
87 0 ▶ sub _recursive_lexer_parse_cdt {
Subroutine _recursive_lexer_parse_cdt: not called CC=13 SCAR=52.0
88 0 my $p = shift;
89 0 my $lexer = shift;
90 0 my @nodes;
91 0 my $s = AtteanX::Serializer::TurtleTokens->new( suppress_whitespace => 1 );
92 0 ▶ while (my $t = $p->_next_nonws($lexer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $t = $p->_next_nonws($lexer)) 0 0 0
93 0 ▶ if ($t and not blessed($t)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t and not builtin::blessed($t)) { } 0 0 0
Condition0%0/3
$t and not builtin::blessed($t)
!ll&&!rl&&r
000
MC/DC0%0/2
$t and not builtin::blessed($t)
$t not builtin::blessed($t)
Truth table0%0/3
A and not(B)
A= $tB= not builtin::blessed($t)
ABresult
0X0
100
111
94 # this is the special value returned from our lexer subclass that indicates a null values
95 0 push(@nodes, undef);
96 } else {
97 0 ▶ next if ($t->type == COMMA);
Branch: 1 branch
BranchTrueFalseTotal
if $t->type == 6 0 0 0
98 0 ▶ next if ($t->type == PREFIXNAME and $t->value eq ':'); # COLON
Branch: 1 branch
BranchTrueFalseTotal
if $t->type == 21 and $t->value eq ":" 0 0 0
Condition0%0/3
$t->type == 21 and $t->value eq ":"
!ll&&!rl&&r
000
MC/DC0%0/2
$t->type == 21 and $t->value eq ":"
$t->type == 21 $t->value eq ":"
Truth table0%0/3
A and B
A= $t->type == 21B= $t->value eq ":"
ABresult
0X0
100
111
99
100 0 ▶ if ($t->type == LBRACE) {
Branch: 4 branches
BranchTrueFalseTotal
if ($t->type == 16) { } 0 0 0
elsif ($t->type == 22) { } 0 0 0
elsif ($t->type == 17) { } 0 0 0
elsif ($t->type == 23) { } 0 0 0
101 0 my $hash = _recursive_lexer_parse_cdt($p, $lexer);
102 0 push(@nodes, AtteanX::Functions::CompositeMaps::map_to_lex(%$hash));
103 } elsif ($t->type == RBRACE) {
104 0 my %hash;
105 0 ▶ die "odd number of map elements" unless (scalar(@nodes) % 2 == 0);
Branch: 1 branch
BranchTrueFalseTotal
unless scalar(@nodes) % 2 == 0 0 0 0
106 0 ▶ while (my ($k, $v) = splice(@nodes, 0, 2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@nodes, 0, 2)) 0 0 0
107 0 my @tokens;
108 0 push(@tokens, $k->sparql_tokens->elements);
109 0 my $iter = Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::Parser::Turtle::Token' );
110 0 my $bytes = $s->serialize_iter_to_bytes($iter);
111 0 my $key_string = decode_utf8($bytes);
112
113 0 $hash{ $key_string } = $v;
114 }
115 0 return \%hash;
116 } elsif ($t->type == LBRACKET) {
117 0 my $subnodes = _recursive_lexer_parse_cdt($p, $lexer);
118 0 push(@nodes, AtteanX::Functions::CompositeLists::list_to_lex(@$subnodes));
119 } elsif ($t->type == RBRACKET) {
120 0 return \@nodes;
121 } else {
122 0 my $t = $p->_object($lexer, $t);
123 0 push(@nodes, $t);
124 }
125 }
126 }
127  
128 0 die 'unexpected end of map literal lexical form';
129 }
130  
131 =item C<< lex_to_map($literal) >>
132  
133 Parses $literal as a cdt:Map value and returns a hash of stringified keys and
134 term object values. Use C<< lex_to_maplist >> to get a list of key-value pairs
135 in which the keys are also term objects.
136  
137 =cut
138 0 ▶ sub lex_to_map {
Subroutine lex_to_map: not called CC=6 SCAR=37.4
Pod documented
139 0 my $l = shift;
140 0 ▶ die 'TypeError' unless ($l->does('Attean::API::Literal'));
Branch: 1 branch
BranchTrueFalseTotal
unless $l->does("Attean::API::Literal") 0 0 0
141 0 my $dt = $l->datatype;
142 0 ▶ die 'TypeError: not a datatype literal' unless ($dt);
Branch: 1 branch
BranchTrueFalseTotal
unless $dt 0 0 0
143 0 ▶ die 'TypeError: Expecting a Map but found ' . $dt->value unless ($dt->value eq $MAP_TYPE_IRI);
Branch: 1 branch
BranchTrueFalseTotal
unless $dt->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI 0 0 0
144 0 my $lex = $l->value;
145 0 $lex =~ s/^\s*//g;
146 0 $lex =~ s/\s*$//g;
147
148 0 ▶ unless ($lex =~ m<^\{(.*)\}$>) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($lex =~ /^\{(.*)\}$/u) 0 0 0
149 0 die 'TypeError: Invalid lexical form for cdt:Map literal: ' . $dt->value;
150 }
151
152 0 open(my $fh, '<:encoding(UTF-8)', \$lex);
153 0 my $p = AtteanX::Parser::Turtle->new();
154 0 local($p->{enable_cdt_rewriting}) = 0;
155  
156 # $p->_map->{''} = Attean::IRI->new($MAP_TYPE_IRI);
157 0 my $lexer = AtteanX::Functions::CompositeMaps::TurtleLexerWithNull->new(file => $fh);
158 0 my @nodes;
159 0 my $t = $p->_next_nonws($lexer);
160 0 ▶ if ($t->type == LBRACE) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t->type == 16) 0 0 0
161 0 my $hash = _recursive_lexer_parse_cdt($p, $lexer);
162 0 push(@nodes, %$hash);
163 }
164  
165 0 return @nodes;
166 }
167  
168 =item C<< map_to_lex(@terms) >>
169  
170 =cut
171 0 ▶ sub map_to_lex {
Subroutine map_to_lex: not called CC=4 SCAR=30.0
Pod documented
172  
173 0 my @terms = @_;
174 0 my $s = AtteanX::Serializer::TurtleTokens->new( suppress_whitespace => 1 );
175 0 my $bytes = '';
176 0 open(my $io, '>', \$bytes);
177 0 my $first = 1;
178
179 0 my $p = AtteanX::Parser::Turtle->new();
180 0 local($p->{enable_cdt_rewriting}) = 0;
181  
182 0 ▶ while (my ($key_string, $value) = splice(@terms, 0, 2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@terms, 0, 2)) 0 0 0
183 0 ▶ unless ($first) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($first) 0 0 0
184 0 my @tokens;
185 0 push(@tokens, AtteanX::Parser::Turtle::Token->fast_constructor(COMMA, -1, -1, -1, -1, [',']));
186 0 push(@tokens, AtteanX::Parser::Turtle::Token->fast_constructor(WS, -1, -1, -1, -1, [' ']));
187 0 my $iter = Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::Parser::Turtle::Token' );
188 0 $s->serialize_iter_to_io($io, $iter);
189 }
190 0 $first = 0;
191  
192 0 my @tokens;
193 0 my $key = $p->parse_node($key_string);
194  
195 0 push(@tokens, $key->sparql_tokens->elements);
196 0 push(@tokens, AtteanX::Parser::Turtle::Token->fast_constructor(WS, -1, -1, -1, -1, [' ']));
197  
198 0 push(@tokens, AtteanX::Parser::Turtle::Token->fast_constructor(PREFIXNAME, -1, -1, -1, -1, [':']));
199 0 ▶ if (blessed($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($value)) { } 0 0 0
200 0 push(@tokens, $value->sparql_tokens->elements);
201 0 my $iter = Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::Parser::Turtle::Token' );
202 0 $s->serialize_iter_to_io($io, $iter);
203 } else {
204 0 my $iter = Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::Parser::Turtle::Token' );
205 0 $s->serialize_iter_to_io($io, $iter);
206 0 print {$io} "null";
207 }
208 }
209 0 close($io);
210 0 my $str = decode_utf8($bytes);
211 0 chomp($str);
212 0 return dtliteral("{${str}}", $MAP_TYPE_IRI);
213 }
214  
215 =item C<< mapCreate(@list) >>
216  
217 =cut
218 0 ▶ sub mapCreate {
Subroutine mapCreate: not called CC=4 SCAR=30.0
Pod documented
219 0 my $model = shift;
220 0 my $active_graph = shift;
221 0 my @map;
222 0 my $s = AtteanX::Serializer::TurtleTokens->new( suppress_whitespace => 1 );
223 0 ▶ while (my ($key, $value) = splice(@_, 0, 2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@_, 0, 2)) 0 0 0
224 0 ▶ next unless (is_valid_map_key($key));
Branch: 1 branch
BranchTrueFalseTotal
unless is_valid_map_key($key) 0 0 0
225 0 my @tokens = $key->sparql_tokens->elements;
226 0 my $iter = Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::Parser::Turtle::Token' );
227 0 my $bytes = $s->serialize_iter_to_bytes($iter);
228 0 my $key_string = decode_utf8($bytes);
229 0 push(@map, $key_string, $value);
230 # $map{$key_string} = $value;
231 }
232 0 my $literal = eval { map_to_lex(@map) };
233 0 ▶ warn "cdt:Map constructor error: $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
234 0 return $literal;
235 }
236  
237 =item C<< is_valid_map_key( $value ) >>
238  
239 Returns true if $value is a valid map key (is an IRI or a literal), false otherwise.
240  
241 =cut
242 0 ▶ sub is_valid_map_key {
Subroutine is_valid_map_key: not called CC=4 SCAR=30.0
Pod documented
243 0 my $key = shift;
244 0 ▶ return 0 unless (blessed($key));
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($key) 0 0 0
245 0 ▶ return 1 if ($key->does('Attean::API::IRI'));
Branch: 1 branch
BranchTrueFalseTotal
if $key->does("Attean::API::IRI") 0 0 0
246 0 ▶ return 1 if ($key->does('Attean::API::Literal'));
Branch: 1 branch
BranchTrueFalseTotal
if $key->does("Attean::API::Literal") 0 0 0
247 0 return 0;
248 }
249  
250 0 ▶ sub _map_key_string {
Subroutine _map_key_string: not called CC=1 SCAR=6.9
251 0 my $key = shift;
252 0 my $s = AtteanX::Serializer::TurtleTokens->new( suppress_whitespace => 1 );
253 0 my @tokens = $key->sparql_tokens->elements;
254 0 my $iter = Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::Parser::Turtle::Token' );
255 0 my $bytes = $s->serialize_iter_to_bytes($iter);
256 0 my $key_string = decode_utf8($bytes);
257 0 return $key_string;
258 }
259  
260 =item C<< mapGet($list, $key) >>
261  
262 =cut
263 0 ▶ sub mapGet {
Subroutine mapGet: not called CC=3 SCAR=24.8
Pod documented
264 0 my $model = shift;
265 0 my $active_graph = shift;
266 0 my $l = shift;
267 0 my $key = shift;
268 0 ▶ die 'TypeError' unless ($l->does('Attean::API::Literal'));
Branch: 1 branch
BranchTrueFalseTotal
unless $l->does("Attean::API::Literal") 0 0 0
269 0 my $dt = $l->datatype;
270 0 ▶ die 'TypeError' unless ($dt->value eq $MAP_TYPE_IRI);
Branch: 1 branch
BranchTrueFalseTotal
unless $dt->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI 0 0 0
271 0 my %nodes = lex_to_map($l);
272  
273 0 my $key_string = _map_key_string($key);
274 0 my $value = $nodes{$key_string};
275 0 return $value;
276 }
277  
278 =item C<< mapKeys($map) >>
279  
280 =cut
281 0 ▶ sub mapKeys {
Subroutine mapKeys: not called CC=3 SCAR=24.8
Pod documented
282 0 my $model = shift;
283 0 my $active_graph = shift;
284 0 my $map = shift;
285 0 ▶ die 'TypeError' unless ($map->does('Attean::API::Literal'));
Branch: 1 branch
BranchTrueFalseTotal
unless $map->does("Attean::API::Literal") 0 0 0
286 0 my $dt = $map->datatype;
287 0 ▶ die 'TypeError' unless ($dt->value eq $MAP_TYPE_IRI);
Branch: 1 branch
BranchTrueFalseTotal
unless $dt->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI 0 0 0
288 0 my %nodes = lex_to_map($map);
289 0 my @key_strings = keys %nodes;
290  
291 0 my $p = AtteanX::Parser::Turtle->new();
292 0 local($p->{enable_cdt_rewriting}) = 0;
293  
294 # $p->_map->{''} = Attean::IRI->new($MAP_TYPE_IRI);
295 my @nodes = map {
296 0 open(my $fh, '<:encoding(UTF-8)', \$_);
297 0 my $lexer = AtteanX::Functions::CompositeMaps::TurtleLexerWithNull->new(file => $fh);
298 0 my $token = $p->_next_nonws($lexer);
299 0 $p->_object($lexer, $token);
300 } @key_strings;
301 0 AtteanX::Functions::CompositeLists::list_to_lex(@nodes);
302 }
303  
304 =item C<< map_key_to_term( @keys ) >>
305  
306 Converts each argument from the stringified version of map keys used as hash
307 keys to a list of term objects.
308  
309 =cut
310 0 ▶ sub map_key_to_term {
Subroutine map_key_to_term: not called CC=2 SCAR=17.9
Pod documented
311 0 my @keys = @_;
312 0 my $p = AtteanX::Parser::Turtle->new();
313 0 local($p->{enable_cdt_rewriting}) = 0;
314  
315 my @terms = map {
316 0 open(my $fh, '<:encoding(UTF-8)', \$_);
317 0 my $lexer = AtteanX::Functions::CompositeMaps::TurtleLexerWithNull->new(file => $fh);
318 0 my $token = $p->_next_nonws($lexer);
319 0 $p->_object($lexer, $token);
320 } @keys;
321
322 0 ▶ return wantarray ? @terms : $terms[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
323 }
324
325 =item C<< lex_to_maplist() >>
326  
327 Parses $literal as a cdt:Map value and returns a (flattened) list of key-value
328 pairs of term values.
329  
330 =cut
331 0 ▶ sub lex_to_maplist {
Subroutine lex_to_maplist: not called CC=2 SCAR=17.9
Pod documented
332 0 my %map = lex_to_map(@_);
333 0 my @key_strings = keys %map;
334 0 my @values = values %map;
335 0 my $p = AtteanX::Parser::Turtle->new();
336 0 local($p->{enable_cdt_rewriting}) = 0;
337  
338 my @keys = map {
339 0 open(my $fh, '<:encoding(UTF-8)', \$_);
340 0 my $lexer = AtteanX::Functions::CompositeMaps::TurtleLexerWithNull->new(file => $fh);
341 0 my $token = $p->_next_nonws($lexer);
342 0 $p->_object($lexer, $token);
343 } @key_strings;
344 0 my @list;
345 0 foreach my $i (0 .. $#keys) {
346 0 push(@list, $keys[$i]);
347 0 push(@list, $values[$i]);
348 }
349 0 return @list;
350 }
351  
352 =item C<< mapPut($map, $key, $value) >>
353  
354 =cut
355 0 ▶ sub mapPut {
Subroutine mapPut: not called CC=5 SCAR=34.0
Pod documented
356 0 my $model = shift;
357 0 my $active_graph = shift;
358 0 my $map = shift;
359 0 my $key = shift;
360 0 ▶ die 'TypeError' unless (is_valid_map_key($key));
Branch: 1 branch
BranchTrueFalseTotal
unless is_valid_map_key($key) 0 0 0
361 0 my $value = shift;
362 0 ▶ die 'TypeError' unless (blessed($map) and $map->does('Attean::API::Literal'));
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($map) and $map->does("Attean::API::Literal") 0 0 0
Condition0%0/3
builtin::blessed($map) and $map->does("Attean::API::Literal")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($map) and $map->does("Attean::API::Literal")
builtin::blessed($map) $map->does("Attean::API::Literal")
Truth table0%0/3
A and B
A= builtin::blessed($map)B= $map->does("Attean::API::Literal")
ABresult
0X0
100
111
363 0 my $dt = $map->datatype;
364 0 ▶ die 'TypeError' unless ($dt->value eq $MAP_TYPE_IRI);
Branch: 1 branch
BranchTrueFalseTotal
unless $dt->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI 0 0 0
365 0 my %nodes = lex_to_map($map);
366 0 my @key_strings = keys %nodes;
367  
368 0 my $key_string = _map_key_string($key);
369 0 $nodes{ $key_string } = $value;
370  
371 0 return map_to_lex(%nodes);
372 }
373  
374 =item C<< mapRemove($map, $key) >>
375  
376 =cut
377 0 ▶ sub mapRemove {
Subroutine mapRemove: not called CC=5 SCAR=34.0
Pod documented
378 0 my $model = shift;
379 0 my $active_graph = shift;
380 0 my $map = shift;
381 0 my $key = shift;
382 0 ▶ die 'TypeError' unless (blessed($map) and $map->does('Attean::API::Literal'));
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($map) and $map->does("Attean::API::Literal") 0 0 0
Condition0%0/3
builtin::blessed($map) and $map->does("Attean::API::Literal")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($map) and $map->does("Attean::API::Literal")
builtin::blessed($map) $map->does("Attean::API::Literal")
Truth table0%0/3
A and B
A= builtin::blessed($map)B= $map->does("Attean::API::Literal")
ABresult
0X0
100
111
383 0 my $dt = $map->datatype;
384 0 ▶ die 'TypeError' unless ($dt->value eq $MAP_TYPE_IRI);
Branch: 1 branch
BranchTrueFalseTotal
unless $dt->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI 0 0 0
385 0 my %nodes = lex_to_map($map);
386 0 my @key_strings = keys %nodes;
387  
388 0 ▶ unless (is_valid_map_key($key)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (is_valid_map_key($key)) 0 0 0
389 0 return $map;
390 }
391  
392 0 my $key_string = _map_key_string($key);
393 0 delete $nodes{ $key_string };
394  
395 0 return map_to_lex(%nodes);
396 }
397  
398 =item C<< mapSize($list) >>
399  
400 =cut
401 0 ▶ sub mapSize {
Subroutine mapSize: not called CC=4 SCAR=30.0
Pod documented
402 0 my $model = shift;
403 0 my $active_graph = shift;
404 0 my $l = shift;
405 0 ▶ die 'TypeError' unless (blessed($l) and $l->does('Attean::API::Literal'));
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($l) and $l->does("Attean::API::Literal") 0 0 0
Condition0%0/3
builtin::blessed($l) and $l->does("Attean::API::Literal")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($l) and $l->does("Attean::API::Literal")
builtin::blessed($l) $l->does("Attean::API::Literal")
Truth table0%0/3
A and B
A= builtin::blessed($l)B= $l->does("Attean::API::Literal")
ABresult
0X0
100
111
406 0 my $dt = $l->datatype;
407 0 ▶ die 'TypeError' unless ($dt->value eq $MAP_TYPE_IRI);
Branch: 1 branch
BranchTrueFalseTotal
unless $dt->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI 0 0 0
408 0 my %nodes = lex_to_map($l);
409 0 my @keys = keys(%nodes);
410 0 return Attean::Literal->integer(scalar(@keys));
411 }
412  
413 =item C<< mapContains($map, $term) >>
414  
415 =cut
416 0 ▶ sub mapContains {
Subroutine mapContains: not called CC=5 SCAR=34.0
Pod documented
417 0 my $model = shift;
418 0 my $active_graph = shift;
419 0 my $l = shift;
420 0 my $term = shift;
421 0 ▶ die 'TypeError: Not a literal' unless (blessed($l) and $l->does('Attean::API::Literal'));
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($l) and $l->does("Attean::API::Literal") 0 0 0
Condition0%0/3
builtin::blessed($l) and $l->does("Attean::API::Literal")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($l) and $l->does("Attean::API::Literal")
builtin::blessed($l) $l->does("Attean::API::Literal")
Truth table0%0/3
A and B
A= builtin::blessed($l)B= $l->does("Attean::API::Literal")
ABresult
0X0
100
111
422 0 my $dt = $l->datatype;
423 0 ▶ die 'TypeError: Not a cdt:List' unless ($dt->value eq $MAP_TYPE_IRI);
Branch: 1 branch
BranchTrueFalseTotal
unless $dt->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI 0 0 0
424 0 my %nodes = lex_to_map($l);
425  
426 0 my $s = AtteanX::Serializer::TurtleTokens->new( suppress_whitespace => 1 );
427 0 my @tokens = $term->sparql_tokens->elements;
428 0 my $iter = Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::Parser::Turtle::Token' );
429 0 my $bytes = $s->serialize_iter_to_bytes($iter);
430 0 my $key_string = decode_utf8($bytes);
431
432 0 ▶ return (exists $nodes{ $key_string }) ? Attean::Literal->true : Attean::Literal->false;
Branch: 1 branch
BranchTrueFalseTotal
exists $nodes{$key_string} ? : 0 0 0
433 }
434  
435 =item C<< mapMerge($map1, $map2) >>
436  
437 =cut
438 0 ▶ sub mapMerge {
Subroutine mapMerge: not called CC=1 SCAR=6.9
Pod documented
439 0 my $model = shift;
440 0 my $active_graph = shift;
441 0 my $map1 = shift;
442 0 my $map2 = shift;
443 0 my %nodes1 = lex_to_map($map1);
444 0 my %nodes2 = lex_to_map($map2);
445 0 my %merged = (%nodes2, %nodes1);
446 0 my $merged = map_to_lex(%merged);
447 0 return $merged;
448 }
449  
450 =item C<< mapCreate_agg_start() >>
451  
452 =cut
453 0 ▶ sub mapCreate_agg_start {
Subroutine mapCreate_agg_start: not called CC=1 SCAR=6.9
Pod documented
454 0 my $model = shift;
455 0 my $active_graph = shift;
456 return {
457 0 values => {}
458 };
459 }
460  
461 =item C<< mapCreate_agg_process($thunk, $key, $value) >>
462  
463 =cut
464 0 ▶ sub mapCreate_agg_process {
Subroutine mapCreate_agg_process: not called CC=1 SCAR=6.9
Pod documented
465 0 my $thunk = shift;
466 0 my ($key) = shift;
467 0 my $value = shift;
468 0 $thunk->{'values'}{$key->value} = $value;
469 }
470  
471 =item C<< mapCreate_agg_finalize($thunk) >>
472  
473 =cut
474 0 ▶ sub mapCreate_agg_finalize {
Subroutine mapCreate_agg_finalize: not called CC=1 SCAR=6.9
Pod documented
475 0 my $thunk = shift;
476 0 my %terms = @{ $thunk->{'values' }};
477 0 return map_to_lex(%terms);
478 }
479  
480 =item C<< register() >>
481  
482 =cut
483 23 ▶ sub register {
Subroutine register: called CC=1 SCAR=0.0
Pod documented
484 23 Attean->register_datatype_role(
485 $MAP_TYPE_IRI => 'AtteanX::Functions::CompositeMaps::MapLiteral'
486 );
487
488 23 Attean->register_global_functional_form(
489 "${CDT_BASE}Map" => \&mapCreate,
490 "${CDT_BASE}mapCreate" => \&mapCreate,
491 "${CDT_BASE}put" => \&mapPut,
492 );
493 23 Attean->register_global_function(
494 "${CDT_BASE}mapGet" => \&mapGet,
495 "${CDT_BASE}mapSize" => \&mapSize,
496 "${CDT_BASE}keys" => \&mapKeys,
497 "${CDT_BASE}remove" => \&mapRemove,
498 "${CDT_BASE}containsKey" => \&mapContains,
499 "${CDT_BASE}merge" => \&mapMerge,
500 );
501  
502 23 Attean->register_global_aggregate(
503 "${CDT_BASE}mapAgg" => {
504 start => \&mapCreate_agg_start,
505 process => \&mapCreate_agg_process,
506 finalize => \&mapCreate_agg_finalize,
507 },
508 );
509 }
510 }
511  
512 50 package AtteanX::Functions::CompositeMaps::MapLiteral {
513 50 ▶ use Scalar::Util qw(blessed looks_like_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
514 50 ▶ use List::Util qw(min);
Subroutine BEGIN: called CC=1 SCAR=0.0
515  
516 50 ▶ use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
517  
518 0 ▶ sub equals {
Subroutine equals: not called CC=17 SCAR=57.2
Pod undocumented
519 0 my $lhs = shift;
520 0 my $rhs = shift;
521 # warn "MAP EQUALS?";
522 # warn "- " . $lhs->as_string . "\n";
523 # warn "- " . $rhs->as_string . "\n";
524 0 ▶ return 0 unless ($rhs->does('Attean::API::Literal') and $rhs->datatype->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI);
Branch: 1 branch
BranchTrueFalseTotal
unless $rhs->does("Attean::API::Literal") and $rhs->datatype->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI 0 0 0
Condition0%0/3
$rhs->does("Attean::API::Literal") and $rhs->datatype->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI
!ll&&!rl&&r
000
MC/DC0%0/2
$rhs->does("Attean::API::Literal") and $rhs->datatype->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI
$rhs->does("Attean::API::Literal") $rhs->datatype->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI
Truth table0%0/3
A and B
A= $rhs->does("Attean::API::Literal")B= $rhs->datatype->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI
ABresult
0X0
100
111
525 0 my $lhs_size = eval { AtteanX::Functions::CompositeMaps::mapSize(undef, undef, $lhs)->value };
526 0 ▶ return 0 if ($@);
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
527 0 my $rhs_size = eval { AtteanX::Functions::CompositeMaps::mapSize(undef, undef, $rhs)->value };
528 0 ▶ return 0 if ($@);
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
529 0 ▶ return 0 unless ($lhs_size == $rhs_size);
Branch: 1 branch
BranchTrueFalseTotal
unless $lhs_size == $rhs_size 0 0 0
530
531 0 my %lhs_map = AtteanX::Functions::CompositeMaps::lex_to_map($lhs);
532 0 my %rhs_map = AtteanX::Functions::CompositeMaps::lex_to_map($rhs);
533
534 0 my @lhs_keys = sort(keys %lhs_map);
535 0 my @rhs_keys = sort(keys %rhs_map);
536
537 # TODO: handle differing lexical forms for map keys here:
538  
539 0 my $seen_error = 0;
540 0 foreach my $i (0 .. $lhs_size-1) {
541 0 ▶ return 0 unless ($lhs_keys[$i] eq $rhs_keys[$i]);
Branch: 1 branch
BranchTrueFalseTotal
unless $lhs_keys[$i] eq $rhs_keys[$i] 0 0 0
542 0 my $key = $lhs_keys[$i];
543 0 my $lv = $lhs_map{$key};
544 0 my $rv = $rhs_map{$key};
545 0 ▶ if (not blessed($lv) and not blessed($rv)) {
Branch: 2 branches
BranchTrueFalseTotal
if (not builtin::blessed($lv) || builtin::blessed($rv)) { } 0 0 0
elsif (not builtin::blessed($lv) && builtin::blessed($rv)) { } 0 0 0
Condition0%0/3
builtin::blessed($lv) || builtin::blessed($rv)
l!l&&r!l&&!r
000
MC/DC0%0/2
builtin::blessed($lv) || builtin::blessed($rv)
builtin::blessed($lv) builtin::blessed($rv)
Truth table0%0/3
A || B
A= builtin::blessed($lv)B= builtin::blessed($rv)
ABresult
1X1
011
000
546 # both null
547 0 next;
548 ▶ } elsif (not blessed($lv) or not blessed($rv)) {
Condition0%0/3
builtin::blessed($lv) && builtin::blessed($rv)
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($lv) && builtin::blessed($rv)
builtin::blessed($lv) builtin::blessed($rv)
Truth table0%0/3
A && B
A= builtin::blessed($lv)B= builtin::blessed($rv)
ABresult
0X0
100
111
549 0 return 0;
550 }
551  
552 0 ▶ if ($lv->does('Attean::API::Blank') and $rv->does('Attean::API::Blank')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lv->does("Attean::API::Blank") and $rv->does("Attean::API::Blank")) 0 0 0
Condition0%0/3
$lv->does("Attean::API::Blank") and $rv->does("Attean::API::Blank")
!ll&&!rl&&r
000
MC/DC0%0/2
$lv->does("Attean::API::Blank") and $rv->does("Attean::API::Blank")
$lv->does("Attean::API::Blank") $rv->does("Attean::API::Blank")
Truth table0%0/3
A and B
A= $lv->does("Attean::API::Blank")B= $rv->does("Attean::API::Blank")
ABresult
0X0
100
111
553 0 ▶ if ($lv->value eq $rv->value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lv->value eq $rv->value) { } 0 0 0
554 0 next;
555 } else {
556 0 $seen_error++;
557 0 next;
558 }
559 }
560  
561 0 ▶ return 0 unless ($lv->equals($rv));
Branch: 1 branch
BranchTrueFalseTotal
unless $lv->equals($rv) 0 0 0
562 }
563 0 ▶ if ($seen_error) {
Branch: 1 branch
BranchTrueFalseTotal
if ($seen_error) 0 0 0
564 0 die 'TypeError';
565 }
566 0 return 1;
567 }
568
569 0 ▶ sub order {
Subroutine order: not called CC=1 SCAR=6.9
Pod undocumented
570 0 my $self = shift;
571 0 return _compare('order', $self, @_);
572 }
573
574 0 ▶ sub compare {
Subroutine compare: not called CC=1 SCAR=6.9
Pod undocumented
575 0 my $self = shift;
576 0 return _compare('compare', $self, @_);
577 }
578
579 0 ▶ sub _compare {
Subroutine _compare: not called CC=21 SCAR=61.4
580 0 my $cmp_method = shift;
581 0 my $lhs = shift;
582 0 my $rhs = shift;
583 # warn "MAP-LESS-THAN?";
584 # warn "- " . $lhs->as_string . "\n";
585 # warn "- " . $rhs->as_string . "\n";
586 0 ▶ die 'TypeError' unless (blessed($rhs) and $rhs->does('Attean::API::Literal') and $rhs->datatype->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI);
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($rhs) and $rhs->does("Attean::API::Literal") and $rhs->datatype->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI 0 0 0
Condition0%0/6
builtin::blessed($rhs) and $rhs->does("Attean::API::Literal") and $rhs->datatype->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI
!ll&&!rl&&r
000
builtin::blessed($rhs) and $rhs->does("Attean::API::Literal")
!ll&&!rl&&r
000
MC/DC0%0/3
builtin::blessed($rhs) and $rhs->does("Attean::API::Literal") and $rhs->datatype->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI
builtin::blessed($rhs) $rhs->does("Attean::API::Literal") $rhs->datatype->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI
Truth table0%0/4
A and B and C
A= builtin::blessed($rhs)B= $rhs->does("Attean::API::Literal")C= $rhs->datatype->value eq $AtteanX::Functions::CompositeMaps::MAP_TYPE_IRI
ABCresult
0XX0
10X0
1100
1111
587
588 0 my %lhs = AtteanX::Functions::CompositeMaps::lex_to_map($lhs);
589 0 my %rhs = AtteanX::Functions::CompositeMaps::lex_to_map($rhs);
590
591 0 my $lhs_size = scalar(%lhs);
592 0 my $rhs_size = scalar(%rhs);
593
594 0 ▶ if (not($lhs_size) and not($rhs_size)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($lhs_size or $rhs_size) 0 0 0
Condition0%0/3
$lhs_size or $rhs_size
l!l&&r!l&&!r
000
MC/DC0%0/2
$lhs_size or $rhs_size
$lhs_size $rhs_size
Truth table0%0/3
A or B
A= $lhs_sizeB= $rhs_size
ABresult
1X1
011
000
595 0 return 0; # empty maps are trivially eq
596 }
597
598
599 0 ▶ if (scalar(%lhs) == 0 and scalar(%rhs) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar %lhs == 0 and scalar %rhs == 0) 0 0 0
Condition0%0/3
scalar %lhs == 0 and scalar %rhs == 0
!ll&&!rl&&r
000
MC/DC0%0/2
scalar %lhs == 0 and scalar %rhs == 0
scalar %lhs == 0 scalar %rhs == 0
Truth table0%0/3
A and B
A= scalar %lhs == 0B= scalar %rhs == 0
ABresult
0X0
100
111
600 0 return 0;
601 }
602  
603 0 my @lhs_keys = sort_map_keys(keys %lhs);
604 0 my @rhs_keys = sort_map_keys(keys %rhs);
605
606 0 my $length = min($lhs_size, $rhs_size);
607 0 foreach my $i (0 .. $length-1) {
608 0 my $k1 = AtteanX::Functions::CompositeMaps::map_key_to_term($lhs_keys[$i]);
609 0 my $k2 = AtteanX::Functions::CompositeMaps::map_key_to_term($rhs_keys[$i]);
610
611 0 my $same = sameterm($k1, $k2);
612 0 ▶ if (not($same)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($same) 0 0 0
613 # the keys are not the same
614 0 my @sorted = sort_map_keys($lhs_keys[$i], $rhs_keys[$i]);
615 0 ▶ if ($sorted[0] eq $lhs_keys[$i]) { # k1 is ordered before k2 according tot he map key sorting
Branch: 1 branch
BranchTrueFalseTotal
if ($sorted[0] eq $lhs_keys[$i]) { } 0 0 0
616 0 return -1; # less than
617 } else {
618 0 return 1; # greater than
619 }
620 }
621
622 0 my $v1 = $lhs{$lhs_keys[$i]};
623 0 my $v2 = $rhs{$rhs_keys[$i]};
624  
625 0 ▶ if (not blessed($v1) and not blessed($v2)) {
Branch: 3 branches
BranchTrueFalseTotal
if (not builtin::blessed($v1) || builtin::blessed($v2)) { } 0 0 0
elsif (not builtin::blessed($v1)) { } 0 0 0
elsif (not builtin::blessed($v2)) { } 0 0 0
Condition0%0/3
builtin::blessed($v1) || builtin::blessed($v2)
l!l&&r!l&&!r
000
MC/DC0%0/2
builtin::blessed($v1) || builtin::blessed($v2)
builtin::blessed($v1) builtin::blessed($v2)
Truth table0%0/3
A || B
A= builtin::blessed($v1)B= builtin::blessed($v2)
ABresult
1X1
011
000
626 # both null
627 0 next;
628 } elsif (not blessed($v1)) {
629 0 ▶ if ($cmp_method eq 'order') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmp_method eq 'order') { } 0 0 0
630 0 return -1;
631 } else {
632 0 die 'TypeError';
633 }
634 } elsif (not blessed($v2)) {
635 0 ▶ if ($cmp_method eq 'order') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmp_method eq 'order') { } 0 0 0
636 0 return 1;
637 } else {
638 0 die 'TypeError';
639 }
640 }
641
642 0 ▶ if ($cmp_method eq 'compare') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmp_method eq "compare") 0 0 0
643 0 foreach my $v ($v1, $v2) {
644 0 ▶ if ($v->does('Attean::API::IRI')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($v->does("Attean::API::IRI")) 0 0 0
645 0 die 'TypeError'; # IRIs as map values cannot be compared
646 }
647 }
648 }
649
650 0 my $v_cmp = $v1->$cmp_method($v2); # may throw an error
651 0 ▶ if ($v_cmp) {
Branch: 1 branch
BranchTrueFalseTotal
if ($v_cmp) 0 0 0
652 0 return $v_cmp;
653 }
654 }
655
656 0 return ($lhs_size - $rhs_size); # sort smaller maps ahead of larger maps
657 }
658
659 0 ▶ sub sameterm {
Subroutine sameterm: not called CC=4 SCAR=30.0
Pod undocumented
660 # shared code with SAMETERM handling in SimpleQueryEvaluator. Consider refactoring.
661 0 my $a = shift;
662 0 my $b = shift;
663 0 my $cmp = eval { $a->compare($b) };
664 0 ▶ if (not($@) and $cmp) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $@ and $cmp) 0 0 0
Condition0%0/3
not $@ and $cmp
!ll&&!rl&&r
000
MC/DC0%0/2
not $@ and $cmp
not $@ $cmp
Truth table0%0/3
not(A) and B
A= not $@B= $cmp
ABresult
0X0
100
111
665 0 return 0;
666 }
667 0 ▶ if ($a->does('Attean::API::Binding')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a->does('Attean::API::Binding')) { } 0 0 0
668 0 my $ok = ($a->sameTerms($b));
669 0 return $ok;
670 } else {
671 0 my $ok = ($a->value eq $b->value);
672 0 return $ok;
673 }
674 }
675
676 0 ▶ sub sort_map_keys {
Subroutine sort_map_keys: not called CC=7 SCAR=40.3
Pod undocumented
677 0 my @keys = @_;
678 0 my @terms = AtteanX::Functions::CompositeMaps::map_key_to_term(@keys);
679 0 my @iri_i;
680 my @other_i;
681 0 foreach my $i (0 .. $#terms) {
682 0 ▶ if ($terms[$i]->does('Attean::API::IRI')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($terms[$i]->does('Attean::API::IRI')) { } 0 0 0
683 0 push(@iri_i, $i);
684 } else {
685 0 push(@other_i, $i);
686 }
687 }
688 @iri_i = sort {
689 0 my $at = $terms[$a];
690 0 my $bt = $terms[$b];
691 0 $at->compare($bt)
692 } @iri_i;
693 @other_i = sort {
694 0 my $at = $terms[$a];
695 0 my $bt = $terms[$b];
696 0 my $a_value = $at->value;
697 0 my $a_dt = $at->datatype->value;
698 0 ▶ my $a_lang = $at->language // '';
Condition0%0/2
$at->language // ""
l!l
00
MC/DC0%0/1
$at->language // ""
$at->language
Truth table0%0/2
A
A= $at->language
Aresult
11
00
699 0 my $b_value = $bt->value;
700 0 my $b_dt = $bt->datatype->value;
701 0 ▶ my $b_lang = $bt->language // '';
Condition0%0/2
$bt->language // ""
l!l
00
MC/DC0%0/1
$bt->language // ""
$bt->language
Truth table0%0/2
A
A= $bt->language
Aresult
11
00
702
703 0 ▶ if (my $cdt = ($a_dt cmp $b_dt)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $cdt = $a_dt cmp $b_dt) 0 0 0
704 0 return $cdt;
705 }
706 0 ▶ if (my $cval = ($a_value cmp $b_value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $cval = $a_value cmp $b_value) 0 0 0
707 0 return $cval;
708 }
709 0 return $a_lang cmp $b_lang;
710 } @other_i;
711
712 0 return map { $keys[$_] } (@iri_i, @other_i);
713 }
714  
715 0 ▶ sub canonicalized_term {
Subroutine canonicalized_term: not called CC=1 SCAR=6.9
Pod undocumented
716 0 my $self = shift;
717 0 return $self->canonicalized_term_strict();
718 }
719  
720 0 ▶ sub canonicalized_term_strict {
Subroutine canonicalized_term_strict: not called CC=1 SCAR=6.9
Pod undocumented
721 0 my $self = shift;
722 0 my %values = AtteanX::Functions::CompositeMaps::lex_to_map($self);
723 0 my @keys = sort keys %values;
724 0 my @values = map { $_ => $values{$_} } @keys;
725 0 return AtteanX::Functions::CompositeMaps::map_to_lex(@values);
726 }
727  
728 50 with 'Attean::API::Literal';
729 50 with 'Attean::API::CanonicalizingLiteral';
730 }
731  
732 50 1;
733  
734 __END__
« AtteanX/Parser/RDFXML.pm ↑ Summary AtteanX/Functions/CompositeLists.pm »