Commits

Toby Inkster  committed 61c8eab Draft

general refresh

  • Participants
  • Parent commits 85cc981

Comments (0)

Files changed (17)

File Changes

-############################################################################
-## Changes #################################################################
-############################################################################
-
-RDF-Query-Functions-Buzzword-GB
-===============================
-
-Created:      2011-07-13
-Home page:    <http://search.cpan.org/dist/RDF-Query-Functions-Buzzword-GB/>
-Bug tracker:  <http://rt.cpan.org/Dist/Display.html?Queue=RDF-Query-Functions-Buzzword-GB>
-Maintainer:   Toby Inkster <mailto:tobyink@cpan.org>
-
-0.001 [2011-07-13]
-

File Changes.ttl

-#############################################################
-
-@prefix :        <http://usefulinc.com/ns/doap#> .
-@prefix dcs:     <http://ontologi.es/doap-changeset#> .
-@prefix dc:      <http://purl.org/dc/terms/> .
-@prefix foaf:    <http://xmlns.com/foaf/0.1/> .
-@prefix my:      <http://purl.org/NET/cpan-uri/dist/RDF-Query-Functions-Buzzword-GB/> .
-@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix toby:    <http://tobyinkster.co.uk/#> .
-@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
-
-#############################################################
-
-<>
-
-	dc:title         "Changes" ;
-	dc:description   "Revision history for Perl extension RDF::Query::Functions::Buzzword::GB."@en ;
-	dc:subject       my:project ;
-	dc:creator       toby:i .
-
-#############################################################
-
-my:v_0-001
-
-	a               :Version ;
-	dc:issued       "2011-07-13"^^xsd:date ;
-	:revision       "0.001"^^xsd:string ;
-	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/RDF-Query-Functions-Buzzword-GB-0.001.tar.gz> ;
-	rdfs:comment    "Original version"@en .
-
-#############################################################
-
-my:project
-
-	a               :Project ;
-	:name           "RDF-Query-Functions-Buzzword-GB" ;
-	:shortdesc      "plugin for buzzword.org.uk UK-specific functions"@en ;
-	:programming-language  "Perl" ;
-	:homepage       <https://metacpan.org/release/RDF-Query-Functions-Buzzword-GB> ;
-	:download-page  <https://metacpan.org/release/RDF-Query-Functions-Buzzword-GB> ;
-	:bug-database   <http://rt.cpan.org/Dist/Display.html?Queue=RDF-Query-Functions-Buzzword-GB> ;
-	:repository     [ a :SVNRepository ; :browse <http://goddamn.co.uk/svn-web/perlmods/browse/RDF-Query-Functions-Buzzword-GB/> ] ;
-	:maintainer     toby:i ;
-	:developer      toby:i ;
-	:documenter     toby:i ;
-	:tester         toby:i ;
-	:created        "2011-07-13"^^xsd:date ;
-	:license        <http://dev.perl.org/licenses/> ;
-	:release        my:v_0-001 ;
-	rdfs:seeAlso    <http://buzzword.org.uk/2011/functions/gb> .
-
-#############################################################
-
-toby:i
-
-	a               foaf:Person ;
-	foaf:name       "Toby Inkster" ;
-	foaf:homepage   <http://tobyinkster.co.uk/> ;
-	foaf:page       <https://metacpan.org/author/TOBYINK> ;
-	foaf:mbox       <mailto:tobyink@cpan.org> ;
-	<http://www.w3.org/2002/07/owl#sameAs> <http://purl.org/NET/cpan-uri/person/tobyink> .
-
-#############################################################

File Changes.xml

-<?xml version="1.0" encoding="utf-8"?>
-<rdf:RDF xmlns:dbug="http://ontologi.es/doap-bugs#" xmlns:dc="http://purl.org/dc/terms/" xmlns:dcs="http://ontologi.es/doap-changeset#" xmlns:doap="http://usefulinc.com/ns/doap#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
-<rdf:Description rdf:nodeID="rD08A784CAD9611E0BDACA531A2B30CCDr0">
-	<doap:browse rdf:resource="http://goddamn.co.uk/viewvc/perlmods/RDF-Query-Functions-Buzzword-GB/"/>
-	<rdf:type rdf:resource="http://usefulinc.com/ns/doap#SVNRepository"/>
-</rdf:Description>
-<rdf:Description rdf:about="file:///home/tai/src/perlmods/RDF-Query-Functions-Buzzword-GB/Changes.ttl">
-	<dc:creator rdf:resource="http://tobyinkster.co.uk/#i"/>
-	<dc:description xml:lang="en">Revision history for Perl extension RDF::Query::Functions::Buzzword::GB.</dc:description>
-	<dc:subject rdf:resource="http://purl.org/NET/cpan-uri/dist/RDF-Query-Functions-Buzzword-GB/project"/>
-	<dc:title>Changes</dc:title>
-</rdf:Description>
-<rdf:Description rdf:about="http://purl.org/NET/cpan-uri/dist/RDF-Query-Functions-Buzzword-GB/project">
-	<doap:bug-database rdf:resource="http://rt.cpan.org/Dist/Display.html?Queue=RDF-Query-Functions-Buzzword-GB"/>
-	<doap:created rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2011-07-13</doap:created>
-	<doap:developer rdf:resource="http://tobyinkster.co.uk/#i"/>
-	<doap:documenter rdf:resource="http://tobyinkster.co.uk/#i"/>
-	<doap:download-page rdf:resource="http://search.cpan.org/dist/RDF-Query-Functions-Buzzword-GB/"/>
-	<doap:homepage rdf:resource="http://search.cpan.org/dist/RDF-Query-Functions-Buzzword-GB/"/>
-	<doap:license rdf:resource="http://dev.perl.org/licenses/"/>
-	<doap:maintainer rdf:resource="http://tobyinkster.co.uk/#i"/>
-	<doap:name>RDF-Query-Functions-Buzzword-GB</doap:name>
-	<doap:programming-language>Perl</doap:programming-language>
-	<doap:release rdf:resource="http://purl.org/NET/cpan-uri/dist/RDF-Query-Functions-Buzzword-GB/v_0-001"/>
-	<doap:repository rdf:nodeID="rD08A784CAD9611E0BDACA531A2B30CCDr0"/>
-	<doap:shortdesc xml:lang="en">plugin for buzzword.org.uk UK-specific functions</doap:shortdesc>
-	<doap:tester rdf:resource="http://tobyinkster.co.uk/#i"/>
-	<rdf:type rdf:resource="http://usefulinc.com/ns/doap#Project"/>
-	<rdfs:seeAlso rdf:resource="http://buzzword.org.uk/2011/functions/gb"/>
-</rdf:Description>
-<rdf:Description rdf:about="http://purl.org/NET/cpan-uri/dist/RDF-Query-Functions-Buzzword-GB/v_0-001">
-	<dc:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2011-07-13</dc:issued>
-	<doap:file-release rdf:resource="http://backpan.cpan.org/authors/id/T/TO/TOBYINK/RDF-Query-Functions-Buzzword-GB-0.001.tar.gz"/>
-	<doap:revision rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0.001</doap:revision>
-	<rdf:type rdf:resource="http://usefulinc.com/ns/doap#Version"/>
-	<rdfs:comment xml:lang="en">Original version</rdfs:comment>
-</rdf:Description>
-<rdf:Description xmlns:ns1="http://www.w3.org/2002/07/owl#" rdf:about="http://tobyinkster.co.uk/#i">
-	<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
-	<ns1:sameAs rdf:resource="http://purl.org/NET/cpan-uri/person/tobyink"/>
-	<foaf:homepage rdf:resource="http://tobyinkster.co.uk/"/>
-	<foaf:mbox rdf:resource="mailto:tobyink@cpan.org"/>
-	<foaf:name>Toby Inkster</foaf:name>
-	<foaf:page rdf:resource="http://search.cpan.org/~tobyink/"/>
-</rdf:Description>
-</rdf:RDF>

File MANIFEST.SKIP

-^MANIFEST.bak$
-^Makefile.old$
-^Makefile$
-^blib/
-^pm_to_blib
-^blibdirs
-\.svn
-^example.*\.pl$
-^[^/]+\.(tar\.gz|tar\.bz2|tgz|tbz2|tbz|zip|tar)$
-^MYMETA.yml

File META.yml

----
-abstract: ~
-author:
-  - 'Toby Inkster <tobyink@cpan.org>'
-build_requires:
-  ExtUtils::MakeMaker: 6.42
-  Test::More: 0.61
-configure_requires:
-  ExtUtils::MakeMaker: 6.42
-distribution_type: module
-generated_by: 'Module::Install version 1.00'
-keywords:
-  - SPARQL
-  - query
-  - extension
-  - functions
-  - plugin
-  - RDF
-  - Semantic
-  - Web
-  - SemWeb
-  - United
-  - Kingdom
-  - Great
-  - Britain
-  - GB
-  - UK
-  - England
-  - Wales
-  - Scotland
-  - Ireland
-license: perl
-meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
-name: RDF-Query-Functions-Buzzword-GB
-no_index:
-  directory:
-    - inc
-    - t
-requires:
-  RDF::Query: 2.903
-  Scalar::Util: 0
-  common::sense: 0
-resources:
-  bugtracker: http://rt.cpan.org/Dist/Display.html?Queue=RDF-Query-Functions-Buzzword-GB
-  homepage: http://search.cpan.org/dist/RDF-Query-Functions-Buzzword-GB/
-  license: http://dev.perl.org/licenses/
-  repository: http://goddamn.co.uk/viewvc/perlmods/RDF-Query-Functions-Buzzword-GB/
-version: 0.001
-use strict;
-use warnings;
+use inc::Module::Package 'RDF 0.009';
 
-use inc::Module::Install;
-
-my $dist = 'RDF-Query-Functions-Buzzword-GB';
-my $fn   = "lib/$dist.pm"; $fn =~ s#-#/#g;
-
-name                $dist;
-perl_version_from   $fn;
-version_from        $fn;
-abstract_from       $fn;
-readme_from         $fn;
-author              'Toby Inkster <tobyink@cpan.org>';
-license             'perl';
-
-requires            'common::sense'      => 0;
-requires            'RDF::Query'         => '2.903';
-requires            'Scalar::Util'       => 0;
-test_requires       'Test::More'         => '0.61';
-
-resources(
-	'homepage'   => "https://metacpan.org/release/$dist",
-	'repository' => "http://goddamn.co.uk/svn-web/perlmods/browse/$dist/",
-	'bugtracker' => "http://rt.cpan.org/Dist/Display.html?Queue=$dist",
-	);
-
-keywords(qw[SPARQL query extension functions plugin RDF Semantic Web SemWeb United Kingdom Great Britain GB UK England Wales Scotland Ireland]);
-
-write_doap_changes;
-write_doap_changes_xml;
-auto_license;
-auto_manifest;
-
-auto_install;
-WriteAll(
-	'meta' => 1,
-	'sign' => 1,
-	);

File README

-NAME
-    RDF::Query::Functions::Buzzword::Util - plugin for buzzword.org.uk
-    utility functions
-
-SYNOPSIS
-      use RDF::TrineShortcuts qw[:all];
-      use Data::Dumper;
-  
-      my $data = rdf_parse(<<'TURTLE', type=>'turtle');
-      @prefix foaf: <http://xmlns.com/foaf/0.1/> .
-      @prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-  
-      <http://tobyinkster.co.uk/#i>
-        foaf:name  "Toby Inkster" ;
-        foaf:phone "0123456789 ext 1234" .
-      TURTLE
-  
-      $r = rdf_query(<<'SPARQL', $data);
-      PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-      PREFIX gb: <http://buzzword.org.uk/2011/functions/gb#>
-      SELECT
-        ?name
-        (gb:telephone_uri(?phone) AS ?phoneuri)
-      WHERE
-      {
-        ?person foaf:name ?name ; foaf:phone ?phone .
-      }
-      SPARQL
-  
-      print Dumper(flatten_iterator($r, literal_as=>'ntriples'));
-
-DESCRIPTION
-    This is a plugin for RDF::Query providing a number of extension
-    functions.
-
-    *   http://buzzword.org.uk/2011/functions/gb#postcode_valid
-
-        Given a literal, returns a boolean indicating whether it seems to be
-        a syntactically valid UK postcode.
-
-    *   http://buzzword.org.uk/2011/functions/gb#postcode_format
-
-        Given a literal, if it seems to be a valid UK postcode,
-        canonicalises the formatting; otherwise returns the literal
-        unscathed.
-
-    *   http://buzzword.org.uk/2011/functions/gb#telephone_valid
-
-        Given a literal, returns a boolean indicating whether it seems to be
-        a number that could be dialed from a UK phone.
-
-        Only the digits '0' to '9', letter 'x' (extension) and '+'
-        (international dialing code) are expected. Other characters are
-        stripped out before any checks.
-
-    *   http://buzzword.org.uk/2011/functions/gb#telephone_format
-
-        Canonicalises the formatting of a phone number that is valid. Should
-        return invalid phone numbers unscathed.
-
-    *   http://buzzword.org.uk/2011/functions/gb#telephone_std
-
-        Returns the STD code for a phone number, if it could be extracted;
-        the empty string otherwise.
-
-    *   http://buzzword.org.uk/2011/functions/gb#telephone_local
-
-        Returns the local part of a phone number, if it could be extracted;
-        the empty string otherwise.
-
-    *   http://buzzword.org.uk/2011/functions/gb#telephone_extension
-
-        Returns the extension from a phone number, if it could be extracted;
-        the empty string otherwise.
-
-    *   http://buzzword.org.uk/2011/functions/gb#telephone_uri
-
-        Returns a phone number as a <tel:> URI.
-
-        An existing <tel:> URI should pass through unscathed.
-
-SEE ALSO
-    RDF::Query.
-
-    <http://perlrdf.org/>.
-
-AUTHOR
-    Toby Inkster <tobyink@cpan.org>.
-
-COPYRIGHT
-    Copyright 2004-2011 Toby Inkster
-
-    This library is free software; you can redistribute it and/or modify it
-    under the same terms as Perl itself.
-

File example1.pl

-use lib "lib";
-use RDF::TrineShortcuts qw[:all];
-use Data::Dumper;
-
-my $data = rdf_parse(<<'TURTLE', type=>'turtle');
-@prefix foaf: <http://xmlns.com/foaf/0.1/> .
-@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-
-<http://tobyinkster.co.uk/#i>
-	foaf:name "Toby Inkster" ;
-	foaf:phone "01234567890x1234" , "118.247", <tel:123>;
-	foaf:postcode "bn71rs" .
-TURTLE
-
-print Dumper(flatten_iterator(rdf_query(<<'SPARQL', $data), literal_as=>'ntriples'));
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX sparql: <sparql:>
-PREFIX gb: <http://buzzword.org.uk/2011/functions/gb#>
-PREFIX util: <http://buzzword.org.uk/2011/functions/util#>
-SELECT
-	?name
-	?phone
-	?postcode
-	(gb:postcode_format(?postcode) AS ?pcfmt)
-#	(gb:telephone_std(?phone) AS ?phonestd)
-#	(gb:telephone_local(?phone) AS ?phonelocal)
-#	(gb:telephone_extension(?phone) AS ?phoneext)
-	(gb:telephone_uri(?phone) AS ?phoneuri)
-WHERE
-{
-	?person foaf:name ?name ; foaf:phone ?phone ; foaf:postcode ?postcode .
-}
-SPARQL
-
-

File examples/eg1.pl

+use RDF::Query;
+use RDF::TrineX::Functions -shortcuts;
+
+my $data = rdf_parse(<<'TURTLE', type=>'turtle', base=>'http://example.com/');
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+
+<http://tobyinkster.co.uk/#i>
+	foaf:name "Toby Inkster" ;
+	foaf:phone "01234567890x1234";
+	foaf:postcode "bn71rs" .
+TURTLE
+
+my $query = RDF::Query->new(<<'SPARQL');
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX sparql: <sparql:>
+PREFIX gb: <http://buzzword.org.uk/2011/functions/gb#>
+PREFIX util: <http://buzzword.org.uk/2011/functions/util#>
+SELECT
+	?name
+	?phone
+	?postcode
+	(gb:postcode_format(?postcode) AS ?pcfmt)
+	(gb:telephone_std(?phone) AS ?phonestd)
+	(gb:telephone_local(?phone) AS ?phonelocal)
+	(gb:telephone_extension(?phone) AS ?phoneext)
+	(gb:telephone_uri(?phone) AS ?phoneuri)
+WHERE
+{
+	?person foaf:name ?name ; foaf:phone ?phone ; foaf:postcode ?postcode .
+}
+SPARQL
+
+print $query->execute($data)->as_xml;

File lib/RDF/Query/Functions/Buzzword/GB.pm

 package RDF::Query::Functions::Buzzword::GB;
 
-our $VERSION = '0.001';
+our $VERSION = '0.002';
 
-use common::sense;
+use strict;
 use RDF::Query::Error qw(:try);
 use RDF::Trine::Namespace qw[XSD];
 use Scalar::Util qw[blessed];
 
 =head1 NAME
 
-RDF::Query::Functions::Buzzword::Util - plugin for buzzword.org.uk utility functions
+RDF::Query::Functions::Buzzword::GB - plugin for buzzword.org.uk British locale-specific functions
 
 =head1 SYNOPSIS
 
-  use RDF::TrineShortcuts qw[:all];
-  use Data::Dumper;
-  
-  my $data = rdf_parse(<<'TURTLE', type=>'turtle');
+  use RDF::Query;
+  use RDF::TrineX::Functions -shortcuts;
+
+  my $data = rdf_parse(<<'TURTLE', type=>'turtle', base=>$baseuri);
   @prefix foaf: <http://xmlns.com/foaf/0.1/> .
   @prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-  
+
   <http://tobyinkster.co.uk/#i>
-    foaf:name  "Toby Inkster" ;
-    foaf:phone "0123456789 ext 1234" .
+    foaf:name "Toby Inkster" ;
+    foaf:phone "01234567890x1234";
+    foaf:postcode "bn71rs" .
   TURTLE
-  
-  $r = rdf_query(<<'SPARQL', $data);
+
+  my $query = RDF::Query->new(<<'SPARQL');
   PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+  PREFIX sparql: <sparql:>
   PREFIX gb: <http://buzzword.org.uk/2011/functions/gb#>
+  PREFIX util: <http://buzzword.org.uk/2011/functions/util#>
   SELECT
     ?name
+    ?phone
+    ?postcode
+    (gb:postcode_format(?postcode) AS ?pcfmt)
+    (gb:telephone_std(?phone) AS ?phonestd)
+    (gb:telephone_local(?phone) AS ?phonelocal)
+    (gb:telephone_extension(?phone) AS ?phoneext)
     (gb:telephone_uri(?phone) AS ?phoneuri)
   WHERE
   {
-    ?person foaf:name ?name ; foaf:phone ?phone .
+    ?person foaf:name ?name ; foaf:phone ?phone ; foaf:postcode ?postcode .
   }
   SPARQL
-  
-  print Dumper(flatten_iterator($r, literal_as=>'ntriples'));
+
+  print $query->execute($data)->as_xml;
 
 =head1 DESCRIPTION
 
 
 L<RDF::Query>.
 
-L<http://perlrdf.org/>.
+L<http://www.perlrdf.org/>.
 
 =head1 AUTHOR
 
 
 =head1 COPYRIGHT
 
-Copyright 2004-2011 Toby Inkster
+Copyright 2004-2012 Toby Inkster
 
 This library is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

File meta/changes.pret

+# This file acts as the project's changelog.
+
+`RDF-Query-Functions-Buzzword-GB 0.001 cpan:TOBYINK`
+	issued  2011-07-13;
+	label   "Initial release".
+
+`RDF-Query-Functions-Buzzword-GB 0.002 cpan:TOBYINK`
+	issued  2011-09-11;
+	changeset [
+		item "Modernize."^^Packaging;
+		item "Drop common::sense dependency."^^Packaging;
+		item "Don't use deprecated RDF::TrineShortcuts in examples."^^Documentation;
+		item "Fix NAME section in pod."^^Documentation;
+	].

File meta/doap.pret

+# This file contains general metadata about the project.
+
+@prefix : <http://usefulinc.com/ns/doap#>.
+
+`RDF-Query-Functions-Buzzword-GB`
+	:programming-language "Perl" ;
+	:shortdesc            "plugin for buzzword.org.uk British locale-specific functions";
+	:homepage             <https://metacpan.org/release/RDF-Query-Functions-Buzzword-GB>;
+	:download-page        <https://metacpan.org/release/RDF-Query-Functions-Buzzword-GB>;
+	:bug-database         <http://rt.cpan.org/Dist/Display.html?Queue=RDF-Query-Functions-Buzzword-GB>;
+	:repository           [ a :HgRepository; :browse <https://bitbucket.org/tobyink/p5-rdf-query-functions-buzzword-gb> ];
+	:created              2011-07-13;
+	:license              <http://dev.perl.org/licenses/>;
+	:maintainer           cpan:TOBYINK;
+	:developer            cpan:TOBYINK.
+
+<http://dev.perl.org/licenses/>
+	dc:title  "the same terms as the perl 5 programming language system itself".
+
+cpan:TOBYINK
+	foaf:name  "Toby Inkster";
+	foaf:mbox  <mailto:tobyink@cpan.org>.
+

File meta/makefile.pret

+# This file provides instructions for packaging.
+
+`RDF-Query-Functions-Buzzword-GB`
+	perl_version_from m`RDF::Query::Functions::Buzzword::GB`;
+	version_from      m`RDF::Query::Functions::Buzzword::GB`;
+	readme_from       m`RDF::Query::Functions::Buzzword::GB`;
+	requires          p`RDF::Query 2.903`;
+	test_requires     p`Test::More 0.61`.
+
+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::Query::Functions::Buzzword::GB);
+pod_coverage_ok($_, "$_ is covered") for @modules;
+done_testing(scalar @modules);
+

File xt/03meta_uptodate.t

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