Commits

Toby Inkster committed ad4d1e1 Draft

general update

  • Participants
  • Parent commits 729d572

Comments (0)

Files changed (18)

Changes

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

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-Util/> .
-@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::Util."@en ;
-	dc:subject       my:project ;
-	dc:creator       toby:i .
-
-#############################################################
-
-my:v_0-001
-
-	a               :Version ;
-	dc:issued       "2011-01-05"^^xsd:date ;
-	:revision       "0.001"^^xsd:string ;
-	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/RDF-Query-Functions-Buzzword-Util-0.001.tar.gz> ;
-	rdfs:comment    "Original version"@en .
-
-#############################################################
-
-my:project
-
-	a               :Project ;
-	:name           "RDF-Query-Functions-Buzzword-Util" ;
-	:shortdesc      "plugin for buzzword.org.uk utility functions"@en ;
-	:programming-language  "Perl" ;
-	:homepage       <https://metacpan.org/release/RDF-Query-Functions-Buzzword-Util> ;
-	:download-page  <https://metacpan.org/release/RDF-Query-Functions-Buzzword-Util> ;
-	:bug-database   <http://rt.cpan.org/Dist/Display.html?Queue=RDF-Query-Functions-Buzzword-Util> ;
-	:repository     [ a :SVNRepository ; :browse <http://goddamn.co.uk/svn-web/perlmods/browse/RDF-Query-Functions-Buzzword-Util/> ] ;
-	:maintainer     toby:i ;
-	:developer      toby:i ;
-	:documenter     toby:i ;
-	:tester         toby:i ;
-	:created        "2011-01-04"^^xsd:date ;
-	:license        <http://dev.perl.org/licenses/> ;
-	:release        my:v_0-001 ;
-	rdfs:seeAlso    <http://buzzword.org.uk/2011/functions/util> .
-
-#############################################################
-
-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> .
-
-#############################################################

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="rE7ACE3C818A111E084309E47CFDE21D6r0">
-	<doap:browse rdf:resource="http://goddamn.co.uk/viewvc/perlmods/RDF-Query-Functions-Buzzword-Util/"/>
-	<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-Util/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::Util.</dc:description>
-	<dc:subject rdf:resource="http://purl.org/NET/cpan-uri/dist/RDF-Query-Functions-Buzzword-Util/project"/>
-	<dc:title>Changes</dc:title>
-</rdf:Description>
-<rdf:Description rdf:about="http://purl.org/NET/cpan-uri/dist/RDF-Query-Functions-Buzzword-Util/project">
-	<doap:bug-database rdf:resource="http://rt.cpan.org/Dist/Display.html?Queue=RDF-Query-Functions-Buzzword-Util"/>
-	<doap:created rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2011-01-04</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-Util/"/>
-	<doap:homepage rdf:resource="http://search.cpan.org/dist/RDF-Query-Functions-Buzzword-Util/"/>
-	<doap:license rdf:resource="http://dev.perl.org/licenses/"/>
-	<doap:maintainer rdf:resource="http://tobyinkster.co.uk/#i"/>
-	<doap:name>RDF-Query-Functions-Buzzword-Util</doap:name>
-	<doap:programming-language>Perl</doap:programming-language>
-	<doap:release rdf:resource="http://purl.org/NET/cpan-uri/dist/RDF-Query-Functions-Buzzword-Util/v_0-001"/>
-	<doap:repository rdf:nodeID="rE7ACE3C818A111E084309E47CFDE21D6r0"/>
-	<doap:shortdesc xml:lang="en">plugin for buzzword.org.uk utility 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/util"/>
-</rdf:Description>
-<rdf:Description rdf:about="http://purl.org/NET/cpan-uri/dist/RDF-Query-Functions-Buzzword-Util/v_0-001">
-	<dc:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2011-01-05</dc:issued>
-	<doap:file-release rdf:resource="http://backpan.cpan.org/authors/id/T/TO/TOBYINK/RDF-Query-Functions-Buzzword-Util-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>

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

META.yml

----
-abstract: 'plugin for buzzword.org.uk utility functions'
-author:
-  - 'Toby Inkster <tobyink@cpan.org>'
-build_requires:
-  ExtUtils::MakeMaker: 6.42
-  Module::Signature: 0.66
-  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
-  - utilities
-  - utility
-  - plugin
-  - RDF
-  - Semantic
-  - Web
-  - SemWeb
-license: perl
-meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
-name: RDF-Query-Functions-Buzzword-Util
-no_index:
-  directory:
-    - inc
-    - t
-requires:
-  Data::UUID: 0
-  RDF::Query: 2.903
-  Scalar::Util: 0
-  XML::LibXML: 1.60
-  common::sense: 0
-resources:
-  bugtracker: http://rt.cpan.org/Dist/Display.html?Queue=RDF-Query-Functions-Buzzword-Util
-  homepage: http://search.cpan.org/dist/RDF-Query-Functions-Buzzword-Util/
-  license: http://dev.perl.org/licenses/
-  repository: http://goddamn.co.uk/viewvc/perlmods/RDF-Query-Functions-Buzzword-Util/
-version: 0.001
-use strict;
-use warnings;
+use inc::Module::Package 'RDF 0.009';
 
-use inc::Module::Install;
-
-my $dist = 'RDF-Query-Functions-Buzzword-Util';
-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            'Data::UUID'         => 0;
-requires            'RDF::Query'         => '2.903';
-requires            'Scalar::Util'       => 0;
-test_requires       'Test::More'         => '0.61';
-requires            'XML::LibXML'        => '1.60';
-
-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 utilities utility plugin RDF Semantic Web SemWeb]);
-
-write_doap_changes;
-write_doap_changes_xml;
-auto_license;
-auto_manifest;
-
-auto_install;
-WriteAll(
-	'meta' => 1,
-	'sign' => 1,
-	);

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:page [ foaf:name "Toby Inkster" ] ;
-        foaf:junk "Foo <ex xmlns=\"urn:junk\">Bar</ex>"^^rdf:XMLLiteral ;
-        foaf:mbox <mailto:tobyink@cpan.org> .
-      TURTLE
-  
-      $r = rdf_query(<<'SPARQL', $data);
-      PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-      PREFIX util: <http://buzzword.org.uk/2011/functions/util#>
-      PREFIX junk: <urn:junk> 
-      SELECT
-        ?name
-        (util:uc(?name) AS ?ucname)
-        (util:trim(util:sprintf(" I am %s "@en, ?name)) AS ?intro)
-        (util:skolem(?page, "oid") AS ?skolempage)
-        (util:preg_replace("t", "x", ?name, "ig") AS ?mangled)
-        (util:find_xpath("//junk:ex", ?junk, 0) AS ?found)
-      WHERE
-      {
-        ?person foaf:name ?name ; foaf:page ?page ; foaf:junk ?junk.
-      }
-      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/util#defragment
-
-    *   http://buzzword.org.uk/2011/functions/util#find_xpath
-
-    *   http://buzzword.org.uk/2011/functions/util#lc
-
-    *   http://buzzword.org.uk/2011/functions/util#ltrim
-
-    *   http://buzzword.org.uk/2011/functions/util#oid
-
-    *   http://buzzword.org.uk/2011/functions/util#oid_uri
-
-    *   http://buzzword.org.uk/2011/functions/util#preg_replace
-
-    *   http://buzzword.org.uk/2011/functions/util#rand
-
-    *   http://buzzword.org.uk/2011/functions/util#rtrim
-
-    *   http://buzzword.org.uk/2011/functions/util#skolem
-
-    *   http://buzzword.org.uk/2011/functions/util#sprintf
-
-    *   http://buzzword.org.uk/2011/functions/util#str_replace
-
-    *   http://buzzword.org.uk/2011/functions/util#trim
-
-    *   http://buzzword.org.uk/2011/functions/util#uc
-
-    *   http://buzzword.org.uk/2011/functions/util#uuid
-
-    *   http://buzzword.org.uk/2011/functions/util#uuid_uri
-
-SEE ALSO
-    RDF::Query.
-
-    <http://perlrdf.org/>.
-
-AUTHOR
-    Toby Inkster <tobyink@cpan.org>.
-
-COPYRIGHT
-    Copyright 2010-2011 Toby Inkster
-
-    This library is free software; you can redistribute it and/or modify it
-    under the same terms as Perl itself.
-

TODO

-TODO:
-* Add some more items to this list.
-* Add keywords to Makefile.PL

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:page [ foaf:name "Toby Inkster" ] ;
-	foaf:junk "Foo <ex xmlns=\"http://example.com/junk\">Bar</ex>"^^rdf:XMLLiteral ;
-	foaf:mbox <mailto:tobyink@cpan.org> .
-TURTLE
-
-print Dumper(flatten_iterator(rdf_query(<<'SPARQL', $data), literal_as=>'ntriples'));
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX util: <http://buzzword.org.uk/2011/functions/util#>
-PREFIX junk: <http://example.com/junk> 
-SELECT
-	?name
-	(util:uc(?name) AS ?ucname)
-	(util:trim(util:sprintf("   Je m'apelle %s   "@fr, ?name)) AS ?intro)
-	(util:skolem(?page, "oid") AS ?skolempage)
-	(util:preg_replace("t", "x", ?name, "ig") AS ?mangled)
-	(util:find_xpath("//junk:ex", ?junk, 0) AS ?found)
-WHERE
-{
-	?person foaf:name ?name ; foaf:page ?page ; foaf:junk ?junk.
-}
-SPARQL
-
-
+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:page [ foaf:name "Toby Inkster" ] ;
+	foaf:junk "Foo <ex xmlns=\"http://example.com/junk\">Bar</ex>"^^rdf:XMLLiteral ;
+	foaf:mbox <mailto:tobyink@cpan.org> .
+TURTLE
+
+my $query = RDF::Query->new(<<'SPARQL');
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX util: <http://buzzword.org.uk/2011/functions/util#>
+PREFIX junk: <http://example.com/junk> 
+SELECT
+	?name
+	(util:uc(?name) AS ?ucname)
+	(util:trim(util:sprintf("   Je m'apelle %s   "@fr, ?name)) AS ?intro)
+	(util:skolem(?page, "oid") AS ?skolempage)
+	(util:preg_replace("t", "x", ?name, "ig") AS ?mangled)
+	(util:find_xpath("//junk:ex", ?junk, 0) AS ?found)
+WHERE
+{
+	?person foaf:name ?name ; foaf:page ?page ; foaf:junk ?junk.
+}
+SPARQL
+
+my $results = $query->execute($data);
+print $results->as_xml;

lib/RDF/Query/Functions/Buzzword/Util.pm

 package RDF::Query::Functions::Buzzword::Util;
 
-our $VERSION = '0.001';
+our $VERSION = '0.002';
 
-use common::sense;
+use strict;
 use Data::UUID;
 use RDF::Query::Error qw(:try);
 use Scalar::Util qw(blessed reftype refaddr looks_like_number);
 
 =head1 SYNOPSIS
 
-  use RDF::TrineShortcuts qw[:all];
-  use Data::Dumper;
+  use RDF::TrineX::Functions -shortcuts;
   
-  my $data = rdf_parse(<<'TURTLE', type=>'turtle');
+  my $data = rdf_parse(<<'TURTLE', type => 'turtle', base => $base_uri);
   @prefix foaf: <http://xmlns.com/foaf/0.1/> .
   @prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
   
     foaf:mbox <mailto:tobyink@cpan.org> .
   TURTLE
   
-  $r = rdf_query(<<'SPARQL', $data);
+  my $query = RDF::Query->new(<<'SPARQL');
   PREFIX foaf: <http://xmlns.com/foaf/0.1/>
   PREFIX util: <http://buzzword.org.uk/2011/functions/util#>
   PREFIX junk: <urn:junk> 
   }
   SPARQL
   
-  print Dumper(flatten_iterator($r, literal_as=>'ntriples'));
+  print $query->execute($data)->as_xml;
 
 =head1 DESCRIPTION
 
 
 =back
 
+Some of these are somewhat close to new functions introduced in SPARQL 1.1.
+
 =head1 SEE ALSO
 
 L<RDF::Query>.
 
-L<http://perlrdf.org/>.
+L<http://www.perlrdf.org/>.
 
 =head1 AUTHOR
 
 
 =head1 COPYRIGHT
 
-Copyright 2010-2011 Toby Inkster
+Copyright 2010-2012 Toby Inkster
 
 This library is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.
+

meta/changes.pret

+# This file acts as the project's changelog.
+
+`RDF-Query-Functions-Buzzword-Util 0.001 cpan:TOBYINK`
+	issued  2011-01-05;
+	label   "Initial release".
+
+`RDF-Query-Functions-Buzzword-Util 0.002 cpan:TOBYINK`
+	issued  2012-09-11;
+	changeset [
+		item "Modernize"^^Packaging;
+	].
+# This file contains general metadata about the project.
+
+@prefix : <http://usefulinc.com/ns/doap#>.
+
+`RDF-Query-Functions-Buzzword-Util`
+	:programming-language "Perl" ;
+	:shortdesc            "plugin for buzzword.org.uk utility functions";
+	:homepage             <https://metacpan.org/release/RDF-Query-Functions-Buzzword-Util>;
+	:download-page        <https://metacpan.org/release/RDF-Query-Functions-Buzzword-Util>;
+	:bug-database         <http://rt.cpan.org/Dist/Display.html?Queue=RDF-Query-Functions-Buzzword-Util>;
+	:repository           [ a :HgRepository; :browse <https://bitbucket.org/tobyink/p5-rdf-query-functions-buzzword-util> ] ;
+	:created              2011-01-04;
+	:license              <http://dev.perl.org/licenses/>;
+	seealso               <http://buzzword.org.uk/2011/functions/util>;
+	: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>.
+

meta/makefile.pret

+# This file provides instructions for packaging.
+
+`RDF-Query-Functions-Buzzword-Util`
+	perl_version_from m`RDF::Query::Functions::Buzzword::Util`;
+	version_from      m`RDF::Query::Functions::Buzzword::Util`;
+	readme_from       m`RDF::Query::Functions::Buzzword::Util`;
+	test_requires     p`Test::More 0.61`;
+	test_requires     p`Data::UUID 0`;
+	test_requires     p`RDF::Query 2.903`;
+	test_requires     p`XML::LibXML 1.60`;
+.
+
+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();
+

xt/02pod_coverage.t

+use Test::More;
+use Test::Pod::Coverage;
+
+my @modules = qw(RDF::Query::Functions::Buzzword::Util);
+pod_coverage_ok($_, "$_ is covered") for @modules;
+done_testing(scalar @modules);
+

xt/03meta_uptodate.t

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