diff --git a/build/count_scopes.pl b/build/count_scopes.pl deleted file mode 100755 index c20240c1..00000000 --- a/build/count_scopes.pl +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl -w - -use Xalan; - -open(XML, xalanCall . " -IN ../xml/ukfederation-metadata-unsigned.xml -XSL extract_scopes.xsl|") || die "could not open input file"; -while () { - # print $_; - chop; - my $scope = $_; - $scopes{$scope} = 1; -} -close XML; - -print scalar(keys(%scopes)), "\n"; diff --git a/charting/scopes.pl b/charting/scopes.pl new file mode 100755 index 00000000..3e1a151d --- /dev/null +++ b/charting/scopes.pl @@ -0,0 +1,43 @@ +#!/usr/bin/perl -w + +# +# scopes.pl +# +# Extracts statistics about number of scopes from the published metadata. +# +use lib "../build"; +use Xalan; +use Months; + +# Parse command line arguments +use Getopt::Long; +my $allMonths; +GetOptions('all' => \$allMonths); + +# By default, only show results for the most recent month +if (!$allMonths) { + # reduce months table to one element + my $oneMonth = pop @months; + @months = ( $oneMonth ); +} + +# ingest files +foreach $month (@months) { + my $fn = "cache/$month.xml"; + my %scopes; + open(TXT, xalanCall . " -IN $fn -XSL scopes.xsl|") || die "could not open input file"; + while () { + chop; + my $scope = $_; + $scopes{$scope} = 1; + } + push @count, scalar(keys(%scopes)); + close TXT; +} + +print "count\n"; +foreach $n (@count) { + print "$n\n"; +} + +1; \ No newline at end of file diff --git a/build/extract_scopes.xsl b/charting/scopes.xsl similarity index 77% rename from build/extract_scopes.xsl rename to charting/scopes.xsl index 221a1d2d..23954cef 100644 --- a/build/extract_scopes.xsl +++ b/charting/scopes.xsl @@ -1,22 +1,20 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">