| 1 | package RDF::vCard::Line; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.008; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | no warnings qw(uninitialized); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Encode; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use MIME::Base64; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use RDF::Trine::Namespace qw[xsd]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | use RDF::TrineX::Functions | ||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | -shortcuts, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | statement => { -as => 'rdf_statement' }, | ||||||||||||||||||||||||||||||||||||||||||
| 14 | literal => { -as => 'rdf_literal' }, | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | iri => { -as => 'rdf_resource' }; | |||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use URI::data; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 24 | ▶ | sub V { return 'http://www.w3.org/2006/vcard/ns#' . shift; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
V: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | sub VX { return 'http://buzzword.org.uk/rdf/vcardx#' . shift; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
VX: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | sub RDF { return 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' . shift; } | ||||||||||||||||||||||||||||||||||||||||||
| 21 | sub XSD { return 'http://www.w3.org/2001/XMLSchema#' . shift; } | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | ▶ | use overload '""' => \&to_string; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | our $VERSION = '0.012'; | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | sub new | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | my ($class, %options) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 31 | die "Need to provide a property name\n" | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | ▶ | unless defined $options{property}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | $options{value} = [$options{value}] | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | ▶ | unless ref $options{value} eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | ▶ | $options{type_parameters} ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$options{"type_parameters"} ||= []
MC/DC0%0/1
$options{"type_parameters"} ||= []
$options{"type_parameters"}
Truth table50%1/2
A
A= $options{"type_parameters"}
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | bless { %options }, $class; | |||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | sub property | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
property: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 42 | 3 | return $self->{property}; | |||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | sub value | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 2 | return $self->{value}; | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | sub nvalue | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nvalue: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 2 | my $value = $self->value; | |||||||||||||||||||||||||||||||||||||||||
| 55 | 2 | my @nvalue; | |||||||||||||||||||||||||||||||||||||||||
| 56 | 2 | foreach my $v (@$value) | |||||||||||||||||||||||||||||||||||||||||
| 57 | { | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 2 | ▶ | push @nvalue, (ref($v) eq 'ARRAY' ? $v : [$v]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 2 | return \@nvalue; | |||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | sub type_parameters | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 6 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type_parameters: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 6 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 6 | ▶ | $self->{type_parameters} = {} unless ref $self->{type_parameters} eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 6 | return $self->{type_parameters}; | |||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | sub property_order | ||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
property_order: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | my $p = lc $self->property; | |||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | return 0 if $p eq 'version'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | return 1 if $p eq 'prodid'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | return 2 if $p eq 'source'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | return 3 if $p eq 'kind'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | return 4 if $p eq 'fn'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | return 5 if $p eq 'n'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | return 6 if $p eq 'org'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | return $p; | |||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | sub to_string | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_string: called CC=6 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 2 | my $str = uc $self->property; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 2 | ▶ | if (keys %{ $self->type_parameters }) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | { | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 2 | foreach my $parameter (sort keys %{ $self->type_parameters }) | |||||||||||||||||||||||||||||||||||||||||
| 92 | { | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 2 | my $values = $self->type_parameters->{$parameter}; | |||||||||||||||||||||||||||||||||||||||||
| 94 | 2 | ▶ | $values = [$values] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | unless ref $values eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 2 | my $values_string = join ",", map { $self->_escape_value($_, is_tp=>1) } @$values; | |||||||||||||||||||||||||||||||||||||||||
| 97 | 2 | $str .= sprintf(";%s=%s", uc $parameter, $values_string); | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 2 | $str .= ":"; | |||||||||||||||||||||||||||||||||||||||||
| 101 | 2 | $str .= $self->value_to_string; | |||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 2 | ▶ | if (length $str > 75) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | { | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my $new = ''; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | while (length $str > 64) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | { | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $new .= substr($str, 0, 64) . "\r\n "; | |||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $str = substr($str, 64); | |||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | $new .= $str; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $str = $new; | |||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 2 | return $str; | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | sub value_to_string | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
value_to_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 121 | my $str = join ";", | ||||||||||||||||||||||||||||||||||||||||||
| 122 | map | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 2 | { join ",", map { $self->_escape_value($_) } @{$_}; } | |||||||||||||||||||||||||||||||||||||||||
| 124 | 2 | @{ $self->nvalue }; | |||||||||||||||||||||||||||||||||||||||||
| 125 | 2 | $str =~ s/;+$//; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 2 | return $str; | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | sub _escape_value | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 6 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_escape_value: called CC=3 SCAR=11.9
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 6 | my ($self, $value, %options) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 6 | ▶ | if ($options{is_tp} and $value =~ /[;:,"]/) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$options{"is_tp"} and $value =~ /[;:,"]/
MC/DC0%0/2
$options{"is_tp"} and $value =~ /[;:,"]/
$options{"is_tp"}
$value =~ /[;:,"]/
Truth table66%2/3
A and B
A= $options{"is_tp"}B= $value =~ /[;:,"]/
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | { | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $value =~ s/\\/\\\\/g; | |||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $value =~ s/\"/\\\"/g; | |||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | return sprintf('"%s"', $value); | |||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | 6 | $value =~ s/\\/\\\\/g; | |||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | 6 | $value =~ s/\r//g; | |||||||||||||||||||||||||||||||||||||||||
| 143 | 6 | $value =~ s/\n/\\n/g; | |||||||||||||||||||||||||||||||||||||||||
| 144 | 6 | $value =~ s/;/\\;/g; | |||||||||||||||||||||||||||||||||||||||||
| 145 | 6 | $value =~ s/,/\\,/g; | |||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 6 | return $value; | |||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | sub _unescape_value | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_unescape_value: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my ($self, $value, %options) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | $value =~ s/\\r//gi; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | $value =~ s/\\n/\n/gi; | |||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $value =~ s/\\;/;/g; | |||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $value =~ s/\\,/,/g; | |||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | $value =~ s/\\\\/\\/g; | |||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | return $value; | |||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | # RDF Export Stuff... | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | sub add_to_model | ||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_to_model: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my ($self, $model, $card_node) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | my $special_func = sprintf('_add_to_model_%s', uc $self->property); | |||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | if ($self->can($special_func)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | { | ||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | $self->$special_func($model, $card_node); | |||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | elsif ($self->property_node) | ||||||||||||||||||||||||||||||||||||||||||
| 176 | { | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $model->add_statement(rdf_statement( | |||||||||||||||||||||||||||||||||||||||||
| 178 | $card_node, | ||||||||||||||||||||||||||||||||||||||||||
| 179 | $self->property_node, | ||||||||||||||||||||||||||||||||||||||||||
| 180 | $self->value_node, | ||||||||||||||||||||||||||||||||||||||||||
| 181 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | sub value_node | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
value_node: not called CC=13 SCAR=52.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | return rdf_literal($self->value_to_string, undef, $xsd->date) | ||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | if (defined $self->type_parameters and uc $self->type_parameters->{VALUE} eq 'DATE'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->type_parameters and uc $self->type_parameters->{"VALUE"} eq "DATE"
MC/DC0%0/2
defined $self->type_parameters and uc $self->type_parameters->{"VALUE"} eq "DATE"
defined $self->type_parameters
uc $self->type_parameters->{"VALUE"} eq "DATE"
Truth table0%0/3
A and B
A= defined $self->type_parametersB= uc $self->type_parameters->{"VALUE"} eq "DATE"
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | return rdf_literal($self->value_to_string, undef, $xsd->dateTime) | ||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | if (defined $self->type_parameters and uc $self->type_parameters->{VALUE} eq 'DATE-TIME'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->type_parameters and uc $self->type_parameters->{"VALUE"} eq "DATE-TIME"
MC/DC0%0/2
defined $self->type_parameters and uc $self->type_parameters->{"VALUE"} eq "DATE-TIME"
defined $self->type_parameters
uc $self->type_parameters->{"VALUE"} eq "DATE-TIME"
Truth table0%0/3
A and B
A= defined $self->type_parametersB= uc $self->type_parameters->{"VALUE"} eq "DATE-TIME"
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | return rdf_resource($self->value_to_string) | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | if (defined $self->type_parameters and uc $self->type_parameters->{VALUE} eq 'URI'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->type_parameters and uc $self->type_parameters->{"VALUE"} eq "URI"
MC/DC0%0/2
defined $self->type_parameters and uc $self->type_parameters->{"VALUE"} eq "URI"
defined $self->type_parameters
uc $self->type_parameters->{"VALUE"} eq "URI"
Truth table0%0/3
A and B
A= defined $self->type_parametersB= uc $self->type_parameters->{"VALUE"} eq "URI"
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | if (defined $self->type_parameters | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $self->type_parameters and uc $self->type_parameters->{"VALUE"} eq "BINARY" and uc $self->type_parameters->{"ENCODING"} eq "B"
defined $self->type_parameters and uc $self->type_parameters->{"VALUE"} eq "BINARY"
MC/DC0%0/3
defined $self->type_parameters and uc $self->type_parameters->{"VALUE"} eq "BINARY" and uc $self->type_parameters->{"ENCODING"} eq "B"
defined $self->type_parameters
uc $self->type_parameters->{"VALUE"} eq "BINARY"
uc $self->type_parameters->{"ENCODING"} eq "B"
Truth table0%0/4
A and B and C
A= defined $self->type_parametersB= uc $self->type_parameters->{"VALUE"} eq "BINARY"C= uc $self->type_parameters->{"ENCODING"} eq "B"
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | and uc $self->type_parameters->{VALUE} eq 'BINARY' | ||||||||||||||||||||||||||||||||||||||||||
| 201 | and uc $self->type_parameters->{ENCODING} eq 'B') | ||||||||||||||||||||||||||||||||||||||||||
| 202 | { | ||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my $uri = URI->new('data:'); | |||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | if (ref $self->type_parameters->{TYPE} eq 'ARRAY') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | { | ||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $uri->media_type(sprintf('image/%s', lc $self->type_parameters->{TYPE}->[0])); | |||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | elsif (ref $self->type_parameters->{TYPE}) | ||||||||||||||||||||||||||||||||||||||||||
| 209 | { | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | $uri->media_type(sprintf('image/%s', lc $self->type_parameters->{TYPE})); | |||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||
| 212 | else | ||||||||||||||||||||||||||||||||||||||||||
| 213 | { | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | $uri->media_type('application/octet-stream'); | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $uri->data( decode_base64($self->value->[0]) ); | |||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | return rdf_resource("$uri"); | |||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | if (defined $self->type_parameters->{LANG}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | { | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | return rdf_literal($self->value_to_string, $self->type_parameters->{LANG}); | |||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | return rdf_literal($self->value_to_string); | |||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | sub property_node | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
property_node: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | return rdf_resource(V(lc $self->property)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | if lc $self->property =~ /^(adr|agent|email|geo|key|logo| | ||||||||||||||||||||||||||||||||||||||||||
| 234 | n|org|photo|sound|tel|url|bday|category|class|fn| | ||||||||||||||||||||||||||||||||||||||||||
| 235 | label|mailer|nickname|note|prodid|rev|role|sort\-string| | ||||||||||||||||||||||||||||||||||||||||||
| 236 | title|tz|uid)$/xi; | ||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | return rdf_resource(VX(lc $self->property)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | if lc $self->property =~ /^(kind|gender|sex|dday| | ||||||||||||||||||||||||||||||||||||||||||
| 240 | anniversary|lang|member|caladruri|caluri|fburl| | ||||||||||||||||||||||||||||||||||||||||||
| 241 | impp|source)$/xi; | ||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | return rdf_resource(VX(lc $self->property)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | if lc $self->property =~ /^x-/; | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | { | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 1 | my %usage_type = ( | |||||||||||||||||||||||||||||||||||||||||
| 251 | bbs => V('BBS'), | ||||||||||||||||||||||||||||||||||||||||||
| 252 | car => V('Car'), | ||||||||||||||||||||||||||||||||||||||||||
| 253 | cell => V('Cell'), | ||||||||||||||||||||||||||||||||||||||||||
| 254 | dom => V('Dom'), | ||||||||||||||||||||||||||||||||||||||||||
| 255 | fax => V('Fax'), | ||||||||||||||||||||||||||||||||||||||||||
| 256 | home => V('Home'), | ||||||||||||||||||||||||||||||||||||||||||
| 257 | internet => V('Internet'), | ||||||||||||||||||||||||||||||||||||||||||
| 258 | intl => V('Intl'), | ||||||||||||||||||||||||||||||||||||||||||
| 259 | isdn => V('ISDN'), | ||||||||||||||||||||||||||||||||||||||||||
| 260 | modem => V('Modem'), | ||||||||||||||||||||||||||||||||||||||||||
| 261 | msg => V('Msg'), | ||||||||||||||||||||||||||||||||||||||||||
| 262 | pager => V('Pager'), | ||||||||||||||||||||||||||||||||||||||||||
| 263 | parcel => V('Parcel'), | ||||||||||||||||||||||||||||||||||||||||||
| 264 | pcs => V('PCS'), | ||||||||||||||||||||||||||||||||||||||||||
| 265 | postal => V('Postal'), | ||||||||||||||||||||||||||||||||||||||||||
| 266 | pref => V('Pref'), | ||||||||||||||||||||||||||||||||||||||||||
| 267 | video => V('Video'), | ||||||||||||||||||||||||||||||||||||||||||
| 268 | voice => V('Voice'), | ||||||||||||||||||||||||||||||||||||||||||
| 269 | work => V('Work'), | ||||||||||||||||||||||||||||||||||||||||||
| 270 | x400 => V('X400'), | ||||||||||||||||||||||||||||||||||||||||||
| 271 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | 1 | my %intrinsic_type = ( | |||||||||||||||||||||||||||||||||||||||||
| 274 | adr => V('Address'), | ||||||||||||||||||||||||||||||||||||||||||
| 275 | email => V('Email'), | ||||||||||||||||||||||||||||||||||||||||||
| 276 | impp => VX('Impp'), | ||||||||||||||||||||||||||||||||||||||||||
| 277 | label => V('Label'), | ||||||||||||||||||||||||||||||||||||||||||
| 278 | tel => V('Tel'), | ||||||||||||||||||||||||||||||||||||||||||
| 279 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | sub _add_to_model_typed_thing | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_to_model_typed_thing: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | my ($self, $model, $card_node) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | my $intermediate_node = RDF::Trine::Node::Blank->new; | |||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | $model->add_statement(rdf_statement( | |||||||||||||||||||||||||||||||||||||||||
| 287 | $card_node, | ||||||||||||||||||||||||||||||||||||||||||
| 288 | $self->property_node, | ||||||||||||||||||||||||||||||||||||||||||
| 289 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 290 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | $model->add_statement(rdf_statement( | ||||||||||||||||||||||||||||||||||||||||||
| 293 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 294 | rdf_resource(RDF('type')), | ||||||||||||||||||||||||||||||||||||||||||
| 295 | rdf_resource($intrinsic_type{ lc $self->property }), | ||||||||||||||||||||||||||||||||||||||||||
| 296 | )) | ||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | if $intrinsic_type{ lc $self->property }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | $model->add_statement(rdf_statement( | |||||||||||||||||||||||||||||||||||||||||
| 300 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 301 | rdf_resource(RDF('value')), | ||||||||||||||||||||||||||||||||||||||||||
| 302 | $self->value_node, | ||||||||||||||||||||||||||||||||||||||||||
| 303 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | if ($self->type_parameters) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | { | ||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | foreach my $type (@{ $self->type_parameters->{TYPE} }) | |||||||||||||||||||||||||||||||||||||||||
| 308 | { | ||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | if ($usage_type{lc $type}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | { | ||||||||||||||||||||||||||||||||||||||||||
| 311 | $model->add_statement(rdf_statement( | ||||||||||||||||||||||||||||||||||||||||||
| 312 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 313 | rdf_resource(RDF('type')), | ||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | rdf_resource($usage_type{lc $type}), | |||||||||||||||||||||||||||||||||||||||||
| 315 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | $model->add_statement(rdf_statement( | |||||||||||||||||||||||||||||||||||||||||
| 318 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 319 | rdf_resource(VX('usage')), | ||||||||||||||||||||||||||||||||||||||||||
| 320 | rdf_literal($type), | ||||||||||||||||||||||||||||||||||||||||||
| 321 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | return $intermediate_node; # useful for _add_to_model_ADR | |||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | 1 | *_add_to_model_TEL = \&_add_to_model_typed_thing; | |||||||||||||||||||||||||||||||||||||||||
| 331 | 1 | *_add_to_model_EMAIL = \&_add_to_model_typed_thing; | |||||||||||||||||||||||||||||||||||||||||
| 332 | 1 | *_add_to_model_LABEL = \&_add_to_model_typed_thing; | |||||||||||||||||||||||||||||||||||||||||
| 333 | 1 | *_add_to_model_IMPP = \&_add_to_model_typed_thing; | |||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | sub _add_to_model_AGENT | ||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_to_model_AGENT: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | warn "Outputting AGENT property to RDF not yet supported."; | |||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | sub _add_to_model_ADR | ||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_to_model_ADR: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | my ($self, $model, $card_node) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | my $intermediate_node = $self->_add_to_model_typed_thing($model, $card_node); | |||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | my @properties = ( | |||||||||||||||||||||||||||||||||||||||||
| 346 | V('post-office-box'), | ||||||||||||||||||||||||||||||||||||||||||
| 347 | V('extended-address'), | ||||||||||||||||||||||||||||||||||||||||||
| 348 | V('street-address'), | ||||||||||||||||||||||||||||||||||||||||||
| 349 | V('locality'), | ||||||||||||||||||||||||||||||||||||||||||
| 350 | V('region'), | ||||||||||||||||||||||||||||||||||||||||||
| 351 | V('postal-code'), | ||||||||||||||||||||||||||||||||||||||||||
| 352 | V('country-name'), | ||||||||||||||||||||||||||||||||||||||||||
| 353 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | my @components = @{ $self->nvalue }; | |||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | ▶ | for (my $i=0; defined $properties[$i]; $i++) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 357 | { | ||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | next unless $components[$i] && @{ $components[$i] }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$components[$i] and @{$components[$i];}
MC/DC0%0/2
$components[$i] and @{$components[$i];}
$components[$i]
@{$components[$i];}
Truth table0%0/3
A and B
A= $components[$i]B= @{$components[$i];}
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | foreach my $v (@{ $components[$i] }) | |||||||||||||||||||||||||||||||||||||||||
| 361 | { | ||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | $model->add_statement(rdf_statement( | |||||||||||||||||||||||||||||||||||||||||
| 363 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 364 | rdf_resource($properties[$i]), | ||||||||||||||||||||||||||||||||||||||||||
| 365 | rdf_literal($v), | ||||||||||||||||||||||||||||||||||||||||||
| 366 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | return $intermediate_node; | |||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | sub _add_to_model_GEO | ||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_to_model_GEO: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my ($self, $model, $card_node) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | my $intermediate_node = RDF::Trine::Node::Blank->new; | |||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | my @properties = ( | |||||||||||||||||||||||||||||||||||||||||
| 379 | V('latitude'), | ||||||||||||||||||||||||||||||||||||||||||
| 380 | V('longitude'), | ||||||||||||||||||||||||||||||||||||||||||
| 381 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | $model->add_statement(rdf_statement( | |||||||||||||||||||||||||||||||||||||||||
| 384 | $card_node, | ||||||||||||||||||||||||||||||||||||||||||
| 385 | $self->property_node, | ||||||||||||||||||||||||||||||||||||||||||
| 386 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 387 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | $model->add_statement(rdf_statement( | |||||||||||||||||||||||||||||||||||||||||
| 390 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 391 | rdf_resource(RDF('type')), | ||||||||||||||||||||||||||||||||||||||||||
| 392 | rdf_resource(V('Location')), | ||||||||||||||||||||||||||||||||||||||||||
| 393 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | my @components = @{ $self->nvalue }; | |||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | for (my $i=0; defined $properties[$i]; $i++) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | { | ||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | next unless $components[$i] && @{ $components[$i] }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$components[$i] and @{$components[$i];}
MC/DC0%0/2
$components[$i] and @{$components[$i];}
$components[$i]
@{$components[$i];}
Truth table0%0/3
A and B
A= $components[$i]B= @{$components[$i];}
| |||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | foreach my $v (@{ $components[$i] }) | |||||||||||||||||||||||||||||||||||||||||
| 402 | { | ||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | $model->add_statement(rdf_statement( | |||||||||||||||||||||||||||||||||||||||||
| 404 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 405 | rdf_resource($properties[$i]), | ||||||||||||||||||||||||||||||||||||||||||
| 406 | rdf_literal($v), | ||||||||||||||||||||||||||||||||||||||||||
| 407 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | return $intermediate_node; | |||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | sub _add_to_model_N | ||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_to_model_N: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | my ($self, $model, $card_node) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | my $intermediate_node = RDF::Trine::Node::Blank->new; | |||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | my @properties = ( | |||||||||||||||||||||||||||||||||||||||||
| 420 | V('family-name'), | ||||||||||||||||||||||||||||||||||||||||||
| 421 | V('given-name'), | ||||||||||||||||||||||||||||||||||||||||||
| 422 | V('additional-name'), | ||||||||||||||||||||||||||||||||||||||||||
| 423 | V('honorific-suffix'), | ||||||||||||||||||||||||||||||||||||||||||
| 424 | V('honorific-prefix'), | ||||||||||||||||||||||||||||||||||||||||||
| 425 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | $model->add_statement(rdf_statement( | |||||||||||||||||||||||||||||||||||||||||
| 428 | $card_node, | ||||||||||||||||||||||||||||||||||||||||||
| 429 | $self->property_node, | ||||||||||||||||||||||||||||||||||||||||||
| 430 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 431 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | $model->add_statement(rdf_statement( | |||||||||||||||||||||||||||||||||||||||||
| 434 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 435 | rdf_resource(RDF('type')), | ||||||||||||||||||||||||||||||||||||||||||
| 436 | rdf_resource(V('Name')), | ||||||||||||||||||||||||||||||||||||||||||
| 437 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | my @components = @{ $self->nvalue }; | |||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | for (my $i=0; defined $properties[$i]; $i++) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | { | ||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | ▶ | next unless $components[$i] && @{ $components[$i] }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$components[$i] and @{$components[$i];}
MC/DC0%0/2
$components[$i] and @{$components[$i];}
$components[$i]
@{$components[$i];}
Truth table0%0/3
A and B
A= $components[$i]B= @{$components[$i];}
| |||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | foreach my $v (@{ $components[$i] }) | |||||||||||||||||||||||||||||||||||||||||
| 446 | { | ||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | $model->add_statement(rdf_statement( | |||||||||||||||||||||||||||||||||||||||||
| 448 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 449 | rdf_resource($properties[$i]), | ||||||||||||||||||||||||||||||||||||||||||
| 450 | rdf_literal($v), | ||||||||||||||||||||||||||||||||||||||||||
| 451 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | return $intermediate_node; | |||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||
| 458 | sub _add_to_model_ORG | ||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_to_model_ORG: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | my ($self, $model, $card_node) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | my @units; | |||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | foreach my $v1 (@{ $self->nvalue }) | |||||||||||||||||||||||||||||||||||||||||
| 464 | { | ||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | push @units, @$v1; | |||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | my $intermediate_node = RDF::Trine::Node::Blank->new; | |||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | $model->add_statement(rdf_statement( | |||||||||||||||||||||||||||||||||||||||||
| 471 | $card_node, | ||||||||||||||||||||||||||||||||||||||||||
| 472 | $self->property_node, | ||||||||||||||||||||||||||||||||||||||||||
| 473 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 474 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | $model->add_statement(rdf_statement( | |||||||||||||||||||||||||||||||||||||||||
| 477 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 478 | rdf_resource(RDF('type')), | ||||||||||||||||||||||||||||||||||||||||||
| 479 | rdf_resource(V('Organization')), | ||||||||||||||||||||||||||||||||||||||||||
| 480 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | my $org = shift @units; | |||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | if ($org) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 485 | { | ||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | $model->add_statement(rdf_statement( | |||||||||||||||||||||||||||||||||||||||||
| 487 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 488 | rdf_resource(V('organization-name')), | ||||||||||||||||||||||||||||||||||||||||||
| 489 | rdf_literal($org), | ||||||||||||||||||||||||||||||||||||||||||
| 490 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | foreach my $u (@units) | |||||||||||||||||||||||||||||||||||||||||
| 494 | { | ||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | $model->add_statement(rdf_statement( | |||||||||||||||||||||||||||||||||||||||||
| 496 | $intermediate_node, | ||||||||||||||||||||||||||||||||||||||||||
| 497 | rdf_resource(V('organization-unit')), | ||||||||||||||||||||||||||||||||||||||||||
| 498 | rdf_literal($u), | ||||||||||||||||||||||||||||||||||||||||||
| 499 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||
| 505 | __END__ | ||||||||||||||||||||||||||||||||||||||||||