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