[librdf-generator-void-perl] 01/10: Add progress tracking

Jonas Smedegaard dr at jones.dk
Sun May 18 12:37:42 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag dev-release-0.13_1
in repository librdf-generator-void-perl.

commit 72df6bf52784fc6fc152ac951c5eec3be587cf9a
Author: Kjetil Kjernsmo <kjetil at kjernsmo.net>
Date:   Wed Jul 17 11:19:19 2013 +0200

    Add progress tracking
---
 lib/App/perlrdf/Command/Void.pm |  3 +++
 lib/RDF/Generator/Void/Stats.pm | 11 +++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/App/perlrdf/Command/Void.pm b/lib/App/perlrdf/Command/Void.pm
index 11e34b3..a83ab36 100644
--- a/lib/App/perlrdf/Command/Void.pm
+++ b/lib/App/perlrdf/Command/Void.pm
@@ -1,6 +1,9 @@
 package App::perlrdf::Command::Void;
 
 use strict;
+use Progress::Any::Output;
+Progress::Any::Output->set('TermProgressBarColor');
+
 use warnings;
 use utf8;
 
diff --git a/lib/RDF/Generator/Void/Stats.pm b/lib/RDF/Generator/Void/Stats.pm
index 25d2d97..e2462c0 100644
--- a/lib/RDF/Generator/Void/Stats.pm
+++ b/lib/RDF/Generator/Void/Stats.pm
@@ -1,4 +1,5 @@
 package RDF::Generator::Void::Stats;
+use Progress::Any;
 
 use 5.006;
 use strict;
@@ -81,8 +82,12 @@ sub BUILD {
 
 	# Initialize local hashes to count stuff.
 	my (%vocab_counter, %entities, %properties, %subjects, %objects, %classes);
-
+	my $progress = Progress::Any->get_indicator(task => "compute");
+	$progress->pos(0);
+ 
 	my $gen = $self->generator;
+	$progress->target($gen->inmodel->size);
+
 	# Here, we take the data in the model we want to generate
 	# statistics for and we iterate over it. Doing it this way, we
 	# should be able to generate all statistics in a single pass of the
@@ -125,8 +130,10 @@ sub BUILD {
 			$properties{$st->predicate->uri_value}{'countsubjects'}{$st->subject->sse} = 1;
 			$properties{$st->predicate->uri_value}{'countobjects'}{$st->object->sse} = 1;
 		}
-
+		$progress->update(message => "Triple examined");
 	});
+	$progress->finish;
+
 
 	# Finally, we update the attributes above, they are returned as a side-effect
 	$self->vocabularies(\%vocab_counter);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/librdf-generator-void-perl.git



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