blib/lib/XML/Atom/FromOWL.pm

filter: Statementstmt 22.1% 60 / 271 Branchbran 0.0% 0 / 142 Conditioncond 0.0% 0 / 108 MC/DCmcdc 0.0% 0 / 65 Subroutinesub 44.6% 21 / 47 Podpod 100% 5 / 5 totaltotal 13.4% 86 / 638 CC 116 SCAR 48.2
CC
116
Cov
12%
export_entry
380.0
export_feed
240.0
_export_entry_content
210.0
CRAP 123.5
↑ Summary
1 package XML::Atom::FromOWL;
2  
3 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶no warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Data::UUID;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use RDF::TrineX::Functions -shortcuts_nodes;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Scalar::Util qw[blessed];
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use XML::Atom::Content;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use XML::Atom::Entry;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use XML::Atom::Feed;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use XML::Atom::Link;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use XML::Atom::Person;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶use constant AS => 'http://activitystrea.ms/spec/1.0/';
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use constant ATOM => 'http://www.w3.org/2005/Atom';
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use constant FH => 'http://purl.org/syndication/history/1.0';
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use constant THR => 'http://purl.org/syndication/thread/1.0';
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use constant XHTML => 'http://www.w3.org/1999/xhtml';
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 25 ▶sub AWOL { return 'http://bblfish.net/work/atom-owl/2006-06-06/#' . shift; }
Subroutine AWOL: called CC=1 SCAR=0.0
23 3 ▶sub AAIR { return 'http://xmlns.notu.be/aair#' . shift; }
Subroutine AAIR: called CC=1 SCAR=0.0
24 4 ▶sub AX { return 'http://buzzword.org.uk/rdf/atomix#' . shift; }
Subroutine AX: called CC=1 SCAR=0.0
25 sub FOAF { return 'http://xmlns.com/foaf/0.1/' . shift; }
26 sub HNEWS { return 'http://ontologi.es/hnews#' . shift; }
27 sub LINK { return 'http://www.iana.org/assignments/relation/' . shift; }
28 sub RDF { return 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' . shift; }
29 sub XSD { return 'http://www.w3.org/2001/XMLSchema#' . shift; }
30  
31 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 1 our ($AUTHORITY, $VERSION);
34 1 our (%feed_dispatch, %entry_dispatch);
35  
36 BEGIN
37 1 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
38 1 $AUTHORITY = 'cpan:TOBYINK';
39 1 $VERSION = '0.102';
40  
41 %feed_dispatch = (
42 0 ▶ AWOL('Feed') => sub {},
Subroutine __ANON__: not called CC=1 SCAR=0.0
43 1 AWOL('entry') => \&_export_feed_entry,
44 AWOL('id') => \&_export_thing_id,
45 AWOL('title') => \&_export_thing_TextConstruct,
46 AWOL('subtitle') => \&_export_thing_TextConstruct,
47 AWOL('rights') => \&_export_thing_TextConstruct,
48 AWOL('updated') => \&_export_thing_DateConstruct,
49 AWOL('icon') => \&_export_thing_ImageConstruct,
50 AWOL('logo') => \&_export_thing_ImageConstruct,
51 AWOL('link') => \&_export_thing_link,
52 AWOL('author') => \&_export_thing_PersonConstruct,
53 AWOL('contributor') => \&_export_thing_PersonConstruct,
54 AWOL('category') => \&_export_thing_category,
55 AX('ArchiveFeed') => \&_export_feed_fh_archive,
56 AX('CompleteFeed') => \&_export_feed_fh_complete,
57 );
58 %entry_dispatch = (
59 0 ▶ AWOL('Entry') => sub {},
Subroutine __ANON__: not called CC=1 SCAR=0.0
60 1 AWOL('id') => \&_export_thing_id,
61 AWOL('title') => \&_export_thing_TextConstruct,
62 AWOL('summary') => \&_export_thing_TextConstruct,
63 AWOL('rights') => \&_export_thing_TextConstruct,
64 AWOL('published') => \&_export_thing_DateConstruct,
65 AWOL('updated') => \&_export_thing_DateConstruct,
66 AWOL('link') => \&_export_thing_link,
67 AWOL('author') => \&_export_thing_PersonConstruct,
68 AWOL('contributor') => \&_export_thing_PersonConstruct,
69 AWOL('category') => \&_export_thing_category,
70 AWOL('content') => \&_export_entry_content,
71 AX('total') => \&_export_entry_thr_total,
72 AX('in-reply-to') => \&_export_entry_thr_in_reply_to,
73 AAIR('activityVerb') => \&_export_entry_as_verb,
74 AAIR('activityObject') => \&_export_entry_as_ObjectConstruct,
75 AAIR('activityTarget') => \&_export_entry_as_ObjectConstruct,
76 'http://activitystrea.ms/schema/1.0/*' => \&_export_entry_as_object_type,
77 # TODO:- atom:source
78 );
79 }
80  
81 sub new
82 0 ▶{
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
83 0 my ($class, %options) = @_;
84 0 bless { %options }, $class;
85 }
86  
87 sub export_feeds
88 0 ▶{
Subroutine export_feeds: not called CC=5 SCAR=34.0
Pod documented
89 0 my ($self, $model, %options) = @_;
90 0 ▶ $model = rdf_parse($model)
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($model) and $model->isa("RDF::Trine::Model") 0 0 0
Condition0%0/3
builtin::blessed($model) and $model->isa("RDF::Trine::Model")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($model) and $model->isa("RDF::Trine::Model")
builtin::blessed($model) $model->isa("RDF::Trine::Model")
Truth table0%0/3
A and B
A= builtin::blessed($model)B= $model->isa("RDF::Trine::Model")
ABresult
0X0
100
111
91 unless blessed($model) && $model->isa('RDF::Trine::Model');
92
93 0 my @subjects = $model->subjects(rdf_resource(RDF('type')), rdf_resource(AWOL('Feed')));
94  
95 0 my @feeds;
96 0 foreach my $s (@subjects)
97 {
98 0 push @feeds, $self->export_feed($model, $s, %options);
99 }
100
101 0 ▶ if ($options{sort} eq 'id')
Branch: 1 branch
BranchTrueFalseTotal
if ($options{"sort"} eq "id") 0 0 0
102 {
103 0 return sort { $a->id cmp $b->id } @feeds;
104 }
105 0 return @feeds;
106 }
107  
108 sub export_entries
109 0 ▶{
Subroutine export_entries: not called CC=5 SCAR=34.0
Pod documented
110 0 my ($self, $model, %options) = @_;
111 0 ▶ $model = rdf_parse($model)
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($model) and $model->isa("RDF::Trine::Model") 0 0 0
Condition0%0/3
builtin::blessed($model) and $model->isa("RDF::Trine::Model")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($model) and $model->isa("RDF::Trine::Model")
builtin::blessed($model) $model->isa("RDF::Trine::Model")
Truth table0%0/3
A and B
A= builtin::blessed($model)B= $model->isa("RDF::Trine::Model")
ABresult
0X0
100
111
112 unless blessed($model) && $model->isa('RDF::Trine::Model');
113
114 0 my @subjects = $model->subjects(rdf_resource(RDF('type')), rdf_resource(AWOL('Entry')));
115  
116 0 my @entries;
117 0 foreach my $s (@subjects)
118 {
119 0 push @entries, $self->export_feed($model, $s, %options);
120 }
121
122 0 ▶ if ($options{sort} eq 'id')
Branch: 1 branch
BranchTrueFalseTotal
if ($options{"sort"} eq "id") 0 0 0
123 {
124 0 return sort { $a->id cmp $b->id } @entries;
125 }
126 0 return @entries;
127 }
128  
129 sub export_feed
130 0 ▶{
Subroutine export_feed: not called CC=15 SCAR=54.8
Pod documented
131 0 my ($self, $model, $subject, %options) = @_;
132 0 ▶ $model = rdf_parse($model)
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($model) and $model->isa("RDF::Trine::Model") 0 0 0
Condition0%0/3
builtin::blessed($model) and $model->isa("RDF::Trine::Model")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($model) and $model->isa("RDF::Trine::Model")
builtin::blessed($model) $model->isa("RDF::Trine::Model")
Truth table0%0/3
A and B
A= builtin::blessed($model)B= $model->isa("RDF::Trine::Model")
ABresult
0X0
100
111
133 unless blessed($model) && $model->isa('RDF::Trine::Model');
134
135 0 my $feed = XML::Atom::Feed->new(Version => 1.0);
136  
137 0 my $attr = {
138 version => $VERSION,
139 uri => 'https://metacpan.org/release/'.__PACKAGE__,
140 };
141 0 $attr->{uri} =~ s/::/-/g;
142 0 $feed->set(ATOM(), 'generator', __PACKAGE__, $attr, 1);
143  
144 0 my $extra_links = {};
145 0 my $triples = $model->get_statements($subject, undef, undef);
146 0 ▶ while (my $triple = $triples->next)
Branch: 1 branch
BranchTrueFalseTotal
if (my $triple = $triples->next) 0 0 0
147 {
148 0 ▶ next unless $triple->rdf_compatible;
Branch: 1 branch
BranchTrueFalseTotal
unless $triple->rdf_compatible 0 0 0
149
150 0 ▶ if (defined $feed_dispatch{$triple->predicate->uri}
Branch: 4 branches
BranchTrueFalseTotal
if (defined $XML::Atom::FromOWL::feed_dispatch{$triple->predicate->uri} and ref $XML::Atom::FromOWL::feed_dispatch{$triple->predicate->uri} eq 'CODE') { } 0 0 0
elsif ($triple->predicate->uri eq RDF('type') and $triple->object->is_resource and defined $XML::Atom::FromOWL::feed_dispatch{$triple->object->uri} and ref $XML::Atom::FromOWL::feed_dispatch{$triple->object->uri} eq 'CODE') { } 0 0 0
elsif ($triple->object->is_resource) { } 0 0 0
elsif ($triple->object->is_literal) { } 0 0 0
Condition0%0/3
defined $XML::Atom::FromOWL::feed_dispatch{$triple->predicate->uri} and ref $XML::Atom::FromOWL::feed_dispatch{$triple->predicate->uri} eq "CODE"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $XML::Atom::FromOWL::feed_dispatch{$triple->predicate->uri} and ref $XML::Atom::FromOWL::feed_dispatch{$triple->predicate->uri} eq "CODE"
defined $XML::Atom::FromOWL::feed_dispatch{$triple->predicate->uri} ref $XML::Atom::FromOWL::feed_dispatch{$triple->predicate->uri} eq "CODE"
Truth table0%0/3
A and B
A= defined $XML::Atom::FromOWL::feed_dispatch{$triple->predicate->uri}B= ref $XML::Atom::FromOWL::feed_dispatch{$triple->predicate->uri} eq "CODE"
ABresult
0X0
100
111
151 and ref($feed_dispatch{$triple->predicate->uri}) eq 'CODE')
152 {
153 0 my $code = $feed_dispatch{$triple->predicate->uri};
154 0 $code->($self, $feed, $model, $triple, %options);
155 }
156 ▶ elsif ($triple->predicate->uri eq RDF('type')
Condition0%0/9
$triple->predicate->uri eq RDF("type") and $triple->object->is_resource and defined $XML::Atom::FromOWL::feed_dispatch{$triple->object->uri} and ref $XML::Atom::FromOWL::feed_dispatch{$triple->object->uri} eq "CODE"
!ll&&!rl&&r
000
$triple->predicate->uri eq RDF("type") and $triple->object->is_resource and defined $XML::Atom::FromOWL::feed_dispatch{$triple->object->uri}
!ll&&!rl&&r
000
$triple->predicate->uri eq RDF("type") and $triple->object->is_resource
!ll&&!rl&&r
000
MC/DC0%0/4
$triple->predicate->uri eq RDF("type") and $triple->object->is_resource and defined $XML::Atom::FromOWL::feed_dispatch{$triple->object->uri} and ref $XML::Atom::FromOWL::feed_dispatch{$triple->object->uri} eq "CODE"
$triple->predicate->uri eq RDF("type") $triple->object->is_resource defined $XML::Atom::FromOWL::feed_dispatch{$triple->object->uri} ref $XML::Atom::FromOWL::feed_dispatch{$triple->object->uri} eq "CODE"
Truth table0%0/5
A and B and C and D
A= $triple->predicate->uri eq RDF("type")B= $triple->object->is_resourceC= defined $XML::Atom::FromOWL::feed_dispatch{$triple->object->uri}D= ref $XML::Atom::FromOWL::feed_dispatch{$triple->object->uri} eq "CODE"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
157 and $triple->object->is_resource
158 and defined $feed_dispatch{$triple->object->uri}
159 and ref($feed_dispatch{$triple->object->uri}) eq 'CODE')
160 {
161 0 my $code = $feed_dispatch{$triple->object->uri};
162 0 $code->($self, $feed, $model, $triple, %options);
163 }
164 elsif ($triple->object->is_resource)
165 {
166 0 my $rel = $triple->predicate->uri;
167 0 $rel =~ s'^http://www\.iana\.org/assignments/relation/'';
168 0 ▶ $extra_links->{$rel} ||= {};
Condition0%0/2
$extra_links->{$rel} ||= {}
l!l
00
MC/DC0%0/1
$extra_links->{$rel} ||= {}
$extra_links->{$rel}
Truth table0%0/2
A
A= $extra_links->{$rel}
Aresult
11
00
169 0 $extra_links->{$rel}{$triple->object->uri}++;
170 }
171 elsif ($triple->object->is_literal)
172 {
173 0 $self->_export_thing_LiteralValue($feed, $model, $triple, %options);
174 }
175 }
176  
177 0 $self->_process_extra_links($feed, $model, $extra_links, %options);
178 0 ▶ $feed->id( $self->_make_id ) unless $feed->id;
Branch: 1 branch
BranchTrueFalseTotal
unless $feed->id 0 0 0
179  
180 0 return $feed;
181 }
182  
183 sub export_entry
184 0 ▶{
Subroutine export_entry: not called CC=19 SCAR=59.4
Pod documented
185 0 my ($self, $model, $subject, %options) = @_;
186 0 ▶ $model = rdf_parse($model)
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($model) and $model->isa("RDF::Trine::Model") 0 0 0
Condition0%0/3
builtin::blessed($model) and $model->isa("RDF::Trine::Model")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($model) and $model->isa("RDF::Trine::Model")
builtin::blessed($model) $model->isa("RDF::Trine::Model")
Truth table0%0/3
A and B
A= builtin::blessed($model)B= $model->isa("RDF::Trine::Model")
ABresult
0X0
100
111
187 unless blessed($model) && $model->isa('RDF::Trine::Model');
188
189 0 my $entry = XML::Atom::Entry->new(Version => 1.0);
190  
191 0 my $extra_links;
192 0 my $triples = $model->get_statements($subject, undef, undef);
193 0 ▶ while (my $triple = $triples->next)
Branch: 1 branch
BranchTrueFalseTotal
if (my $triple = $triples->next) 0 0 0
194 {
195 0 ▶ next unless $triple->rdf_compatible;
Branch: 1 branch
BranchTrueFalseTotal
unless $triple->rdf_compatible 0 0 0
196
197 0 ▶ if (defined $entry_dispatch{$triple->predicate->uri}
Branch: 5 branches
BranchTrueFalseTotal
if (defined $XML::Atom::FromOWL::entry_dispatch{$triple->predicate->uri} and ref $XML::Atom::FromOWL::entry_dispatch{$triple->predicate->uri} eq 'CODE') { } 0 0 0
elsif ($triple->predicate->uri eq RDF('type') and $triple->object->is_resource and defined $XML::Atom::FromOWL::entry_dispatch{$triple->object->uri} and ref $XML::Atom::FromOWL::entry_dispatch{$triple->object->uri} eq 'CODE') { } 0 0 0
elsif ($triple->predicate->uri eq RDF('type') and $triple->object->is_resource and defined $XML::Atom::FromOWL::entry_dispatch{($triple->object->qname)[0] . '*'} and ref $XML::Atom::FromOWL::entry_dispatch{($triple->object->qname)[0] . '*'} eq 'CODE') { } 0 0 0
elsif ($triple->object->is_resource) { } 0 0 0
elsif ($triple->object->is_literal) { } 0 0 0
Condition0%0/3
defined $XML::Atom::FromOWL::entry_dispatch{$triple->predicate->uri} and ref $XML::Atom::FromOWL::entry_dispatch{$triple->predicate->uri} eq "CODE"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $XML::Atom::FromOWL::entry_dispatch{$triple->predicate->uri} and ref $XML::Atom::FromOWL::entry_dispatch{$triple->predicate->uri} eq "CODE"
defined $XML::Atom::FromOWL::entry_dispatch{$triple->predicate->uri} ref $XML::Atom::FromOWL::entry_dispatch{$triple->predicate->uri} eq "CODE"
Truth table0%0/3
A and B
A= defined $XML::Atom::FromOWL::entry_dispatch{$triple->predicate->uri}B= ref $XML::Atom::FromOWL::entry_dispatch{$triple->predicate->uri} eq "CODE"
ABresult
0X0
100
111
198 and ref($entry_dispatch{$triple->predicate->uri}) eq 'CODE')
199 {
200 0 my $code = $entry_dispatch{$triple->predicate->uri};
201 0 $code->($self, $entry, $model, $triple, %options);
202 }
203 ▶ elsif ($triple->predicate->uri eq RDF('type')
Condition0%0/9
$triple->predicate->uri eq RDF("type") and $triple->object->is_resource and defined $XML::Atom::FromOWL::entry_dispatch{$triple->object->uri} and ref $XML::Atom::FromOWL::entry_dispatch{$triple->object->uri} eq "CODE"
!ll&&!rl&&r
000
$triple->predicate->uri eq RDF("type") and $triple->object->is_resource and defined $XML::Atom::FromOWL::entry_dispatch{$triple->object->uri}
!ll&&!rl&&r
000
$triple->predicate->uri eq RDF("type") and $triple->object->is_resource
!ll&&!rl&&r
000
MC/DC0%0/4
$triple->predicate->uri eq RDF("type") and $triple->object->is_resource and defined $XML::Atom::FromOWL::entry_dispatch{$triple->object->uri} and ref $XML::Atom::FromOWL::entry_dispatch{$triple->object->uri} eq "CODE"
$triple->predicate->uri eq RDF("type") $triple->object->is_resource defined $XML::Atom::FromOWL::entry_dispatch{$triple->object->uri} ref $XML::Atom::FromOWL::entry_dispatch{$triple->object->uri} eq "CODE"
Truth table0%0/5
A and B and C and D
A= $triple->predicate->uri eq RDF("type")B= $triple->object->is_resourceC= defined $XML::Atom::FromOWL::entry_dispatch{$triple->object->uri}D= ref $XML::Atom::FromOWL::entry_dispatch{$triple->object->uri} eq "CODE"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
204 and $triple->object->is_resource
205 and defined $entry_dispatch{$triple->object->uri}
206 and ref($entry_dispatch{$triple->object->uri}) eq 'CODE')
207 {
208 0 my $code = $entry_dispatch{$triple->object->uri};
209 0 $code->($self, $entry, $model, $triple, %options);
210 }
211 ▶ elsif ($triple->predicate->uri eq RDF('type')
Condition0%0/9
$triple->predicate->uri eq RDF("type") and $triple->object->is_resource and defined $XML::Atom::FromOWL::entry_dispatch{($triple->object->qname)[0] . '*'} and ref $XML::Atom::FromOWL::entry_dispatch{($triple->object->qname)[0] . '*'} eq "CODE"
!ll&&!rl&&r
000
$triple->predicate->uri eq RDF("type") and $triple->object->is_resource and defined $XML::Atom::FromOWL::entry_dispatch{($triple->object->qname)[0] . '*'}
!ll&&!rl&&r
000
$triple->predicate->uri eq RDF("type") and $triple->object->is_resource
!ll&&!rl&&r
000
MC/DC0%0/4
$triple->predicate->uri eq RDF("type") and $triple->object->is_resource and defined $XML::Atom::FromOWL::entry_dispatch{($triple->object->qname)[0] . '*'} and ref $XML::Atom::FromOWL::entry_dispatch{($triple->object->qname)[0] . '*'} eq "CODE"
$triple->predicate->uri eq RDF("type") $triple->object->is_resource defined $XML::Atom::FromOWL::entry_dispatch{($triple->object->qname)[0] . '*'} ref $XML::Atom::FromOWL::entry_dispatch{($triple->object->qname)[0] . '*'} eq "CODE"
Truth table0%0/5
A and B and C and D
A= $triple->predicate->uri eq RDF("type")B= $triple->object->is_resourceC= defined $XML::Atom::FromOWL::entry_dispatch{($triple->object->qname)[0] . '*'}D= ref $XML::Atom::FromOWL::entry_dispatch{($triple->object->qname)[0] . '*'} eq "CODE"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
212 and $triple->object->is_resource
213 and defined $entry_dispatch{ ($triple->object->qname)[0] . '*' }
214 and ref($entry_dispatch{ ($triple->object->qname)[0] . '*' }) eq 'CODE')
215 {
216 0 my $code = $entry_dispatch{ ($triple->object->qname)[0] . '*' };
217 0 $code->($self, $entry, $model, $triple, %options);
218 }
219 elsif ($triple->object->is_resource)
220 {
221 0 my $rel = $triple->predicate->uri;
222 0 $rel =~ s'^http://www\.iana\.org/assignments/relation/'';
223 0 ▶ $extra_links->{$rel} ||= {};
Condition0%0/2
$extra_links->{$rel} ||= {}
l!l
00
MC/DC0%0/1
$extra_links->{$rel} ||= {}
$extra_links->{$rel}
Truth table0%0/2
A
A= $extra_links->{$rel}
Aresult
11
00
224 0 $extra_links->{$rel}{$triple->object->uri}++;
225 }
226 elsif ($triple->object->is_literal)
227 {
228 0 $self->_export_thing_LiteralValue($entry, $model, $triple, %options);
229 }
230 }
231  
232 0 $self->_process_extra_links($entry, $model, $extra_links, %options);
233 0 ▶ $entry->id( $self->_make_id ) unless $entry->id;
Branch: 1 branch
BranchTrueFalseTotal
unless $entry->id 0 0 0
234  
235 0 return $entry;
236 }
237  
238 sub _process_extra_links
239 0 ▶{
Subroutine _process_extra_links: not called CC=7 SCAR=40.3
240 0 my ($self, $thing, $model, $extras, %options) = @_;
241 0 ▶ return unless keys %$extras;
Branch: 1 branch
BranchTrueFalseTotal
unless keys %$extras 0 0 0
242
243 0 my $already = {};
244 0 foreach my $link ($thing->links)
245 {
246 0 ▶ $already->{$link->rel} ||= {};
Condition0%0/2
$$already{$link->rel} ||= {}
l!l
00
MC/DC0%0/1
$$already{$link->rel} ||= {}
$$already{$link->rel}
Truth table0%0/2
A
A= $$already{$link->rel}
Aresult
11
00
247 0 $already->{$link->rel}{$link->href}++;
248 }
249
250 0 PRED: foreach my $predicate (keys %$extras)
251 {
252 0 OBJ: foreach my $object (keys %{ $extras->{$predicate} })
253 {
254 0 ▶ next OBJ if $already->{$predicate}{$object};
Branch: 1 branch
BranchTrueFalseTotal
if $already->{$predicate}{$object} 0 0 0
255 0 my $link = XML::Atom::Link->new(Version => 1.0);
256 0 $link->rel($predicate);
257 0 $link->href($object);
258 0 $thing->add_link($link);
259 }
260 }
261 }
262  
263 sub _export_thing_LiteralValue
264 0 ▶{
Subroutine _export_thing_LiteralValue: not called CC=4 SCAR=30.0
265 0 my ($self, $thing, $model, $triple, %options) = @_;
266 0 my $ns = XML::Atom::Namespace->new(xhtml => XHTML);
267  
268 0 ▶ if ($triple->object->is_literal)
Branch: 1 branch
BranchTrueFalseTotal
if ($triple->object->is_literal) 0 0 0
269 {
270 0 my $attr = {
271 content => $triple->object->literal_value,
272 property => $triple->predicate->uri,
273 };
274 0 ▶ $attr->{'xml:lang'} = $triple->object->literal_value_language
Branch: 1 branch
BranchTrueFalseTotal
if $triple->object->has_language 0 0 0
275 if $triple->object->has_language;
276 0 ▶ $attr->{'datatype'} = $triple->object->literal_datatype
Branch: 1 branch
BranchTrueFalseTotal
if $triple->object->has_datatype 0 0 0
277 if $triple->object->has_datatype;
278 0 $thing->set_attr(typeof => '');
279 0 return $thing->set($ns, 'meta', undef, $attr, 1);
280 }
281 }
282  
283 sub _export_feed_entry
284 0 ▶{
Subroutine _export_feed_entry: not called CC=1 SCAR=6.9
285 0 my ($self, $feed, $model, $triple, %options) = @_;
286 0 my $entry = $self->export_entry($model, $triple->object, %options);
287 0 $feed->add_entry($entry);
288 }
289  
290 sub _export_feed_fh_archive
291 0 ▶{
Subroutine _export_feed_fh_archive: not called CC=1 SCAR=6.9
292 0 my ($self, $feed, $model, $triple, %options) = @_;
293 0 return $feed->set(FH, 'archive');
294 }
295  
296 sub _export_feed_fh_complete
297 0 ▶{
Subroutine _export_feed_fh_complete: not called CC=1 SCAR=6.9
298 0 my ($self, $feed, $model, $triple, %options) = @_;
299 0 return $feed->set(FH, 'complete');
300 }
301  
302 sub _export_entry_thr_total
303 0 ▶{
Subroutine _export_entry_thr_total: not called CC=2 SCAR=17.9
304 0 my ($self, $entry, $model, $triple, %options) = @_;
305 0 ▶ return $entry->set(THR, 'total', $triple->object->literal_value)
Branch: 1 branch
BranchTrueFalseTotal
if $triple->object->is_literal 0 0 0
306 if $triple->object->is_literal;
307 }
308  
309 sub _export_entry_thr_in_reply_to
310 0 ▶{
Subroutine _export_entry_thr_in_reply_to: not called CC=9 SCAR=45.0
311 0 my ($self, $entry, $model, $triple, %options) = @_;
312 0 my $attr;
313
314 0 my $iter = $model->get_statements($triple->object);
315 0 ▶ while (my $st = $iter->next)
Branch: 1 branch
BranchTrueFalseTotal
if (my $st = $iter->next) 0 0 0
316 {
317 0 ▶ if ($st->predicate->uri eq LINK('self')
Branch: 3 branches
BranchTrueFalseTotal
if ($st->predicate->uri eq LINK('self') and $st->object->is_resource) { } 0 0 0
elsif ($st->predicate->uri eq AWOL('id') and not $st->object->is_blank) { } 0 0 0
elsif ($st->predicate->uri eq AWOL('source')) { } 0 0 0
Condition0%0/3
$st->predicate->uri eq LINK("self") and $st->object->is_resource
!ll&&!rl&&r
000
MC/DC0%0/2
$st->predicate->uri eq LINK("self") and $st->object->is_resource
$st->predicate->uri eq LINK("self") $st->object->is_resource
Truth table0%0/3
A and B
A= $st->predicate->uri eq LINK("self")B= $st->object->is_resource
ABresult
0X0
100
111
318 and $st->object->is_resource)
319 {
320 0 $attr->{href} = $st->object->uri;
321 }
322 ▶ elsif ($st->predicate->uri eq AWOL('id')
Condition0%0/3
$st->predicate->uri eq AWOL("id") and not $st->object->is_blank
!ll&&!rl&&r
000
MC/DC0%0/2
$st->predicate->uri eq AWOL("id") and not $st->object->is_blank
$st->predicate->uri eq AWOL("id") not $st->object->is_blank
Truth table0%0/3
A and not(B)
A= $st->predicate->uri eq AWOL("id")B= not $st->object->is_blank
ABresult
0X0
100
111
323 and !$st->object->is_blank)
324 {
325 0 $attr->{ref} = flatten_node($st->object);
326 }
327 elsif ($st->predicate->uri eq AWOL('source'))
328 {
329 0 my $iter2 = $model->get_statements($st->object, rdf_resource(LINK('self')));
330 0 ▶ while (my $st2 = $iter2->next)
Branch: 1 branch
BranchTrueFalseTotal
if (my $st2 = $iter2->next) 0 0 0
331 {
332 0 ▶ if ($st2->object->is_resource)
Branch: 1 branch
BranchTrueFalseTotal
if ($st2->object->is_resource) 0 0 0
333 {
334 0 $attr->{source} = $st2->object->uri;
335 }
336 }
337 }
338 }
339
340 0 return $entry->set(THR, 'in-reply-to', undef, $attr);
341 }
342  
343 sub _export_thing_id
344 0 ▶{
Subroutine _export_thing_id: not called CC=2 SCAR=17.9
345 0 my ($self, $thing, $model, $triple, %options) = @_;
346 0 ▶ unless ($triple->object->is_blank)
Branch: 1 branch
BranchTrueFalseTotal
unless ($triple->object->is_blank) 0 0 0
347 {
348 0 return $thing->id( flatten_node($triple->object) );
349 }
350 }
351  
352 sub _export_thing_link
353 0 ▶{
Subroutine _export_thing_link: not called CC=12 SCAR=50.5
354 0 my ($self, $thing, $model, $triple, %options) = @_;
355
356 0 my $link = XML::Atom::Link->new(Version => 1.0);
357
358 0 my $iter = $model->get_statements($triple->object);
359 0 ▶ while (my $st = $iter->next)
Branch: 1 branch
BranchTrueFalseTotal
if (my $st = $iter->next) 0 0 0
360 {
361 0 ▶ if ($st->predicate->uri eq AWOL('rel')
Branch: 2 branches
BranchTrueFalseTotal
if ($st->predicate->uri eq AWOL('rel') and $st->object->is_resource) { } 0 0 0
elsif ($st->predicate->uri eq AWOL('to')) { } 0 0 0
Condition0%0/3
$st->predicate->uri eq AWOL("rel") and $st->object->is_resource
!ll&&!rl&&r
000
MC/DC0%0/2
$st->predicate->uri eq AWOL("rel") and $st->object->is_resource
$st->predicate->uri eq AWOL("rel") $st->object->is_resource
Truth table0%0/3
A and B
A= $st->predicate->uri eq AWOL("rel")B= $st->object->is_resource
ABresult
0X0
100
111
362 and $st->object->is_resource)
363 {
364 0 (my $rel = $st->object->uri)
365 =~ s'^http://www\.iana\.org/assignments/relation/'';
366 0 $link->rel($rel);
367 }
368 elsif ($st->predicate->uri eq AWOL('to'))
369 {
370 0 my $iter2 = $model->get_statements($st->object);
371 0 ▶ while (my $st2 = $iter2->next)
Branch: 1 branch
BranchTrueFalseTotal
if (my $st2 = $iter2->next) 0 0 0
372 {
373 0 ▶ if ($st2->predicate->uri eq AWOL('type')
Branch: 3 branches
BranchTrueFalseTotal
if ($st2->predicate->uri eq AWOL('type') and $st2->object->is_literal) { } 0 0 0
elsif ($st2->predicate->uri eq AWOL('src') and not $st2->object->is_blank) { } 0 0 0
elsif ($st2->predicate->uri eq AWOL('lang') and $st2->object->is_literal) { } 0 0 0
Condition0%0/3
$st2->predicate->uri eq AWOL("type") and $st2->object->is_literal
!ll&&!rl&&r
000
MC/DC0%0/2
$st2->predicate->uri eq AWOL("type") and $st2->object->is_literal
$st2->predicate->uri eq AWOL("type") $st2->object->is_literal
Truth table0%0/3
A and B
A= $st2->predicate->uri eq AWOL("type")B= $st2->object->is_literal
ABresult
0X0
100
111
374 and $st2->object->is_literal)
375 {
376 0 $link->type(flatten_node($st2->object));
377 }
378 ▶ elsif ($st2->predicate->uri eq AWOL('src')
Condition0%0/3
$st2->predicate->uri eq AWOL("src") and not $st2->object->is_blank
!ll&&!rl&&r
000
MC/DC0%0/2
$st2->predicate->uri eq AWOL("src") and not $st2->object->is_blank
$st2->predicate->uri eq AWOL("src") not $st2->object->is_blank
Truth table0%0/3
A and not(B)
A= $st2->predicate->uri eq AWOL("src")B= not $st2->object->is_blank
ABresult
0X0
100
111
379 and !$st2->object->is_blank)
380 {
381 0 $link->href(flatten_node($st2->object));
382 }
383 ▶ elsif ($st2->predicate->uri eq AWOL('lang')
Condition0%0/3
$st2->predicate->uri eq AWOL("lang") and $st2->object->is_literal
!ll&&!rl&&r
000
MC/DC0%0/2
$st2->predicate->uri eq AWOL("lang") and $st2->object->is_literal
$st2->predicate->uri eq AWOL("lang") $st2->object->is_literal
Truth table0%0/3
A and B
A= $st2->predicate->uri eq AWOL("lang")B= $st2->object->is_literal
ABresult
0X0
100
111
384 and $st2->object->is_literal)
385 {
386 0 $link->hreflang(flatten_node($st2->object));
387 }
388 }
389 }
390 }
391
392 0 return $thing->add_link($link);
393 }
394  
395 sub _export_thing_PersonConstruct
396 0 ▶{
Subroutine _export_thing_PersonConstruct: not called CC=10 SCAR=47.0
397 0 my ($self, $thing, $model, $triple, %options) = @_;
398
399 0 my $person = XML::Atom::Person->new(Version => 1.0);
400
401 0 my $iter = $model->get_statements($triple->object);
402 0 ▶ while (my $st = $iter->next)
Branch: 1 branch
BranchTrueFalseTotal
if (my $st = $iter->next) 0 0 0
403 {
404 0 ▶ if ($st->predicate->uri eq AWOL('email')
Branch: 3 branches
BranchTrueFalseTotal
if ($st->predicate->uri eq AWOL('email') and not $st->object->is_blank) { } 0 0 0
elsif ($st->predicate->uri eq AWOL('uri') and not $st->object->is_blank) { } 0 0 0
elsif ($st->predicate->uri eq AWOL('name') and $st->object->is_literal) { } 0 0 0
Condition0%0/3
$st->predicate->uri eq AWOL("email") and not $st->object->is_blank
!ll&&!rl&&r
000
MC/DC0%0/2
$st->predicate->uri eq AWOL("email") and not $st->object->is_blank
$st->predicate->uri eq AWOL("email") not $st->object->is_blank
Truth table0%0/3
A and not(B)
A= $st->predicate->uri eq AWOL("email")B= not $st->object->is_blank
ABresult
0X0
100
111
405 and !$st->object->is_blank)
406 {
407 0 (my $e = flatten_node($st->object)) =~ s'^mailto:'';
408 0 $person->email($e);
409 }
410 ▶ elsif ($st->predicate->uri eq AWOL('uri')
Condition0%0/3
$st->predicate->uri eq AWOL("uri") and not $st->object->is_blank
!ll&&!rl&&r
000
MC/DC0%0/2
$st->predicate->uri eq AWOL("uri") and not $st->object->is_blank
$st->predicate->uri eq AWOL("uri") not $st->object->is_blank
Truth table0%0/3
A and not(B)
A= $st->predicate->uri eq AWOL("uri")B= not $st->object->is_blank
ABresult
0X0
100
111
411 and !$st->object->is_blank)
412 {
413 0 $person->url(flatten_node($st->object));
414 }
415 ▶ elsif ($st->predicate->uri eq AWOL('name')
Condition0%0/3
$st->predicate->uri eq AWOL("name") and $st->object->is_literal
!ll&&!rl&&r
000
MC/DC0%0/2
$st->predicate->uri eq AWOL("name") and $st->object->is_literal
$st->predicate->uri eq AWOL("name") $st->object->is_literal
Truth table0%0/3
A and B
A= $st->predicate->uri eq AWOL("name")B= $st->object->is_literal
ABresult
0X0
100
111
416 and $st->object->is_literal)
417 {
418 0 $person->name(flatten_node($st->object));
419 }
420 }
421
422 0 ▶ if ($triple->predicate->uri eq AWOL('contributor'))
Branch: 1 branch
BranchTrueFalseTotal
if ($triple->predicate->uri eq AWOL("contributor")) 0 0 0
423 {
424 0 return $thing->add_contributor($person);
425 }
426 0 ▶ if ($triple->predicate->uri eq AWOL('author'))
Branch: 1 branch
BranchTrueFalseTotal
if ($triple->predicate->uri eq AWOL("author")) 0 0 0
427 {
428 0 return $thing->add_author($person);
429 }
430 }
431  
432 sub _export_entry_content
433 0 ▶{
Subroutine _export_entry_content: not called CC=14 SCAR=53.5
434 0 my ($self, $entry, $model, $triple, %options) = @_;
435
436 0 my $content = XML::Atom::Content->new(Version => 1.0);
437 0 ▶ if ($triple->object->is_literal)
Branch: 1 branch
BranchTrueFalseTotal
if ($triple->object->is_literal) { } 0 0 0
438 {
439 0 $content->body(flatten_node($triple->object));
440 0 ▶ $content->lang($triple->object->literal_value_language)
Branch: 1 branch
BranchTrueFalseTotal
if $triple->object->has_language 0 0 0
441 if $triple->object->has_language;
442 }
443 else
444 {
445 0 my $iter = $model->get_statements($triple->object);
446 0 ▶ while (my $st = $iter->next)
Branch: 1 branch
BranchTrueFalseTotal
if (my $st = $iter->next) 0 0 0
447 {
448 0 ▶ if ($st->predicate->uri eq AWOL('base')
Branch: 5 branches
BranchTrueFalseTotal
if ($st->predicate->uri eq AWOL('base') and not $st->object->is_blank) { } 0 0 0
elsif ($st->predicate->uri eq AWOL('type') and $st->object->is_literal) { } 0 0 0
elsif ($st->predicate->uri eq AWOL('lang') and $st->object->is_literal) { } 0 0 0
elsif ($st->predicate->uri eq AWOL('body') and $st->object->is_literal) { } 0 0 0
elsif ($st->predicate->uri eq AWOL('src') and not $st->object->is_blank) { } 0 0 0
Condition0%0/3
$st->predicate->uri eq AWOL("base") and not $st->object->is_blank
!ll&&!rl&&r
000
MC/DC0%0/2
$st->predicate->uri eq AWOL("base") and not $st->object->is_blank
$st->predicate->uri eq AWOL("base") not $st->object->is_blank
Truth table0%0/3
A and not(B)
A= $st->predicate->uri eq AWOL("base")B= not $st->object->is_blank
ABresult
0X0
100
111
449 and !$st->object->is_blank)
450 {
451 0 $content->base(flatten_node($st->object));
452 }
453 ▶ elsif ($st->predicate->uri eq AWOL('type')
Condition0%0/3
$st->predicate->uri eq AWOL("type") and $st->object->is_literal
!ll&&!rl&&r
000
MC/DC0%0/2
$st->predicate->uri eq AWOL("type") and $st->object->is_literal
$st->predicate->uri eq AWOL("type") $st->object->is_literal
Truth table0%0/3
A and B
A= $st->predicate->uri eq AWOL("type")B= $st->object->is_literal
ABresult
0X0
100
111
454 and $st->object->is_literal)
455 {
456 0 $content->type(flatten_node($st->object));
457 }
458 ▶ elsif ($st->predicate->uri eq AWOL('lang')
Condition0%0/3
$st->predicate->uri eq AWOL("lang") and $st->object->is_literal
!ll&&!rl&&r
000
MC/DC0%0/2
$st->predicate->uri eq AWOL("lang") and $st->object->is_literal
$st->predicate->uri eq AWOL("lang") $st->object->is_literal
Truth table0%0/3
A and B
A= $st->predicate->uri eq AWOL("lang")B= $st->object->is_literal
ABresult
0X0
100
111
459 and $st->object->is_literal)
460 {
461 0 $content->lang(flatten_node($st->object));
462 }
463 ▶ elsif ($st->predicate->uri eq AWOL('body')
Condition0%0/3
$st->predicate->uri eq AWOL("body") and $st->object->is_literal
!ll&&!rl&&r
000
MC/DC0%0/2
$st->predicate->uri eq AWOL("body") and $st->object->is_literal
$st->predicate->uri eq AWOL("body") $st->object->is_literal
Truth table0%0/3
A and B
A= $st->predicate->uri eq AWOL("body")B= $st->object->is_literal
ABresult
0X0
100
111
464 and $st->object->is_literal)
465 {
466 0 $content->body(flatten_node($st->object));
467 }
468 ▶ elsif ($st->predicate->uri eq AWOL('src')
Condition0%0/3
$st->predicate->uri eq AWOL("src") and not $st->object->is_blank
!ll&&!rl&&r
000
MC/DC0%0/2
$st->predicate->uri eq AWOL("src") and not $st->object->is_blank
$st->predicate->uri eq AWOL("src") not $st->object->is_blank
Truth table0%0/3
A and not(B)
A= $st->predicate->uri eq AWOL("src")B= not $st->object->is_blank
ABresult
0X0
100
111
469 and !$st->object->is_blank)
470 {
471 0 $content->set_attr(src => flatten_node($st->object));
472 }
473 }
474 }
475
476 0 return $entry->content($content);
477 }
478  
479 sub _export_thing_category
480 0 ▶{
Subroutine _export_thing_category: not called CC=10 SCAR=47.0
481 0 my ($self, $thing, $model, $triple, %options) = @_;
482
483 0 my $category = XML::Atom::Category->new(Version => 1.0);
484  
485 0 ▶ if ($triple->object->is_literal)
Branch: 1 branch
BranchTrueFalseTotal
if ($triple->object->is_literal) { } 0 0 0
486 {
487 0 $category->term(flatten_node($triple->object));
488 }
489 else
490 {
491 0 my $iter = $model->get_statements($triple->object);
492 0 ▶ while (my $st = $iter->next)
Branch: 1 branch
BranchTrueFalseTotal
if (my $st = $iter->next) 0 0 0
493 {
494 0 ▶ if ($st->predicate->uri eq AWOL('term')
Branch: 3 branches
BranchTrueFalseTotal
if ($st->predicate->uri eq AWOL('term') and $st->object->is_literal) { } 0 0 0
elsif ($st->predicate->uri eq AWOL('scheme') and not $st->object->is_blank) { } 0 0 0
elsif ($st->predicate->uri eq AWOL('label') and $st->object->is_literal) { } 0 0 0
Condition0%0/3
$st->predicate->uri eq AWOL("term") and $st->object->is_literal
!ll&&!rl&&r
000
MC/DC0%0/2
$st->predicate->uri eq AWOL("term") and $st->object->is_literal
$st->predicate->uri eq AWOL("term") $st->object->is_literal
Truth table0%0/3
A and B
A= $st->predicate->uri eq AWOL("term")B= $st->object->is_literal
ABresult
0X0
100
111
495 and $st->object->is_literal)
496 {
497 0 $category->term(flatten_node($st->object));
498 }
499 ▶ elsif ($st->predicate->uri eq AWOL('scheme')
Condition0%0/3
$st->predicate->uri eq AWOL("scheme") and not $st->object->is_blank
!ll&&!rl&&r
000
MC/DC0%0/2
$st->predicate->uri eq AWOL("scheme") and not $st->object->is_blank
$st->predicate->uri eq AWOL("scheme") not $st->object->is_blank
Truth table0%0/3
A and not(B)
A= $st->predicate->uri eq AWOL("scheme")B= not $st->object->is_blank
ABresult
0X0
100
111
500 and !$st->object->is_blank)
501 {
502 0 $category->scheme(flatten_node($st->object));
503 }
504 ▶ elsif ($st->predicate->uri eq AWOL('label')
Condition0%0/3
$st->predicate->uri eq AWOL("label") and $st->object->is_literal
!ll&&!rl&&r
000
MC/DC0%0/2
$st->predicate->uri eq AWOL("label") and $st->object->is_literal
$st->predicate->uri eq AWOL("label") $st->object->is_literal
Truth table0%0/3
A and B
A= $st->predicate->uri eq AWOL("label")B= $st->object->is_literal
ABresult
0X0
100
111
505 and $st->object->is_literal)
506 {
507 0 $category->label(flatten_node($st->object));
508 0 ▶ $category->set_attr('xml:lang', $st->object->literal_value_language)
Branch: 1 branch
BranchTrueFalseTotal
if $st->object->has_language 0 0 0
509 if $st->object->has_language;
510 }
511 }
512 }
513
514 0 return $thing->add_category($category);
515 }
516  
517 sub _export_thing_TextConstruct
518 0 ▶{
Subroutine _export_thing_TextConstruct: not called CC=7 SCAR=40.3
519 0 my ($self, $thing, $model, $triple, %options) = @_;
520  
521 my $tag = {
522 AWOL('title') => 'title',
523 AWOL('subtitle') => 'subtitle',
524 AWOL('summary') => 'summary',
525 AWOL('rights') => 'rights',
526 0 }->{$triple->predicate->uri};
527
528 0 ▶ if ($triple->object->is_literal)
Branch: 1 branch
BranchTrueFalseTotal
if ($triple->object->is_literal) { } 0 0 0
529 {
530 0 my $attr = { type=>'text' };
531 0 ▶ $attr->{'xml:lang'} = $triple->object->literal_value_language
Branch: 1 branch
BranchTrueFalseTotal
if $triple->object->has_language 0 0 0
532 if $triple->object->has_language;
533 0 return $thing->set(ATOM(), $tag, flatten_node($triple->object), $attr, 1);
534 }
535 else
536 {
537 0 foreach my $fmt (qw(text html xhtml)) # TODO: does 'xhtml' need special handling??
538 {
539 0 my $iter = $model->get_statements(
540 $triple->object,
541 rdf_resource(AWOL($fmt)),
542 undef,
543 );
544 0 ▶ while (my $st = $iter->next)
Branch: 1 branch
BranchTrueFalseTotal
if (my $st = $iter->next) 0 0 0
545 {
546 0 ▶ if ($st->object->is_literal)
Branch: 1 branch
BranchTrueFalseTotal
if ($st->object->is_literal) 0 0 0
547 {
548 0 my $attr = { type=>$fmt };
549 0 ▶ $attr->{'xml:lang'} = $st->object->literal_value_language
Branch: 1 branch
BranchTrueFalseTotal
if $st->object->has_language 0 0 0
550 if $st->object->has_language;
551 0 return $thing->set(ATOM(), $tag, flatten_node($st->object), $attr, 1);
552 }
553 }
554 }
555 }
556 }
557  
558 sub _export_thing_DateConstruct
559 0 ▶{
Subroutine _export_thing_DateConstruct: not called CC=2 SCAR=17.9
560 0 my ($self, $thing, $model, $triple, %options) = @_;
561  
562 my $tag = {
563 AWOL('published') => 'published',
564 AWOL('updated') => 'updated',
565 0 }->{$triple->predicate->uri};
566
567 0 ▶ if ($triple->object->is_literal)
Branch: 1 branch
BranchTrueFalseTotal
if ($triple->object->is_literal) 0 0 0
568 {
569 0 my $attr = {};
570 0 return $thing->set(ATOM(), $tag, flatten_node($triple->object), $attr, 1);
571 }
572 }
573  
574 sub _export_thing_ImageConstruct
575 0 ▶{
Subroutine _export_thing_ImageConstruct: not called CC=2 SCAR=17.9
576 0 my ($self, $thing, $model, $triple, %options) = @_;
577  
578 my $tag = {
579 AWOL('logo') => 'logo',
580 AWOL('icon') => 'icon',
581 0 }->{$triple->predicate->uri};
582
583 0 ▶ if ($triple->object->is_resource)
Branch: 1 branch
BranchTrueFalseTotal
if ($triple->object->is_resource) 0 0 0
584 {
585 0 my $attr = {};
586 0 return $thing->set(ATOM(), $tag, flatten_node($triple->object), $attr, 1);
587 }
588 }
589  
590 sub _export_entry_as_verb
591 0 ▶{
Subroutine _export_entry_as_verb: not called CC=2 SCAR=17.9
592 0 my ($self, $thing, $model, $triple, %options) = @_;
593  
594 0 ▶ if ($triple->object->is_resource)
Branch: 1 branch
BranchTrueFalseTotal
if ($triple->object->is_resource) 0 0 0
595 {
596 0 my $attr = {};
597 0 my $verb = flatten_node($triple->object);
598 0 $verb =~ s#^http://activitystrea\.ms/schema/1\.0/#./#;
599 0 return $thing->elem->addNewChild(AS(), 'as:verb')->appendText($verb);
600 }
601 }
602  
603 sub _export_entry_as_object_type
604 0 ▶{
Subroutine _export_entry_as_object_type: not called CC=2 SCAR=17.9
605 0 my ($self, $thing, $model, $triple, %options) = @_;
606  
607 0 ▶ if ($triple->object->is_resource)
Branch: 1 branch
BranchTrueFalseTotal
if ($triple->object->is_resource) 0 0 0
608 {
609 0 my $attr = {};
610 0 my $type = flatten_node($triple->object);
611 0 $type =~ s#^http://activitystrea\.ms/schema/1\.0/#./#;
612 0 return $thing->elem->addNewChild(AS(), 'as:object-type')->appendText($type);
613 }
614 }
615  
616 sub _export_entry_as_ObjectConstruct
617 0 ▶{
Subroutine _export_entry_as_ObjectConstruct: not called CC=4 SCAR=30.0
618 0 my ($self, $thing, $model, $triple, %options) = @_;
619  
620 my $tag = {
621 AAIR('activityObject') => 'object',
622 AAIR('activityTarget') => 'target',
623 0 }->{$triple->predicate->uri};
624
625 0 ▶ if ($triple->object->is_resource or $triple->object->is_blank)
Branch: 1 branch
BranchTrueFalseTotal
if ($triple->object->is_resource or $triple->object->is_blank) 0 0 0
Condition0%0/3
$triple->object->is_resource or $triple->object->is_blank
l!l&&r!l&&!r
000
MC/DC0%0/2
$triple->object->is_resource or $triple->object->is_blank
$triple->object->is_resource $triple->object->is_blank
Truth table0%0/3
A or B
A= $triple->object->is_resourceB= $triple->object->is_blank
ABresult
1X1
011
000
626 {
627 0 my $object_entry = $self->export_entry($model, $triple->object, %options);
628 0 my $node = $thing->elem->addNewChild(AS(), "as:$tag");
629 0 $node->appendChild($_->cloneNode(1)) for $object_entry->elem->childNodes;
630 0 return $node;
631 }
632 }
633  
634 sub _make_id
635 0 ▶{
Subroutine _make_id: not called CC=2 SCAR=17.9
636 0 my ($self) = @_;
637 0 ▶ $self->{uuid} ||= Data::UUID->new;
Condition0%0/3
$self->{"uuid"} ||= "Data::UUID"->new
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"uuid"} ||= "Data::UUID"->new
$self->{"uuid"} "Data::UUID"->new
Truth table0%0/3
A ||= B
A= $self->{"uuid"}B= "Data::UUID"->new
ABresult
1X1
011
000
638 0 return 'urn:uuid:'.$self->{uuid}->create_str;
639 }
640  
641 1 1;
642  
643 __END__
↑ Summary