| 1 | # RDF::Query::Node::Literal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | RDF::Query::Node::Literal - RDF Node class for literals | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | This document describes RDF::Query::Node::Literal version 2.919. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | package RDF::Query::Node::Literal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 36 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 36 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 36 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 36 | ▶ | use base qw(RDF::Query::Node RDF::Trine::Node::Literal); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 36 | ▶ | use DateTime; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 36 | ▶ | use DateTime::Format::W3CDTF; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 36 | ▶ | use RDF::Query::Error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 36 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 36 | ▶ | use Log::Log4perl; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 36 | ▶ | use Scalar::Util qw(blessed refaddr looks_like_number); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 36 | ▶ | use Carp qw(carp croak confess); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 36 | our ($VERSION, $LAZY_COMPARISONS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 36 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 36 | $VERSION = '2.919'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 36 | ▶ | use overload '<=>' => \&_cmp, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 'cmp' => \&_cmp, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 30 | ▶ | '<' => sub { _cmp(@_[0,1], '<') == -1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 24 | ▶ | '>' => sub { _cmp(@_[0,1], '>') == 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | ▶ | '!=' => sub { _cmp(@_[0,1], '!=') != 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 47 | ▶ | '==' => sub { _cmp(@_[0,1], '==') == 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | '+' => sub { $_[0] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 849 | ▶ | '""' => sub { $_[0]->sse }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 36 | ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 36 | my %INSIDE_OUT_DATES; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | Beyond the methods documented below, this class inherits methods from the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | L<RDF::Query::Node> and L<RDF::Trine::Node::Literal> classes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 133 | ▶ | sub _cmp { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cmp: called CC=46 SCAR=58.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 133 | my $nodea = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 133 | my $nodeb = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 133 | my $op = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 133 | my $l = Log::Log4perl->get_logger("rdf.query.node.literal"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 133 | $l->debug('literal comparison: ' . Dumper($nodea, $nodeb)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 133 | ▶ | return 1 unless blessed($nodeb); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 133 | ▶ | return -1 if ($nodeb->isa('RDF::Trine::Node::Nil')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 133 | ▶ | return 1 if ($nodeb->isa('RDF::Query::Node::Blank')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 132 | ▶ | return 1 if ($nodeb->isa('RDF::Query::Node::Resource')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 132 | ▶ | return 1 unless ($nodeb->isa('RDF::Query::Node::Literal')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 132 | ▶ | my $dta = $nodea->literal_datatype || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$nodea->literal_datatype || ''
MC/DC100%1/1
$nodea->literal_datatype || ''
$nodea->literal_datatype
Truth table100%2/2
A
A= $nodea->literal_datatype
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 132 | ▶ | my $dtb = $nodeb->literal_datatype || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$nodeb->literal_datatype || ''
MC/DC100%1/1
$nodeb->literal_datatype || ''
$nodeb->literal_datatype
Truth table100%2/2
A
A= $nodeb->literal_datatype
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 132 | my $datetype = '^http://www.w3.org/2001/XMLSchema#dateTime'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 132 | ▶ | my $datecmp = ($dta =~ $datetype and $dtb =~ $datetype); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$dta =~ /$datetype/ && $dtb =~ /$datetype/
MC/DC50%1/2
$dta =~ /$datetype/ && $dtb =~ /$datetype/
$dta =~ /$datetype/
$dtb =~ /$datetype/
Truth table66%2/3
A && B
A= $dta =~ /$datetype/B= $dtb =~ /$datetype/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 132 | ▶ | my $numericcmp = ($nodea->is_numeric_type and $nodeb->is_numeric_type); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$nodea->is_numeric_type && $nodeb->is_numeric_type
MC/DC50%1/2
$nodea->is_numeric_type && $nodeb->is_numeric_type
$nodea->is_numeric_type
$nodeb->is_numeric_type
Truth table66%2/3
A && B
A= $nodea->is_numeric_typeB= $nodeb->is_numeric_type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 132 | ▶ | if ($datecmp) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 7 | $l->trace('datecmp'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 7 | my $datea = $nodea->datetime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 7 | my $dateb = $nodeb->datetime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 7 | ▶ | if ($datea and $dateb) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$datea and $dateb
MC/DC0%0/2
$datea and $dateb
$datea
$dateb
Truth table33%1/3
A and B
A= $dateaB= $dateb
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 7 | my $cmp = eval { DateTime->compare_ignore_floating( $datea, $dateb ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 7 | ▶ | return $cmp unless ($@); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 125 | ▶ | if ($numericcmp) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 50 | $l->trace('both numeric cmp'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 50 | ▶ | return 0 if ($nodea->equal( $nodeb )); # if the nodes are identical, return true (even if the lexical values don't appear to be numeric). i.e., "xyz"^^xsd:integer should equal itself, even though it's not a valid integer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 39 | return $nodea->numeric_value <=> $nodeb->numeric_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 75 | $l->trace('other cmp'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 75 | ▶ | if ($nodea->has_language and $nodeb->has_language) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
Condition66%2/3
$nodea->has_language and $nodeb->has_language
MC/DC0%0/2
$nodea->has_language and $nodeb->has_language
$nodea->has_language
$nodeb->has_language
Truth table66%2/3
A and B
A= $nodea->has_languageB= $nodeb->has_language
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | $l->trace('both have language'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | my $lc = lc($nodea->literal_value_language) cmp lc($nodeb->literal_value_language); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my $vc = $nodea->literal_value cmp $nodeb->literal_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | if ($LAZY_COMPARISONS and ($lc != 0)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$RDF::Query::Node::Literal::LAZY_COMPARISONS and $lc != 0
MC/DC0%0/2
$RDF::Query::Node::Literal::LAZY_COMPARISONS and $lc != 0
$RDF::Query::Node::Literal::LAZY_COMPARISONS
$lc != 0
Truth table0%0/3
A and B
A= $RDF::Query::Node::Literal::LAZY_COMPARISONSB= $lc != 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | $c = ($vc || $lc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$vc || $lc
MC/DC0%0/2
$vc || $lc
$vc
$lc
Truth table0%0/3
A || B
A= $vcB= $lc
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } elsif ($lc == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | $c = $vc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $l->debug("Attempt to compare literals with differing languages."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | throw RDF::Query::Error::TypeError -text => "Attempt to compare literals with differing languages."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | $l->trace("-> $c"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | return $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | ▶ | } elsif (($nodea->has_datatype and $dta eq 'http://www.w3.org/2001/XMLSchema#string') or ($nodeb->has_datatype and $dtb eq 'http://www.w3.org/2001/XMLSchema#string')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition44%4/9
$nodea->has_datatype and $dta eq "http://www.w3.org/2001/XMLSchema#string" or $nodeb->has_datatype and $dtb eq "http://www.w3.org/2001/XMLSchema#string"
$nodea->has_datatype and $dta eq "http://www.w3.org/2001/XMLSchema#string"
$nodeb->has_datatype and $dtb eq "http://www.w3.org/2001/XMLSchema#string"
MC/DC0%0/4
$nodea->has_datatype and $dta eq "http://www.w3.org/2001/XMLSchema#string" or $nodeb->has_datatype and $dtb eq "http://www.w3.org/2001/XMLSchema#string"
$nodea->has_datatype
$dta eq "http://www.w3.org/2001/XMLSchema#string"
$nodeb->has_datatype
$dtb eq "http://www.w3.org/2001/XMLSchema#string"
Truth table28%2/7
A and B or C and D
A= $nodea->has_datatypeB= $dta eq "http://www.w3.org/2001/XMLSchema#string"C= $nodeb->has_datatypeD= $dtb eq "http://www.w3.org/2001/XMLSchema#string"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $l->trace("one is xsd:string"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 36 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | my ($na, $nb) = sort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | (blessed($b) and $b->isa('RDF::Query::Node::Literal')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
builtin::blessed($b) and $b->isa("RDF::Query::Node::Literal")
MC/DC0%0/2
builtin::blessed($b) and $b->isa("RDF::Query::Node::Literal")
builtin::blessed($b)
$b->isa("RDF::Query::Node::Literal")
Truth table0%0/3
A and B
A= builtin::blessed($b)B= $b->isa("RDF::Query::Node::Literal")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | ? $b->literal_datatype eq 'http://www.w3.org/2001/XMLSchema#string' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | : ($LAZY_COMPARISONS) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | ? refaddr($a) <=> refaddr($b) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | : throw RDF::Query::Error::TypeError -text => "Attempt to compare xsd:string with non-literal"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } ($nodea, $nodeb); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | my $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | if ($nb->has_language) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | $c = -1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ▶ | } elsif (not($nb->has_datatype) or $nb->literal_datatype eq 'http://www.w3.org/2001/XMLSchema#string') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not $nb->has_datatype or $nb->literal_datatype eq "http://www.w3.org/2001/XMLSchema#string"
MC/DC0%0/2
not $nb->has_datatype or $nb->literal_datatype eq "http://www.w3.org/2001/XMLSchema#string"
not $nb->has_datatype
$nb->literal_datatype eq "http://www.w3.org/2001/XMLSchema#string"
Truth table0%0/3
not(A) or B
A= not $nb->has_datatypeB= $nb->literal_datatype eq "http://www.w3.org/2001/XMLSchema#string"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $c = $nodea->literal_value cmp $nodeb->literal_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } elsif ($LAZY_COMPARISONS) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | return $nodea->as_string cmp $nodeb->as_string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | throw RDF::Query::Error::TypeError -text => "Attempt to compare typed-literal with xsd:string."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | $l->trace("-> $c"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | return $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | ▶ | } elsif ($nodea->has_datatype and $nodeb->has_datatype) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$nodea->has_datatype and $nodeb->has_datatype
MC/DC0%0/2
$nodea->has_datatype and $nodeb->has_datatype
$nodea->has_datatype
$nodeb->has_datatype
Truth table33%1/3
A and B
A= $nodea->has_datatypeB= $nodeb->has_datatype
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $l->trace("both have datatype"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | my $dc = $nodea->literal_datatype cmp $nodeb->literal_datatype; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | my $vc = $nodea->literal_value cmp $nodeb->literal_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | if ($op eq '!=') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | throw RDF::Query::Error::TypeError -text => "Attempt to compare (neq) literals with unrecognized datatypes."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | if ($LAZY_COMPARISONS) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | $c = ($vc || $dc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$vc || $dc
MC/DC0%0/2
$vc || $dc
$vc
$dc
Truth table0%0/3
A || B
A= $vcB= $dc
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } elsif ($dc == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | $c = $vc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | $l->debug("Attempt to compare literals with different datatypes."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | throw RDF::Query::Error::TypeError -text => "Attempt to compare literals with differing datatypes."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $l->trace("-> $c"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | return $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | ▶ | } elsif ($nodea->has_language or $nodeb->has_language) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$nodea->has_language or $nodeb->has_language
MC/DC100%2/2
$nodea->has_language or $nodeb->has_language
$nodea->has_language
$nodeb->has_language
Truth table100%3/3
A or B
A= $nodea->has_languageB= $nodeb->has_language
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 3 | $l->trace("one has language"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 3 | ▶ | my $c = ($nodea->has_language) ? 1 : -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 3 | $l->trace("-> $c"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 3 | return $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | ▶ | } elsif ($nodea->has_datatype or $nodeb->has_datatype) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$nodea->has_datatype or $nodeb->has_datatype
MC/DC50%1/2
$nodea->has_datatype or $nodeb->has_datatype
$nodea->has_datatype
$nodeb->has_datatype
Truth table66%2/3
A or B
A= $nodea->has_datatypeB= $nodeb->has_datatype
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 1 | $l->trace("one has datatype"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 1 | ▶ | if ($LAZY_COMPARISONS) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | my $c = ($nodea->has_datatype) ? 1 : -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $l->trace("-> $c"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | return $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 1 | $l->debug("Attempt to compare typed-literal with plain-literal"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 1 | throw RDF::Query::Error::TypeError -text => "Attempt to compare typed-literal with plain-literal"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 71 | $l->trace("something else"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 71 | my $vcmp = $nodea->literal_value cmp $nodeb->literal_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 71 | $l->trace("-> $vcmp"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 71 | return $vcmp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | =item C<< datetime >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | Returns a DateTime object from the literal if the literal value is in W3CDTF format. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 14 | ▶ | sub datetime { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
datetime: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 14 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 14 | my $addr = refaddr( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 14 | ▶ | if (exists($INSIDE_OUT_DATES{ $addr })) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 1 | return $INSIDE_OUT_DATES{ $addr }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 13 | my $value = $self->literal_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 13 | my $f = DateTime::Format::W3CDTF->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 13 | my $dt = eval { $f->parse_datetime( $value ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 13 | $INSIDE_OUT_DATES{ $addr } = $dt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 13 | return $dt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | =item C<< as_sparql >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | Returns the SPARQL string for this node. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 62 | ▶ | sub as_sparql { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_sparql: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 62 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 62 | ▶ | if ($self->is_numeric_type) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 7 | return $self->literal_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 55 | return $self->sse; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | =item C<< as_hash >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | Returns the query as a nested set of plain data structures (no objects). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | sub as_hash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_hash: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $context = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my $hash = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | type => 'node', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | literal => $self->literal_value, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | $hash->{ language } = $self->literal_value_language if ($self->has_language); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | $hash->{ datatype } = $self->literal_datatype if ($self->has_datatype); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | return $hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | =item C<< is_simple_literal >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | Returns true if the literal is "simple" -- is a literal without datatype or language. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | sub is_simple_literal { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_simple_literal: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | return not($self->has_language or $self->has_datatype); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->has_language || $self->has_datatype
MC/DC0%0/2
$self->has_language || $self->has_datatype
$self->has_language
$self->has_datatype
Truth table0%0/3
A || B
A= $self->has_languageB= $self->has_datatype
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | =item C<< is_numeric_type >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | Returns true if the literal is a known (xsd) numeric type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 689 | ▶ | sub is_numeric_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_numeric_type: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 689 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 689 | ▶ | return 0 unless ($self->has_datatype); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 530 | my $type = $self->literal_datatype; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 530 | ▶ | if ($type =~ qr<^http://www.w3.org/2001/XMLSchema#(integer|decimal|float|double|non(Positive|Negative)Integer|(positive|negative)Integer|long|int|short|byte|unsigned(Long|Int|Short|Byte))>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 394 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 136 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | =item C<< numeric_value >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | Returns the numeric value of the literal (even if the literal isn't a known numeric type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 185 | ▶ | sub numeric_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
numeric_value: called CC=7 SCAR=20.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 185 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 185 | ▶ | if ($self->is_numeric_type) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 181 | my $value = $self->literal_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 181 | ▶ | if (looks_like_number($value)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 181 | my $v = 0 + eval "$value"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 181 | return $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | throw RDF::Query::Error::TypeError -text => "Literal with numeric type does not appear to have numeric value."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } elsif (not $self->has_datatype) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 1 | ▶ | if (looks_like_number($self->literal_value)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 1 | return 0+$self->literal_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } elsif ($self->literal_datatype eq 'http://www.w3.org/2001/XMLSchema#boolean') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 3 | ▶ | return ($self->literal_value eq 'true') ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | =item C<< type_list >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | Returns a two-item list suitable for use as the second and third arguments to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | RDF::Query::Node::Literal constructor. The two returned values correspond to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | literal language tag and literal datatype URI, respectively. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | sub type_list { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type_list: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | return ($self->literal_value_language, $self->literal_datatype); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 935 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 935 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 935 | my $addr = refaddr($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 935 | delete $INSIDE_OUT_DATES{ $addr }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 36 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||