SemanticWeb-Schema
view release on metacpan or search on metacpan
devel/rdfs.pl view on Meta::CPAN
package SemanticWeb::ClassGenerator;
use v5.10;
use Moo;
use Carp;
use Const::Fast;
use HTML::Strip;
use JSON::MaybeXS;
use List::Util 1.33 qw/ any pairgrep uniqstr /;
use LWP::UserAgent;
use Path::Tiny;
use RDF::Prefixes;
use RDF::Trine;
use Ref::Util qw/ is_plain_arrayref /;
use String::CamelCase qw/ decamelize /;
use Template;
use Text::Wrap qw/ wrap /;
use Types::Standard -types;
use URI;
our $VERSION = 'v9.0.0';
const my $MAX_ABSTRACT_LENGTH => 44; # See ExtUtils::ModuleMaker
const my %prefixes => (
dc => 'http://purl.org/dc/terms/',
elements => 'http://purl.org/dc/elements/1.1/',
rdf => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
rdfs => 'http://www.w3.org/2000/01/rdf-schema#',
schema => 'http://schema.org/',
og => 'http://ogp.me/ns#',
);
has module_namespace => (
is => 'lazy',
isa => Str,
default => 'SemanticWeb',
);
has class_dir => (
is => 'lazy',
isa => InstanceOf ['Path::Tiny'],
coerce => \&path,
default => 'lib',
);
has test_dir => (
is => 'lazy',
isa => InstanceOf ['Path::Tiny'],
coerce => \&path,
default => 't',
);
has json => (
is => 'lazy',
isa => InstanceOf [qw/ Cpanel::JSON::XS JSON JSON::PP JSON::XS /],
builder => sub {
return JSON->new->canonical->utf8->space_after->indent->pretty;
},
handles => [qw/ encode /],
);
has prefixes => (
is => 'lazy',
isa => InstanceOf ['RDF::Prefixes'],
builder => sub { RDF::Prefixes->new( \%prefixes ) },
);
sub stringify {
my ( $self, $node ) = @_;
if ( $node->isa('RDF::Trine::Node::Literal') ) {
my $value = $node->literal_value;
if ( defined $value ) {
( run in 1.676 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )