line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
50
|
|
|
50
|
|
653
|
use v5.14; |
|
50
|
|
|
|
|
173
|
|
2
|
50
|
|
|
50
|
|
232
|
use warnings; |
|
50
|
|
|
|
|
100
|
|
|
50
|
|
|
|
|
2199
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Attean::IRI - RDF Internationalized Resource Identifiers (IRIs) |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 VERSION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
This document describes Attean::IRI version 0.033 |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use v5.14; |
15
|
|
|
|
|
|
|
use Attean; |
16
|
|
|
|
|
|
|
my $term = Attean::IRI->new('http://example.org/'); |
17
|
|
|
|
|
|
|
$term->ntriples_string; # <http://example.org/> |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
The Attean::IRI class represents RDF IRIs. |
22
|
|
|
|
|
|
|
It conforms to the L<Attean::API::IRI|Attean::API::Term> role |
23
|
|
|
|
|
|
|
and extends the L<IRI> class. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 METHODS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=over 4 |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use Moo; |
32
|
50
|
|
|
50
|
|
269
|
use Types::Standard qw(Str); |
|
50
|
|
|
|
|
103
|
|
|
50
|
|
|
|
|
312
|
|
33
|
50
|
|
|
50
|
|
15725
|
use IRI 0.005; |
|
50
|
|
|
|
|
111
|
|
|
50
|
|
|
|
|
401
|
|
34
|
50
|
|
|
50
|
|
24816
|
use namespace::clean; |
|
50
|
|
|
|
|
910
|
|
|
50
|
|
|
|
|
1112
|
|
35
|
50
|
|
|
50
|
|
248
|
|
|
50
|
|
|
|
|
95
|
|
|
50
|
|
|
|
|
398
|
|
36
|
|
|
|
|
|
|
extends 'IRI'; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has 'ntriples_string' => (is => 'ro', isa => Str, lazy => 1, builder => '_ntriples_string'); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=item C<< equals ( $iri ) >> |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Returns true if C<< $iri >> is equal to the invocant, false otherwise. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# This overrides the Attean::API::TermOrVariable::equals implementation |
47
|
|
|
|
|
|
|
# to allow lazy IRIs to remain unparsed for the case where neither has |
48
|
|
|
|
|
|
|
# a base IRI. |
49
|
|
|
|
|
|
|
my ($a, $b) = @_; |
50
|
|
|
|
|
|
|
if ($b->isa('Attean::IRI')) { |
51
|
787
|
|
|
787
|
1
|
4671
|
unless ($a->has_base or $b->has_base) { |
52
|
787
|
100
|
|
|
|
1916
|
return ($a->value eq $b->value); |
53
|
779
|
50
|
33
|
|
|
2521
|
} |
54
|
779
|
|
|
|
|
3106
|
} |
55
|
|
|
|
|
|
|
return ($a->as_string eq $b->as_string); |
56
|
|
|
|
|
|
|
} |
57
|
8
|
|
|
|
|
20
|
|
58
|
|
|
|
|
|
|
with 'Attean::API::IRI'; |
59
|
|
|
|
|
|
|
with 'Attean::API::BlankOrIRI'; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
around BUILDARGS => sub { |
62
|
|
|
|
|
|
|
my $orig = shift; |
63
|
|
|
|
|
|
|
my $class = shift; |
64
|
|
|
|
|
|
|
my $args; |
65
|
|
|
|
|
|
|
if (scalar(@_) == 1) { |
66
|
|
|
|
|
|
|
$args = $class->$orig(value => shift); |
67
|
|
|
|
|
|
|
} else { |
68
|
|
|
|
|
|
|
$args = $class->$orig(@_); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
if (exists $args->{base}) { |
72
|
|
|
|
|
|
|
# fully qualify IRIs |
73
|
|
|
|
|
|
|
my $iri = IRI->new( %$args ); |
74
|
|
|
|
|
|
|
$args = { value => $iri->as_string }; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
return $args; |
77
|
|
|
|
|
|
|
}; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item C<< as_string >> |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Returns the IRI value. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
my $self = shift; |
86
|
|
|
|
|
|
|
return $self->abs; |
87
|
|
|
|
|
|
|
} |
88
|
1721
|
|
|
1721
|
1
|
39820
|
} |
89
|
1721
|
|
|
|
|
28239
|
|
90
|
|
|
|
|
|
|
1; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=back |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 BUGS |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Please report any bugs or feature requests to through the GitHub web interface |
98
|
|
|
|
|
|
|
at L<https://github.com/kasei/attean/issues>. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 SEE ALSO |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
L<IRI> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
L<http://www.ietf.org/rfc/rfc3987.txt> |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 AUTHOR |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Gregory Todd Williams C<< <gwilliams@cpan.org> >> |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 COPYRIGHT |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Copyright (c) 2014--2022 Gregory Todd Williams. |
115
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under |
116
|
|
|
|
|
|
|
the same terms as Perl itself. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |