Core/Literal.pm

filter: Statementstmt 38.4% 10 / 26 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 27 MC/DCmcdc 0.0% 0 / 12 Subroutinesub 22.2% 2 / 9 Podpod 100% 7 / 7 totaltotal 21.3% 19 / 89 CC 14 SCAR 40.5
CC
14
Cov
16%
equals
110.0
new
30.0
getValue
2.0
CRAP 57.4
« Core/Storage/Postgres.pm ↑ Summary Core/Model/Parser.pm »
1 #
2 # The contents of this file are subject to the Mozilla Public
3 # License Version 1.1 (the "License"); you may not use this file
4 # except in compliance with the License. You may obtain a copy of
5 # the License at http://www.mozilla.org/MPL/
6 #
7 # Software distributed under the License is distributed on an "AS
8 # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 # implied. See the License for the specific language governing
10 # rights and limitations under the License.
11 #
12 # The Original Code is the RDF::Core module
13 #
14 # The Initial Developer of the Original Code is Ginger Alliance Ltd.
15 # Portions created by Ginger Alliance are
16 # Copyright (C) 2001 Ginger Alliance Ltd.
17 # All Rights Reserved.
18 #
19 # Contributor(s):
20 #
21 # Alternatively, the contents of this file may be used under the
22 # terms of the GNU General Public License Version 2 or later (the
23 # "GPL"), in which case the provisions of the GPL are applicable
24 # instead of those above. If you wish to allow use of your
25 # version of this file only under the terms of the GPL and not to
26 # allow others to use your version of this file under the MPL,
27 # indicate your decision by deleting the provisions above and
28 # replace them with the notice and other provisions required by
29 # the GPL. If you do not delete the provisions above, a recipient
30 # may use your version of this file under either the MPL or the
31 # GPL.
32 #
33  
34 package RDF::Core::Literal;
35  
36 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
37  
38 1 require Exporter;
39  
40 1 our @ISA = qw(RDF::Core::Node);
41  
42 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
43 1 require RDF::Core::Node;
44  
45  
46 0 ▶sub new {
Subroutine new: not called CC=5 SCAR=34.0
Pod documented
47 0 my ($pkg, $value, $lang, $datatype)=@_;
48 0 ▶ $pkg = ref $pkg || $pkg;
Condition0%0/3
ref $pkg || $pkg
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $pkg || $pkg
ref $pkg $pkg
Truth table0%0/3
A || B
A= ref $pkgB= $pkg
ABresult
1X1
011
000
49 0 my $self={};
50  
51 0 ▶ $self->{_value} = defined $value ? $value : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 0 0 0
52 # $self->{_lang} = $lang;
53 # $self->{_datatype} = $datatype;
54 0 ▶ $self->{_lang} = defined $lang ? $lang : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $lang ? : 0 0 0
55 0 ▶ $self->{_datatype} = defined $datatype ? $datatype : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $datatype ? : 0 0 0
56 0 bless $self,$pkg;
57 }
58 0 ▶sub getValue {
Subroutine getValue: not called CC=1 SCAR=6.9
Pod documented
59 0 return $_[0]->{_value};
60 }
61 0 ▶sub getLang {
Subroutine getLang: not called CC=1 SCAR=6.9
Pod documented
62 0 return $_[0]->{_lang};
63 }
64 0 ▶sub getDatatype {
Subroutine getDatatype: not called CC=1 SCAR=6.9
Pod documented
65 0 return $_[0]->{_datatype};
66 }
67 0 ▶sub equals {
Subroutine equals: not called CC=10 SCAR=47.0
Pod documented
68 0 my ($self, $node) = @_;
69 0 ▶ $node = new RDF::Core::Literal($node)
Branch: 1 branch
BranchTrueFalseTotal
unless ref $node and $node->isa("RDF::Core::Node") 0 0 0
Condition0%0/3
ref $node and $node->isa("RDF::Core::Node")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $node and $node->isa("RDF::Core::Node")
ref $node $node->isa("RDF::Core::Node")
Truth table0%0/3
A and B
A= ref $nodeB= $node->isa("RDF::Core::Node")
ABresult
0X0
100
111
70 unless ref $node && $node->isa("RDF::Core::Node");
71 0 ▶ return $node->isLiteral
Condition0%0/21
$node->isLiteral && $node->getValue eq $self->getValue && (!($node->getLang || $self->getLang) || uc $node->getLang eq uc $self->getLang) && (!($node->getDatatype || $self->getDatatype) || $node->getDatatype eq $self->getDatatype)
!ll&&!rl&&r
000
$node->isLiteral and $node->getValue eq $self->getValue and !($node->getLang || $self->getLang) || uc $node->getLang eq uc $self->getLang
!ll&&!rl&&r
000
$node->isLiteral and $node->getValue eq $self->getValue
!ll&&!rl&&r
000
not $node->getLang || $self->getLang or uc $node->getLang eq uc $self->getLang
l!l&&r!l&&!r
000
$node->getLang || $self->getLang
l!l&&r!l&&!r
000
not $node->getDatatype || $self->getDatatype or $node->getDatatype eq $self->getDatatype
l!l&&r!l&&!r
000
$node->getDatatype || $self->getDatatype
l!l&&r!l&&!r
000
MC/DC0%0/8
$node->isLiteral && $node->getValue eq $self->getValue && (!($node->getLang || $self->getLang) || uc $node->getLang eq uc $self->getLang) && (!($node->getDatatype || $self->getDatatype) || $node->getDatatype eq $self->getDatatype)
$node->isLiteral $node->getValue eq $self->getValue $node->getLang $self->getLang uc $node->getLang eq uc $self->getLang $node->getDatatype $self->getDatatype $node->getDatatype eq $self->getDatatype
Truth table0%0/19
A and B and not(C || D) or E && not(F || G) or H
A= $node->isLiteralB= $node->getValue eq $self->getValueC= $node->getLangD= $self->getLangE= uc $node->getLang eq uc $self->getLangF= $node->getDatatypeG= $self->getDatatypeH= $node->getDatatype eq $self->getDatatype
ABCDEFGHresult
0XXXXXXX0
10XXXXXX0
111X0XXX0
11010XXX0
1100X1X00
1100X0100
111X11X00
111X10100
110111X00
110110100
1100X00X1
1100X1X11
1100X0111
111X100X1
111X11X11
111X10111
1101100X1
110111X11
110110111
72 && ($node->getValue eq $self->getValue)
73 && (!$node->getLang && !$self->getLang
74 || uc($node->getLang) eq uc($self->getLang))
75 && (!$node->getDatatype && !$self->getDatatype
76 || $node->getDatatype eq $self->getDatatype);
77 }
78 #Override inherited method
79 0 ▶sub getLabel {
Subroutine getLabel: not called CC=1 SCAR=6.9
Pod documented
80 0 return $_[0]->getValue;
81 }
82 0 ▶sub clone {
Subroutine clone: not called CC=1 SCAR=6.9
Pod documented
83 0 my $self = shift;
84 0 return $self->new($self->{_value}, $self->{_lang}, $self->{_datatype});
85 }
86 1 1;
87 __END__
« Core/Storage/Postgres.pm ↑ Summary Core/Model/Parser.pm »