[SCM] librdf-ns-perl Debian packaging branch, master, updated. debian/20130208-1-22-g47de138
Jakob Voss
jakob at nichtich.de
Fri Apr 19 13:28:41 UTC 2013
The following commit has been merged in the master branch:
commit cd2ceb9bf7e1f9699889b65ed74f0d17dc085ebd
Merge: d0a2d89428667b991720e1e2d8f1fa8fa5605cfd 5c2c0b072014c1fec47d6651ed48ea838cc6dba6
Author: Jakob Voss <jakob at nichtich.de>
Date: Thu Nov 24 11:41:10 2011 +0100
Merge branch 'master' of github.com:nichtich/RDF-NS
diff --combined dist.ini
index f417cb4,3cbed8c..44e875d
--- a/dist.ini
+++ b/dist.ini
@@@ -1,6 -1,6 +1,6 @@@
name = RDF-NS
license = Perl_5
-version = 20111031
+version = 20111102
copyright_year = 2011
author = Jakob Voss
copyright_holder = Jakob Voss
@@@ -31,7 -31,7 +31,7 @@@ filename = lib/aut
match = ^.*\.bak$
[MetaResources]
- repository.url = https://github.com/gbv/RDF-NS
- repository.web = https://github.com/gbv/RDF-NS
- bugtracker.web = https://github.com/gbv/RDF-NS/issues
+ repository.url = https://github.com/nichtich/RDF-NS
+ repository.web = https://github.com/nichtich/RDF-NS
+ bugtracker.web = https://github.com/nichtich/RDF-NS/issues
repository.type = git
diff --combined lib/RDF/NS.pm
index 92063af,687415d..c7d4feb
--- a/lib/RDF/NS.pm
+++ b/lib/RDF/NS.pm
@@@ -11,7 -11,7 +11,7 @@@ our $AUTOLOAD
sub new {
my $class = shift;
- my $version = shift;
+ my $version = shift || 'undef';
$version = $RDF::NS::VERSION if $version eq 'any';
LOAD( $class, File::ShareDir::dist_file('RDF-NS', "$version.txt" ), @_ );
}
@@@ -45,16 -45,6 +45,16 @@@ sub LOAD
bless $ns, $class;
}
+sub FORMAT {
+ my $self = shift;
+ my $format = shift;
+ $format = 'TTL' if $format =~ /^n(otation)?3$/i;
+ if ($format =~ /^(ttl|n3|sparql|txt)$/i) {
+ $format = uc($format);
+ $self->$format( @_ );
+ }
+}
+
sub TTL {
my $self = shift;
$self->MAP( sub { "\@prefix $_: <".$self->{$_}."> ." } , @_ );
@@@ -70,11 -60,6 +70,11 @@@ sub XMLNS
$self->MAP( sub { "xmlns:$_=\"".$self->{$_}."\"" } , @_ );
}
+sub TXT {
+ my $self = shift;
+ $self->MAP( sub { "$_\t".$self->{$_} } , @_ );
+}
+
sub SELECT {
my $self = shift;
$self->MAP( sub { $_ => $self->{$_} } , @_ );
@@@ -109,7 -94,7 +109,7 @@@ sub URI
sub AUTOLOAD {
my $self = shift;
- return unless $AUTOLOAD =~ /:([a-z][a-z0-9]*)(_([^:]+))?$/;
+ return unless $AUTOLOAD =~ /^.*::([a-z][a-z0-9]*)_([^:]+))?$/;
my $ns = $self->{$1} or return;
my $local = $3 // shift;
return $self->GET($ns) unless defined $local;
@@@ -120,8 -105,8 +120,8 @@@
=head1 SYNOPSIS
- use RDF::NS '20111031'; # check at compile time
- my $ns = RDF::NS->new('20111031'); # check at runtime
+ use RDF::NS '20111102'; # check at compile time
+ my $ns = RDF::NS->new('20111102'); # check at runtime
$ns->foaf; # http://xmlns.com/foaf/0.1/
$ns->foaf_Person; # http://xmlns.com/foaf/0.1/Person
@@@ -134,7 -119,7 +134,7 @@@
# To get RDF::Trine::Node::Resource instead of strings
use RDF::NS::Trine;
- $ns = RDF::NS::Trine->new('20111031');
+ $ns = RDF::NS::Trine->new('20111102');
$ns->foaf_Person; # iri('http://xmlns.com/foaf/0.1/Person')
# load your own mapping
@@@ -158,17 -143,11 +158,17 @@@ defined at specific snapshots in time.
numbers of this module. By selecting particular versions, you make sure that
changes at prefix.cc won't affect your scripts.
-This module does not require L<RDF::Trine> which is recommended nevertheless.
+The command line client L<rdfns> is installed automatically with this module:
+
+ $ rdfns -ttl rdf,foaf
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+
+This module does not require L<RDF::Trine>, which is recommended nevertheless.
If you prefer RDF::NS to return instances of L<RDF::Trine::Node::Resource>
instead of plain strings, use L<RDF::NS::Trine>.
-The code repository of this module contains an
+The code repository of this module also contains an
L<update script|https://github.com/nichtich/RDF-NS/blob/master/update.pl>
to download the current prefix-namespace mappings from L<http://prefix.cc>.
@@@ -208,10 -187,6 +208,10 @@@ Returns an XML namespace declaration o
context. Prefixes can be passed as single arguments or separated by commas,
vertical bars, and spaces.
+=method TXT ( prefix[es] )
+
+Returns a list of tabular-separated prefix-namespace-mappings.
+
=method SELECT ( prefix[es] )
In list context, returns a sorted list of prefix-namespace pairs, which
@@@ -236,6 -211,7 +236,7 @@@ it just returns C<$uri> unmodified
There are several other CPAN modules to deal with IRI namespaces, for instance
L<RDF::Trine::Namespace>, L<RDF::Trine::NamespaceMap>, L<RDF::Prefixes>,
- L<RDF::Simple::NS>, L<RDF::RDFa::Parser::Profile::PrefixCC> etc.
+ L<RDF::Simple::NS>, L<RDF::RDFa::Parser::Profile::PrefixCC>,
+ L<Class::RDF::NS>, L<XML::Namespace>, L<XML::CommonNS> etc.
=cut
--
librdf-ns-perl Debian packaging
More information about the Pkg-perl-cvs-commits
mailing list