Dist-Inkt-DOAP
view release on metacpan or search on metacpan
lib/Dist/Inkt/Role/ProcessDOAP.pm view on Meta::CPAN
package Dist::Inkt::Role::ProcessDOAP;
our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION = '0.110';
use Moose::Role;
use List::Util 'uniq';
use namespace::autoclean;
use URI;
with 'Dist::Inkt::Role::RDFModel';
use RDF::Trine::Namespace qw[RDF RDFS OWL XSD];
my $CPAN = 'RDF::Trine::Namespace'->new('http://purl.org/NET/cpan-uri/terms#');
my $DC = 'RDF::Trine::Namespace'->new('http://purl.org/dc/terms/');
my $DOAP = 'RDF::Trine::Namespace'->new('http://usefulinc.com/ns/doap#');
my $DEPS = 'RDF::Trine::Namespace'->new('http://ontologi.es/doap-deps#');
my $FOAF = 'RDF::Trine::Namespace'->new('http://xmlns.com/foaf/0.1/');
my $NFO = 'RDF::Trine::Namespace'->new('http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#');
my $SKOS = 'RDF::Trine::Namespace'->new('http://www.w3.org/2004/02/skos/core#');
after PopulateMetadata => sub
{
my $self = shift;
$self->log('Processing the DOAP vocabulary');
my $meta = $self->metadata;
delete $meta->{abstract} if $meta->{abstract} eq 'unknown';
$meta->{abstract} ||= $_
for grep defined, $self->doap_project->shortdesc;
$meta->{description} ||= $_
for grep defined, $self->doap_project->description;
push @{ $meta->{license} }, $self->cpanmeta_license_code;
my $r = $self->cpanmeta_resources;
$meta->{resources}{$_} ||= $r->{$_} for keys %$r;
push @{ $meta->{keywords} }, $self->cpanmeta_keywords;
for my $role ($self->model->objects(RDF::Trine::iri($self->project_uri), $CPAN->x_help_wanted))
{
next unless $role->uri =~ /(\w+)\z/;
push @{ $meta->{x_help_wanted} ||= [] }, $1;
}
};
sub cpanmeta_license_code
{
my $self = shift;
my @r;
for (@{ $self->doap_project->license })
{
my $license_code = {
'http://www.gnu.org/licenses/agpl-3.0.txt' => 'agpl_3',
'http://www.apache.org/licenses/LICENSE-1.1' => 'apache_1_1',
'http://www.apache.org/licenses/LICENSE-2.0' => 'apache_2_0',
'http://www.apache.org/licenses/LICENSE-2.0.txt' => 'apache_2_0',
'http://www.perlfoundation.org/artistic_license_1_0' => 'artistic_1',
'http://opensource.org/licenses/artistic-license.php' => 'artistic_1',
'http://www.perlfoundation.org/artistic_license_2_0' => 'artistic_2',
'http://opensource.org/licenses/artistic-license-2.0.php' => 'artistic_2',
'http://www.opensource.org/licenses/bsd-license.php' => 'bsd',
'http://creativecommons.org/publicdomain/zero/1.0/' => 'unrestricted',
'http://www.freebsd.org/copyright/freebsd-license.html' => 'freebsd',
'http://www.gnu.org/licenses/old-licenses/fdl-1.2.html' => 'gfdl_1_2',
'http://www.gnu.org/copyleft/fdl.html' => 'gfdl_1_3',
'http://www.opensource.org/licenses/gpl-license.php' => 'gpl_1',
'http://www.gnu.org/licenses/old-licenses/gpl-1.0.txt' => 'gpl_1',
'http://www.opensource.org/licenses/gpl-2.0.php' => 'gpl_2',
'http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt' => 'gpl_2',
'http://www.opensource.org/licenses/gpl-3.0.html' => 'gpl_3',
'http://www.gnu.org/licenses/gpl-3.0.txt' => 'gpl_3',
'http://www.opensource.org/licenses/lgpl-license.php' => 'open_source',
'http://www.opensource.org/licenses/lgpl-2.1.php' => 'lgpl_2_1',
( run in 2.074 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )