[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:42 UTC 2013


The following commit has been merged in the master branch:
commit c272b76c5a1c03dec3ebfcd2c0f99b577c74072b
Author: Jakob Voss <jakob at nichtich.de>
Date:   Thu Dec 8 11:49:12 2011 +0100

    20111208

diff --git a/Changes b/Changes
index e216172..bb218f0 100644
--- a/Changes
+++ b/Changes
@@ -1,8 +1,12 @@
+20111208 (716 prefixes)
+  added: calli,dwc,eunis,georss,pna,swpatho,voidp
+  introduced blank nodes in RDF::NS::Trine
+  extended command line tool to expand QNames
 20111124 (709 prefixes)
   added: gnd,grs,htir,infosys,muto,omapi,prf,webbox
   changed: commerce
   removed: uri
-  changed command line tool option syntax
+  modified command line tool option syntax
 20111102 (702 prefixes) 
   new command line tool 'rdfns'
   added: vsw
diff --git a/README b/README
index df06407..6d2184e 100644
--- a/README
+++ b/README
@@ -16,7 +16,7 @@ for easy reuse without having to download them in every application.
 
 In short, you can get a full prefix-to-namespace mapping as blessed hash with
 
-    RDF::NS->new('20111124')
+    RDF::NS->new('20111208')
 
 The only argument to the constructor is the version number, that is equivalent
 to the date of a particular snapshot. The changelog in the file Changes lists
diff --git a/bin/rdfns b/bin/rdfns
index 47f448f..c9f43e6 100755
--- a/bin/rdfns
+++ b/bin/rdfns
@@ -19,7 +19,10 @@ foreach my $a (@ARGV) {
         $version = $a;
         next;
     }
-    if ( $a =~ s/\.([^.]+)$// ) {
+    my $ns = RDF::NS->new($version);
+	if ( $a =~ /:/ ) {
+    	print map { $ns->URI($_)."\n" } split(/[|, ]+/, $a);
+    } elsif ( $a =~ s/\.([^.]+)$// ) {
         my $f = $1;
         if ( $f =~ $RDF::NS::FORMATS ) {
             $format = $f;
@@ -27,15 +30,16 @@ foreach my $a (@ARGV) {
             print STDERR "Unknown format: $f\n";
         }
     }
-    print map {"$_\n"} RDF::NS->new($version)->FORMAT( $format, $a );
+    print map {"$_\n"} $ns->FORMAT( $format, $a );
 }
 
 __DATA__
-USAGE: rdfns { [YYYYMMDD] <prefix[es]>[.format] }+
+USAGE: rdfns { [YYYYMMDD] ( <prefix[es]>[.format] | prefix:name ) }+
 
   formats: txt, sparql, ttl, n3, xmlns
  
   examples:
     rdfns 20111102 foaf,owl.ttl
     rdfns foaf.xmlns foaf.n3
+	rdfns rdfs:seeAlso
 
diff --git a/dist.ini b/dist.ini
index 4574ab7..66055cb 100644
--- a/dist.ini
+++ b/dist.ini
@@ -1,6 +1,6 @@
 name             = RDF-NS
 license          = Perl_5
-version          = 20111124
+version          = 20111208
 copyright_year   = 2011
 author           = Jakob Voss
 copyright_holder = Jakob Voss
diff --git a/lib/RDF/NS.pm b/lib/RDF/NS.pm
index be96df4..18c4c29 100644
--- a/lib/RDF/NS.pm
+++ b/lib/RDF/NS.pm
@@ -103,8 +103,13 @@ sub GET {
     $_[1];
 }
 
+sub BLANK {
+}
+
 sub URI {
     my $self = shift;
+	return $1 if $_[0] =~ /^<([a-zA-Z][a-zA-Z+.-]*:.+)>$/;
+	return $self->BLANK($_[0]) if $_[0] =~ /^_(:.*)?$/;
     return unless shift =~ /^([a-z][a-z0-9]*)?([:_]([^:]+))?$/;
     my $ns = $self->{ defined $1 ? $1 : '' };
     return unless defined $ns;
@@ -114,7 +119,8 @@ sub URI {
 
 sub AUTOLOAD {
     my $self = shift;
-    return unless $AUTOLOAD =~ /^.*::([a-z][a-z0-9]*)(_([^:]+))?$/;
+    return unless $AUTOLOAD =~ /^.*::([a-z][a-z0-9]*)?(_([^:]+)?)?$/;
+	return $self->BLANK( defined $3 ? "_:$3" : '_' ) unless $1;
     my $ns = $self->{$1} or return;
     my $local = defined $3 ? $3 : shift;
     return $self->GET($ns) unless defined $local;
@@ -125,21 +131,25 @@ sub AUTOLOAD {
 
 =head1 SYNOPSIS
 
-  use RDF::NS '20111124';              # check at compile time
-  my $ns = RDF::NS->new('20111124');   # check at runtime
+  use RDF::NS '20111208';              # check at compile time
+  my $ns = RDF::NS->new('20111208');   # check at runtime
 
   $ns->foaf;               # http://xmlns.com/foaf/0.1/
   $ns->foaf_Person;        # http://xmlns.com/foaf/0.1/Person
   $ns->foaf('Person');     # http://xmlns.com/foaf/0.1/Person
   $ns->URI('foaf:Person'); # http://xmlns.com/foaf/0.1/Person
 
+  use RDF::NS;             # get rid if typing '$' by defining a constant
+  use constant NS => RDF::NS->new('20111208');
+  NS->foaf_Person;         # http://xmlns.com/foaf/0.1/Person
+
   $ns->SPAQRL('foaf');     # PREFIX foaf: <http://xmlns.com/foaf/0.1/>
   $ns->TTL('foaf');        # @prefix foaf: <http://xmlns.com/foaf/0.1/> .
   $ns->XMLNS('foaf');      # xmlns:foaf="http://xmlns.com/foaf/0.1/"
 
   # To get RDF::Trine::Node::Resource instead of strings
   use RDF::NS::Trine;
-  $ns = RDF::NS::Trine->new('20111124');
+  $ns = RDF::NS::Trine->new('20111208');
   $ns->foaf_Person;        # iri('http://xmlns.com/foaf/0.1/Person')
 
   # load your own mapping
@@ -190,10 +200,12 @@ include C<warn> to enable warnings.
 Load namespace mappings from a particular tab-separated file. See NEW for 
 supported options.
 
-=method URI ( $short )
+=method URI ( $short | "<$URI>" )
 
-Expand a prefixed URI, such as C<foaf:Person>. Alternatively you can expand
-prefixed URIs with method calls, such as C<$ns-E<gt>foaf_Person>.
+Expand a prefixed URI, such as C<foaf:Person> or C<foaf_Person>. Alternatively 
+you can expand prefixed URIs with method calls, such as C<$ns-E<gt>foaf_Person>.
+If you pass an URI wrapped in C<E<lt>> and C<E<gt>>, it will not be expanded
+but returned as given.
 
 =method TTL ( prefix[es] )
 
diff --git a/lib/RDF/NS/Trine.pm b/lib/RDF/NS/Trine.pm
index 73f720f..ab1f3fc 100644
--- a/lib/RDF/NS/Trine.pm
+++ b/lib/RDF/NS/Trine.pm
@@ -4,6 +4,7 @@ package RDF::NS::Trine;
 #ABSTRACT: Popular RDF namespace prefixes from prefix.cc as RDF::Trine nodes
 
 use RDF::Trine::Node::Resource;
+use RDF::Trine::Node::Blank;
 
 use parent 'RDF::NS';
 
@@ -11,24 +12,32 @@ sub GET {
     RDF::Trine::Node::Resource->new($_[1]);
 }
 
+sub BLANK {
+	RDF::Trine::Node::Blank->new($2) if $_[1] =~ /^_(:(.*))?$/;
+}
+
 1;
 
 =head1 SYNOPSIS
 
   use RDF::NS::Trine;
+  use constant NS => RDF::NS::Trine->new('20111208');
 
-  my $ns = RDF::NS::Trine->new('20111124');
+  NS->foaf_Person;        # a RDF::Trine::Node::Resource
+  NS->URI('foaf:Person);  # same
+  NS->foaf_Person->uri;   # http://xmlns.com/foaf/0.1/Person
 
-  $ns->foaf_Person;        # a RDF::Trine::Node::Resource
-  $ns->URI('foaf:Person);  # same
-  $ns->foaf_Person->uri;   # http://xmlns.com/foaf/0.1/Person
+  NS->_;                  # a RDF::Trine::Node::Blank
+  NS->_abc;               # a blank node with id 'abc'
+  NS->URI('_:abc');       # same
 
 =head1 DESCRIPTION
 
 In contrast to L<RDF::NS>, which should be consulted for documentation, this
-returns no plain string URIs but instances of L<RDF::Trine::Node::Resource>.
+returns no plain string URIs but instances of L<RDF::Trine::Node::Resource>
+or L<RDF::Trine::Node::Blank>.
 
 Before using this module, make sure to install L<RDF::Trine>, which is not
-automatically installed together with L<RDF::NS>!
+installed automatically together with L<RDF::NS>!
 
 =cut
diff --git a/share/20111124.txt b/share/20111208.txt
similarity index 98%
copy from share/20111124.txt
copy to share/20111208.txt
index f9f107c..7369d31 100644
--- a/share/20111124.txt
+++ b/share/20111208.txt
@@ -61,6 +61,7 @@ c4dm	http://purl.org/NET/c4dm/event.owl#
 c4n	http://vocab.deri.ie/c4n#
 c4o	http://purl.org/spar/c4o/
 cal	http://www.w3.org/2002/12/cal/ical#
+calli	http://callimachusproject.org/rdf/2009/framework#
 campsite	http://www.openlinksw.com/campsites/schema#
 card	http://www.ashutosh.com/test/
 care	http://eulersharp.sourceforge.net/2003/03swap/care#
@@ -170,6 +171,7 @@ dtype	http://www.linkedmodel.org/schema/dtype#
 dul	http://www.loa-cnr.it/ontologies/DUL.owl#
 dummy	http://hello.com/
 dv	http://rdf.data-vocabulary.org/#
+dwc	http://rs.tdwg.org/dwc/terms/
 ean	http://openean.kaufkauf.net/id/
 earl	http://www.w3.org/ns/earl#
 eat	http://www.awesomesauce.net/urmom/
@@ -185,6 +187,7 @@ es	http://eulersharp.sourceforge.net/2003/03swap/log-rules#
 esd	http://def.esd.org.uk/
 eu	http://eulersharp.sourceforge.net/2003/03swap/log-rules#
 eui	http://institutions.publicdata.eu/#
+eunis	http://eunis.eea.europa.eu/rdf/species-schema.rdf#
 event	http://purl.org/NET/c4dm/event.owl#
 events	http://eulersharp.sourceforge.net/2003/03swap/event#
 evopat	http://ns.aksw.org/Evolution/
@@ -225,6 +228,7 @@ geodata	http://sws.geonames.org/
 geoes	http://geo.linkeddata.es/resource/
 geographis	http://telegraphis.net/ontology/geography/geography#
 geonames	http://www.geonames.org/ontology#
+georss	http://www.georss.org/georss/
 geospecies	http://rdf.geospecies.org/ont/geospecies#
 geovocab	http://geovocab.org/
 gesis	http://lod.gesis.org/lodpilot/ALLBUS/vocab.rdf#
@@ -429,6 +433,7 @@ pmlp	http://inference-web.org/2.0/pml-provenance.owl#
 pmlr	http://inference-web.org/2.0/pml-relation.owl#
 pmlt	http://inference-web.org/2.0/pml-trust.owl#
 pmt	http://tipsy.googlecode.com/svn/trunk/vocab/pmt#
+pna	http://data.press.net/ontology/asset/
 pns	http://data.press.net/ontology/stuff/
 po	http://purl.org/ontology/po/
 pobo	http://purl.obolibrary.org/obo/
@@ -587,6 +592,7 @@ swh	http://plugin.org.uk/swh-plugins/
 swid	http://semanticweb.org/id/
 swivt	http://semantic-mediawiki.org/swivt/1.0#
 swp	http://www.w3.org/2004/03/trix/swp-2/
+swpatho	http://swpatho.ag-nbi.de/context/meta.owl#
 swrc	http://swrc.ontoware.org/ontology#
 swrl	http://www.w3.org/2003/11/swrl#
 swrlb	http://www.w3.org/2003/11/swrlb#
@@ -646,6 +652,7 @@ vivo	http://vivoweb.org/ontology/core#
 voaf	http://mondeca.com/foaf/voaf#
 voag	http://voag.linkedmodel.org/schema/voag#
 void	http://rdfs.org/ns/void#
+voidp	http://www.enakting.org/provenance/voidp/
 vote	http://www.rdfabout.com/rdf/schema/vote/
 vs	http://www.w3.org/2003/06/sw-vocab-status/ns#
 vso	http://purl.org/vso/ns#
diff --git a/t/namespaces.t b/t/namespaces.t
index 05760fb..3eb1285 100644
--- a/t/namespaces.t
+++ b/t/namespaces.t
@@ -12,6 +12,7 @@ my $rdfs = 'http://www.w3.org/2000/01/rdf-schema#';
 my $ns = RDF::NS->new('20111028');
 
 is( $ns->rdf, $rdf, '$ns->rdf' );
+is( $ns->rdf_, $rdf, '$ns->rdf_' );
 is( $ns->rdf_type, $rdf.'type', '$ns->rdf_type' );
 is( $ns->rdf_type('x'), $rdf.'type', '$ns->rdf_type' );
 is( $ns->rdf('f-o'), $rdf."f-o", '$ns->rdf("f-o")' );
@@ -19,6 +20,7 @@ is( $ns->rdf(0), $rdf."0", '$ns->rdf("0")' );
 
 is( $ns->URI("rdf:type"), $rdf.'type', '$ns->URI("rdf:type")' );
 is( $ns->URI("rdf_type"), $rdf.'type', '$ns->URI("rdf_type")' );
+is( $ns->URI("<rdf:type>"), "rdf:type", '$ns->URI("<rdf:type>")' );
 
 # scalar context
 is( $ns->SPARQL('rdf'), "PREFIX rdf: <$rdf>", 'SPARQL("rdf")' );
@@ -55,4 +57,11 @@ is( $ns->URI(":foo"), "http://example.org/foo", "empty prefix allowed" );
 $ns = bless( { 'x' => 'http://example.org/' }, 'RDF::NS');
 is( $ns->x_alice, "http://example.org/alice", "blessed alone, one-letter prefix" );
 
+# blanks
+is( $ns->_abc, undef );
+is( $ns->_, undef );
+is( $ns->URI('_:xy'), undef );
+is( $ns->URI('_:'), undef );
+is( $ns->URI('_'), undef );
+
 done_testing;
diff --git a/t/trine.t b/t/trine.t
index f96afad..079ea24 100644
--- a/t/trine.t
+++ b/t/trine.t
@@ -29,4 +29,14 @@ is( $ns->SPARQL('rdf'), "PREFIX rdf: <$rdf>", 'SPARQL("rdf")' );
 is( $ns->TTL('rdfs'), "\@prefix rdfs: <$rdfs> .", 'TTL("rdfs")' );
 is( $ns->XMLNS('rdfs'), "xmlns:rdfs=\"$rdfs\"", 'XMLNS("rdfs")' );
 
+# blank nodes
+my $b = $ns->URI('_:xy');
+isa_ok( $b, 'RDF::Trine::Node::Blank' );
+is( $b->blank_identifier, 'xy', 'blank node' );
+$b = $ns->_abc;
+is( $b->blank_identifier, 'abc', 'blank node' );
+isa_ok( $ns->URI('_:'), 'RDF::Trine::Node::Blank' );
+isa_ok( $ns->URI('_'), 'RDF::Trine::Node::Blank' );
+isa_ok( $ns->_, 'RDF::Trine::Node::Blank' );
+
 done_testing;

-- 
librdf-ns-perl Debian packaging



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