Finds the experts in a Lotus Domino forum.

It ranks posters by the number of posts and preferrentially for responses to threads that they didn't start. The theory is that experts aren't going to post root level threads so often but will be highly present in responses to other's threads. It only displays the top ten percent of the authors,

use strict; use warnings; use Notes::OLE; use List::Util qw( max min ); use vars qw( %AUTHORS %PARENTS %FROM ); $| = 1; main( @ARGV ); exit 0; sub main { my $db = $S->GetDatabase( $_[0] || 'Notes1/NotesWeb', $_[1] || 'ei +forum' ); my $count = 0; dc_all( $db->AllDocuments, sub { my $doc = shift; my $unid = $doc->UniversalID; my $from = abbrev( $doc->{'From'}[0] ); $FROM{ $unid } = $from; { my $children = $doc->Responses; if ( $children->Count ) { dc_all( $children, sub { my $parent = $_[0]->{'$REF'}[0]; $PARENTS{ $_[0]->UniversalID } = $parent } ); } } push @{ $AUTHORS{ $from } }, $unid; } ); my %author_scores; for my $author ( keys %AUTHORS ) { my $score = 0; for my $node ( @{ $AUTHORS{ $author } } ) { $score += ( root_node( $node ) eq $node ? 2 : 1 ); } $author_scores{ $author } = $score; } for my $author ( reverse +( sort { $author_scores{$a} <=> $author_scores{$b} } keys %author_scores )[ keys( %author_scores ) +* .9 .. keys( %author_scores ) +- 1 ] ) { printf "% 4d $author\n", $author_scores{ $author }; } 0; } sub root_node { my $unid = shift; while ( exists $PARENTS{ $unid } ) { $unid = $PARENTS{ $unid }; } $unid; } sub abbrev { my $name = shift; $name =~ s/(?<!\w)(?:CN|OU?)=//g; $name; }

In reply to Compute "experts" on Lotus Domino forums by diotalevi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.