File Coverage

blib/lib/Attean/RDF.pm
Criterion Covered Total %
statement 27 27 100.0
branch n/a
condition n/a
subroutine 16 16 100.0
pod 11 11 100.0
total 54 54 100.0


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             Attean::RDF - Utility package for exporting shorthand functions for constructing RDF objects
4              
5             =head1 VERSION
6              
7             This document describes Attean::RDF version 0.032
8              
9             =head1 SYNOPSIS
10              
11             use v5.14;
12             use Attean::RDF;
13            
14             my $s = blank('b');
15             my $p = iri('http://xmlns.com/foaf/0.1/name');
16             my $o = langliteral("Eve", "en");
17             my $triple = triple($s, $p, $o);
18             say $triple->as_string; # _:b <http://xmlns.com/foaf/0.1/name> "Eve"@en .
19              
20             =head1 DESCRIPTION
21              
22             This is a utility package for exporting shorthand functions for constructing
23             RDF objects such as IRIs, Literals, Blanks, Triples, etc.
24              
25             =head1 FUNCTIONS
26              
27             All of the functions defined in this package may be exported (and are exported
28             by default).
29              
30             =over 4
31              
32             =cut
33              
34             use v5.14;
35 50     50   255619 use warnings;
  50         175  
36 50     50   237  
  50         99  
  50         1071  
37             use Attean;
38 50     50   985 use List::MoreUtils qw(zip);
  50         86  
  50         1189  
39 50     50   249 require Exporter::Tiny;
  50         81  
  50         381  
40             use namespace::clean;
41 50     50   28786  
  50         107  
  50         331  
42             our @ISA = qw(Exporter::Tiny);
43             our @EXPORT = qw(iri blank literal dtliteral langliteral variable triple quad triplepattern quadpattern bgp);
44              
45             =item C<< variable( $value ) >>
46              
47             C<< Attean::Variable->new($value) >>
48              
49             =cut
50              
51             return Attean::Variable->new(@_);
52             }
53 559     559 1 189882  
54             =item C<< iri( $value ) >>
55              
56             C<< Attean::IRI->new($value) >>
57              
58             =cut
59              
60             return Attean::IRI->new(@_);
61             }
62              
63 838     838 1 325151 =item C<< blank( $value ) >>
64              
65             C<< Attean::Blank->new($value) >>
66              
67             =cut
68              
69             return Attean::Blank->new(@_);
70             }
71              
72             =item C<< literal( $value ) >>
73 77     77 1 38435  
74             C<< Attean::Literal->new($value) >>
75              
76             =cut
77              
78             return Attean::Literal->new(@_);
79             }
80              
81             =item C<< dtliteral( $value, $dt ) >>
82              
83 211     211 1 36780 C<< Attean::Literal->new( value => $value, datatype => $dt ) >>
84              
85             =cut
86              
87             my @k = qw(value datatype);
88             return Attean::Literal->new(zip @k, @_);
89             }
90              
91             =item C<< langliteral( $value, $lang ) >>
92              
93 17     17 1 5892 C<< Attean::Literal->new( value => $value, language => $lang ) >>
94 17         392  
95             =cut
96              
97             my @k = qw(value language);
98             return Attean::Literal->new(zip @k, @_);
99             }
100            
101             =item C<< triple( @terms ) >>
102              
103             C<< Attean::Triple->new( @terms ) >>
104 2     2 1 749  
105 2         50 =cut
106              
107             return Attean::Triple->new(@_);
108             }
109            
110             =item C<< triplepattern( @terms ) >>
111              
112             C<< Attean::TriplePattern->new( @terms ) >>
113              
114             =cut
115 179     179 1 7492  
116             return Attean::TriplePattern->new(@_);
117             }
118            
119             =item C<< quad( @terms ) >>
120              
121             C<< Attean::Quad->new( @terms ) >>
122              
123             =cut
124              
125 120     120 1 8491 return Attean::Quad->new(@_);
126             }
127              
128             =item C<< quadpattern( @terms ) >>
129              
130             C<< Attean::QuadPattern->new( @terms ) >>
131              
132             =cut
133              
134             return Attean::QuadPattern->new(@_);
135 41     41 1 5941 }
136              
137             =item C<< bgp( @triplepatterns ) >>
138              
139             C<< Attean::Algebra::BGP->new( triples => \@triplepatterns ) >>
140              
141             =cut
142              
143             return Attean::Algebra::BGP->new(triples => \@_);
144             }
145 7     7 1 623 }
146            
147             1;
148              
149              
150             =back
151              
152             =head1 BUGS
153              
154             Please report any bugs or feature requests to through the GitHub web interface
155 8     8 1 397 at L<https://github.com/kasei/attean/issues>.
156              
157             =head1 SEE ALSO
158              
159             L<IRI>
160              
161             L<http://www.ietf.org/rfc/rfc3987.txt>
162              
163              
164              
165             =head1 AUTHOR
166              
167             Gregory Todd Williams C<< <gwilliams@cpan.org> >>
168              
169             =head1 COPYRIGHT
170              
171             Copyright (c) 2014--2022 Gregory Todd Williams.
172             This program is free software; you can redistribute it and/or modify it under
173             the same terms as Perl itself.
174              
175             =cut