Commits

Toby Inkster  committed a817f64

Plugin infrastructure for RDF::Trine - early stages

  • Participants

Comments (0)

Files changed (11)

+use inc::Module::Package 'RDF:standard';
+

File lib/RDF/TrineX.pm

+package RDF::TrineX;
+
+use 5.008;
+use constant { FALSE => 0, TRUE => 1 };
+use utf8;
+
+BEGIN {
+	$RDF::TrineX::AUTHORITY = 'cpan:TOBYINK';
+	$RDF::TrineX::VERSION   = '0.001';
+}
+
+use authority::shared q<http://www.perlrdf.org/>;
+
+use Module::Pluggable
+	search_path => [qw/RDF::Trine::Model RDF::TrineX::Model/],
+	require     => 1,
+	inner       => 0,
+	sub_name    => 'list_models';
+use Module::Pluggable
+	search_path => [qw/RDF::Trine::Store RDF::TrineX::Store/],
+	require     => 1,
+	inner       => 0,
+	sub_name    => 'list_stores';
+use Module::Pluggable
+	search_path => [qw/RDF::Trine::Parser RDF::TrineX::Parser/],
+	require     => 1,
+	inner       => 0,
+	sub_name    => 'list_parsers';
+use Module::Pluggable
+	search_path => [qw/RDF::Trine::Serializer RDF::TrineX::Serializer/],
+	require     => 1,
+	inner       => 0,
+	sub_name    => 'list_serializers';
+use Module::Pluggable
+	search_path => [qw/RDF::Trine::Importer RDF::TrineX::Importer/],
+	require     => 1,
+	inner       => 0,
+	sub_name    => 'list_importers';
+use Module::Pluggable
+	search_path => [qw/RDF::Trine::Exporter RDF::TrineX::Exporter/],
+	require     => 1,
+	inner       => 0,
+	sub_name    => 'list_exporters';
+use Module::Pluggable
+	search_path => [qw/RDF::Trine::Node RDF::TrineX::Node/],
+	require     => 1,
+	inner       => 0,
+	sub_name    => 'list_node_types';
+use Module::Pluggable
+	search_path => [qw/RDF::TrineX::Util/],
+	require     => 1,
+	inner       => 0,
+	sub_name    => 'list_utilities';
+	
+sub plugin_data
+{
+	my ($info, $model) = @_;
+	$model = RDF::Trine::Model->new unless defined $model;
+	$info  = $info->plugin_info unless ref $info eq 'HASH';
+	
+	
+	
+	return $model;
+}
+
+TRUE;
+
+__END__
+
+=head1 NAME
+
+RDF::TrineX - hooks for RDF::Trine plugins
+
+=head1 DESCRIPTION
+
+ say foreach RDF::TrineX->list_serializers;
+
+=head2 Class Methods
+
+=over
+
+=item C<< list_models >>
+
+=item C<< list_stores >>
+
+=item C<< list_parsers >>
+
+=item C<< list_serializers >>
+
+=item C<< list_importers >>
+
+=item C<< list_exporters >>
+
+=item C<< list_node_types >>
+
+=item C<< list_utilities >>
+
+=back
+
+=head1 BUGS
+
+Please report any bugs to
+L<http://rt.cpan.org/Dist/Display.html?Queue=RDF-TrineX>.
+
+=head1 SEE ALSO
+
+L<RDF::Trine>, L<http://perlrdf-wiki.buzzword.org.uk/api>.
+
+=head1 AUTHOR
+
+Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
+
+=head1 COPYRIGHT AND LICENCE
+
+This software is copyright (c) 2011 by Toby Inkster.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=head1 DISCLAIMER OF WARRANTIES
+
+THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+

File lib/RDF/TrineX/Plugin.pm

+package RDF::TrineX;
+
+use 5.008;
+use constant { FALSE => 0, TRUE => 1 };
+use utf8;
+
+BEGIN {
+	$RDF::TrineX::Plugin::AUTHORITY = 'cpan:TOBYINK';
+	$RDF::TrineX::Plugin::VERSION   = '0.001';
+}
+
+use authority::shared q<http://www.perlrdf.org/>;
+
+use Carp 0 qw(); # don't pollute subclass namespace
+
+sub plugin_info
+{
+	my ($package) = @_;
+	$package = ref $package if ref $package;
+	Carp::carp("$package has not implemented plugin_info");
+	return {
+		package   => $package,
+		version   => $package->VERSION,
+		authority => [ $package->AUTHORITY ? ($package->AUTHORITY) : () ],
+		};
+}
+
+TRUE;
+
+__END__
+
+=head1 NAME
+
+RDF::TrineX::Plugin - base class for RDF::Trine plugins
+
+=head1 DESCRIPTION
+
+=head2 Methods
+
+=over
+
+=item C<< plugin_info >>
+
+Returns a hashref of plugin metadata.
+
+=back
+
+=head1 SEE ALSO
+
+L<RDF::TrineX>.
+
+=head1 AUTHOR
+
+Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
+
+=head1 COPYRIGHT AND LICENCE
+
+This software is copyright (c) 2011 by Toby Inkster.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=head1 DISCLAIMER OF WARRANTIES
+
+THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+

File meta/changes.ttl

+# This file acts as the project's changelog.
+
+@prefix :        <http://usefulinc.com/ns/doap#> .
+@prefix dcs:     <http://ontologi.es/doap-changeset#> .
+@prefix dc:      <http://purl.org/dc/terms/> .
+@prefix dist:    <http://purl.org/NET/cpan-uri/dist/RDF-TrineX/> .
+@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
+
+dist:project :release dist:v_0-001 .
+dist:v_0-001
+	a               :Version ;
+	dc:issued       "2011-11-08"^^xsd:date ;
+	:revision       "0.001"^^xsd:string ;
+	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/RDF-TrineX-0.001.tar.gz> ;
+	rdfs:label      "Initial release" .
+

File meta/doap.ttl

+# This file contains general metadata about the project.
+
+@prefix :        <http://usefulinc.com/ns/doap#> .
+@prefix dc:      <http://purl.org/dc/terms/> .
+@prefix foaf:    <http://xmlns.com/foaf/0.1/> .
+@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
+
+<http://purl.org/NET/cpan-uri/dist/RDF-TrineX/project>
+	a               :Project ;
+	:programming-language "Perl" ;
+	:name           "RDF-TrineX" ;
+	:shortdesc      "a module that does something-or-other" ;
+	:homepage       <https://metacpan.org/release/RDF-TrineX> ;
+	:download-page  <https://metacpan.org/release/RDF-TrineX> ;
+	:bug-database   <http://rt.cpan.org/Dist/Display.html?Queue=RDF-TrineX> ;
+	:created        "2011-11-08"^^xsd:date ;
+	:license        <http://dev.perl.org/licenses/> ;
+	:developer      [ a foaf:Person ; foaf:name "Toby Inkster" ; foaf:mbox <mailto:tobyink@cpan.org> ] .
+
+<http://dev.perl.org/licenses/>
+	dc:title        "the same terms as the perl 5 programming language system itself" .
+

File meta/makefile.ttl

+# This file provides instructions for packaging.
+
+@prefix : <http://purl.org/NET/cpan-uri/terms#> .
+
+<http://purl.org/NET/cpan-uri/dist/RDF-TrineX/project>
+	:perl_version_from _:main ;
+	:version_from _:main ;
+	:readme_from _:main ;
+	:test_requires "Test::More 0.61" ;
+	:requires "Scalar::Util" , "common::sense" .
+
+_:main <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName> "lib/RDF/TrineX.pm" .
+
+use Test::More tests => 1;
+BEGIN { use_ok('RDF::TrineX') };
+
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+all_pod_files_ok();
+

File xt/02pod_coverage.t

+use Test::More;
+use Test::Pod::Coverage;
+
+my @modules = qw(RDF::TrineX);
+pod_coverage_ok($_, "$_ is covered")
+	foreach @modules;
+done_testing(scalar @modules);
+

File xt/03meta_uptodate.t

+use Test::More tests => 1;
+use Test::RDF::DOAP::Version;
+doap_version_ok('RDF-TrineX', 'RDF::TrineX');
+
+use Test::EOL;
+all_perl_files_ok();