File Coverage

blib/lib/SemanticWeb/Schema.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 31 31 100.0


line stmt bran cond sub pod time code
1 3     3   1557 use utf8;
  3         7  
  3         18  
2              
3             package SemanticWeb::Schema;
4              
5             # ABSTRACT: Moo classes for http://schema.org/ classes
6              
7 3     3   147 use v5.14;
  3         9  
8 3     3   17 use Moo;
  3         6  
  3         15  
9              
10 3     3   1991 use List::Util qw/ first /;
  3         7  
  3         186  
11 3     3   20 use MooX::JSON_LD 'base';
  3         5  
  3         17  
12 3     3   6404 use Ref::Util qw/ is_blessed_ref is_plain_arrayref /;
  3         6  
  3         165  
13 3     3   20 use Types::Standard qw/ Str /;
  3         6  
  3         38  
14              
15 3     3   2063 use namespace::autoclean;
  3         7  
  3         15  
16              
17             our $VERSION = 'v21.0.1';
18              
19             # RECOMMEND PREREQ: aliased
20             # RECOMMEND PREREQ: Class::XSAccessor 1.18
21             # RECOMMEND PREREQ: Ref::Util::XS
22             # RECOMMEND PREREQ: Type::Tiny::XS
23              
24              
25             has id => (
26             is => 'rw',
27             isa => Str,
28             predicate => 1,
29             json_ld => '@id',
30             );
31              
32              
33             around _build_context => sub { return 'http://schema.org/' };
34              
35              
36             1;
37              
38             __END__
39              
40             =pod
41              
42             =encoding UTF-8
43              
44             =head1 NAME
45              
46             SemanticWeb::Schema - Moo classes for http://schema.org/ classes
47              
48             =head1 VERSION
49              
50             version v21.0.1
51              
52             The version number of this distribution is based on the corresponding
53             version of schema classes.
54              
55             =head1 SYNOPSIS
56              
57             use aliased 'SemanticWeb::Schema::Person' => 'Person';
58              
59             my $person = Person->new(
60             name => 'James Clerk Maxwell',
61             birth_date => '1831-06-13',
62             birth_place => 'Edinburgh',
63             );
64              
65             print $person->json_ld;
66              
67             =head1 DESCRIPTION
68              
69             This distribution contains Perl classes for L<https://schema.org>
70             semantic markup. These can be used to generate JSON-LD
71             to embed in websites.
72              
73             This is a base class for the C<SemanticWeb::Schema> classes, which
74             were generated automatically from the following sources:
75              
76             =over
77              
78             =item L<https://schema.org/version/21.0/schemaorg-all-http.rdf>
79              
80             =back
81              
82             =head1 ATTRIBUTES
83              
84             =head2 C<id>
85              
86             If this is set, it adds a C<@id> to the L</json_ld_data>.
87              
88             =head2 C<context>
89              
90             The context defaults to "http://schema.org/".
91              
92             =head1 FREQUENTLY ASKED QUESTIONS
93              
94             =head2 How are these classes generated?
95              
96             A script in the F<devel> directory downloads the RDF descriptions of the data, and uses that to generate the classes.
97              
98             The author may make some manual changes to work around any bugs in the class generation.
99              
100             =head2 Why don't you split this into separate distributions?
101              
102             As of v14, there are more than 890 classes. It would be difficult to rebuild and upload separate distributions for each
103             class. Each distribution would have separate permissions and nearly duplicate metadata files on CPAN, and would end up
104             using more disk space and network bandwidth. It would add the risk of breaking something for users if there was a
105             missing or inconsistent dependency, and increase the time it would take to install if users want multiple classes.
106              
107             The benefit of saving disk space is rather small considering the potential problems.
108              
109             =head1 SUPPORT FOR OLDER PERL VERSIONS
110              
111             Since v21.0.0, the this module requires Perl v5.14 or later.
112              
113             Future releases may only support Perl versions released in the last ten years.
114              
115             =head1 SEE ALSO
116              
117             =over
118              
119             =item L<Moo>
120              
121             =item L<MooX::JSON_LD>
122              
123             =item L<http://schema.org/>
124              
125             =back
126              
127             =head1 SOURCE
128              
129             The development version is on github at L<https://github.com/robrwo/SemanticWeb-Schema>
130             and may be cloned from L<git://github.com/robrwo/SemanticWeb-Schema.git>
131              
132             =head1 BUGS
133              
134             Please report any bugs or feature requests on the bugtracker website
135             L<https://github.com/robrwo/SemanticWeb-Schema/issues>
136              
137             When submitting a bug or request, please include a test-file or a
138             patch to an existing test-file that illustrates the bug or desired
139             feature.
140              
141             =head1 AUTHOR
142              
143             Robert Rothenberg <rrwo@cpan.org>
144              
145             =head1 CONTRIBUTORS
146              
147             =for stopwords Mathias Reitinger Arikawa Takaya Mohammad S Anwar
148              
149             =over 4
150              
151             =item *
152              
153             Mathias Reitinger <reitinger@cpan.org>
154              
155             =item *
156              
157             Arikawa Takaya <tky.c10.ver@gmail.com>
158              
159             =item *
160              
161             Mohammad S Anwar <mohammad.anwar@yahoo.com>
162              
163             =back
164              
165             =head1 COPYRIGHT AND LICENSE
166              
167             This software is Copyright (c) 2018-2023 by Robert Rothenberg.
168              
169             This is free software, licensed under:
170              
171             The Artistic License 2.0 (GPL Compatible)
172              
173             =cut