/usr/share/perl5/App/rdfns.pm is in librdf-ns-perl 20130930-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | use strict;
use warnings;
package App::rdfns;
{
$App::rdfns::VERSION = '20130930';
}
#ABSTRACT: quickly get common URI namespaces
#VERSION
use v5.10;
use RDF::NS;
sub new {
bless {}, shift;
}
sub run {
my ($self, @ARGV) = @_;
my $format = '';
my $version = 'any';
return $self->usage if !@ARGV or $ARGV[0] =~ /^(-[?h]|--help)$/;
return $self->version if $ARGV[0] =~ /^(-v|--version)$/;
foreach my $a (@ARGV) {
if ( $a =~ /^(\d{8})$/ ) {
$version = $a;
next;
}
my $ns = RDF::NS->new($version);
my $rev;
if ( $a =~ qr{^https?://} ) {
$rev ||= $ns->REVERSE;
say $rev->{$a} if $rev->{$a};
} elsif ( $a =~ /:/ ) {
print map { $ns->URI($_)."\n" } split(/[|, ]+/, $a);
} elsif ( $a =~ s/\.([^.]+)$// ) {
my $f = $1;
if ( $f eq 'prefix' ) {
$rev ||= $ns->REVERSE;
print map { "$_\n" if defined $_ } map {
$rev->{$_}
} $ns->FORMAT( $format, $a );
next;
} elsif ( $f =~ $RDF::NS::FORMATS ) {
$format = $f;
} else {
print STDERR "Unknown format: $f\n";
}
}
if ( lc($format) eq 'json' ) {
say join ",\n", $ns->FORMAT( $format, $a );
} else {
say $_ for $ns->FORMAT( $format, $a );
}
}
}
sub usage {
print <<'USAGE';
USAGE: rdfns { [YYYYMMDD] ( <prefix[es]>[.format] | prefix:name | URL ) }+
formats: txt, sparql, ttl, n3, xmlns, json, beacon, prefix
options: --help | --version
examples:
rdfns 20111102 foaf,owl.ttl
rdfns foaf.xmlns foaf.n3
rdfns rdfs:seeAlso
rdfns http://www.w3.org/2003/01/geo/wgs84_pos#
rdfns wgs.prefix
USAGE
0;
}
sub version {
print $RDF::NS::VERSION . "\n";
0;
}
1;
__END__
=pod
=head1 NAME
App::rdfns - quickly get common URI namespaces
=head1 VERSION
version 20130930
=head1 SEE ALSO
This module implements the command line client L<rdfns>.
=encoding utf8
=head1 AUTHOR
Jakob Voß
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Jakob Voß.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|