[SCM] librdf-ns-perl Debian packaging branch, master, updated. debian/20130208-1-22-g47de138

Jakob Voss voss at gbv.de
Fri Apr 19 13:28:41 UTC 2013


The following commit has been merged in the master branch:
commit a00ad5d7a07d01f117e9157ffae99212d380ad39
Merge: 9933b2e82dd21118b2f0ac4e490742ba4df98fe0 cd2ceb9bf7e1f9699889b65ed74f0d17dc085ebd
Author: Jakob Voss <voss at gbv.de>
Date:   Thu Nov 24 11:42:30 2011 +0100

    Merge branch 'master' of github.com:nichtich/RDF-NS

diff --combined lib/RDF/NS.pm
index 69334d1,c7d4feb..8f99b03
--- a/lib/RDF/NS.pm
+++ b/lib/RDF/NS.pm
@@@ -5,12 -5,13 +5,12 @@@ package RDF::NS
  
  use Scalar::Util qw(blessed);
  use File::ShareDir;
 -use 5.10.0;
  
  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" ), @_ );
  }
@@@ -27,8 -28,8 +27,8 @@@ sub LOAD 
          chomp;
          next if /^#/;
          my ($prefix, $namespace) = split "\t", $_;
 -        if ( $prefix =~ /^(isa|can|new)$/ ) {
 -            warn "Cannot support prefix $prefix!" if $warn;
 +        if ( $prefix =~ /^(isa|can|new|uri)$/ ) {
 +            warn "Cannot support prefix '$prefix'" if $warn;
              next;
          } elsif ( $prefix =~ /^[a-z][a-z0-9]*$/ ) {
              if ( $namespace =~ /^[a-z][a-z0-9]*:[^"<>]*$/ ) {
@@@ -44,6 -45,16 +44,16 @@@
      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->{$_}."> ." } , @_ );
@@@ -59,6 -70,11 +69,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->{$_} } , @_ );
@@@ -85,7 -101,7 +100,7 @@@ sub GET 
  sub URI {
      my $self = shift;
      return unless shift =~ /^([a-z][a-z0-9]*)?([:_]([^:]+))?$/;
 -    my $ns = $self->{$1 // ''};
 +    my $ns = $self->{ defined $1 ? $1 : '' };
      return unless defined $ns;
      return $self->GET($ns) unless $3;
      return $self->GET($ns.$3);
@@@ -93,9 -109,9 +108,9 @@@
  
  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;
 +    my $local = defined $3 ? $3 : shift;
      return $self->GET($ns) unless defined $local;
      return $self->GET($ns.$local);
  }
@@@ -104,8 -120,8 +119,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
@@@ -118,7 -134,7 +133,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
@@@ -142,11 -158,17 +157,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>.
  
@@@ -186,6 -208,10 +207,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

-- 
librdf-ns-perl Debian packaging



More information about the Pkg-perl-cvs-commits mailing list