Bots


 * 1) !/usr/bin/env perl

use strict;

use lib '../rrb.old/snpedia/bots'; use Perlwikipedia;
 * 1) Use a library available from
 * 2) http://code.google.com/p/perlwikipedia/

my $bot = Perlwikipedia->new; $bot->set_wiki('smw.referata.com','/wiki/'); $bot->login("CariasoBot","CariasoBot!"); $bot->{verbose} = 1;
 * 1) create a bot

my $old = $bot->get_text('Minutes_for_November_22_2008_SMW_Users_Meeting_at_Monitor_Group'); print "Here is what I read $old\n";
 * 1) grab the text from a page

my @people = (   {'firstname'=>'Mike', 'lastname'=>'Cariaso', 'phone'=>'415-449-0743'},    {'firstname'=>'Dave', 'lastname'=>'Forgianni', 'phone'=>'617-834-8565'},    {'firstname'=>'Rich', 'lastname'=>'Slezak'}, );
 * 1) pretend we read this data from a DB/website/tab delimited file

foreach my $person (@people) { my $firstname = $person->{firstname}; my $lastname = $person->{lastname}; my $phone    = $person->{phone};
 * 1) generate some wikitext for each person and write to the wiki

# generate template wikitext for the new page my $newtext = " ";

my $pagetitle = "$firstname $lastname"; print "storing $pagetitle\n"; $bot->edit($pagetitle, $newtext); }


 * 1) This shows all of the Attendees, including ones that may have been loaded by others

my @pagetitles = $bot->get_pages_in_category('Category:Attendees');

foreach my $attendee (@pagetitles) { my $pagetext = $bot->get_text($attendee);

my ($phone) = $pagetext =~ /\|\s*phone\s*=\s*([-\d. ]+)/; print "Attendee $attendee $phone\n"; }

output
188:rrb cariaso$ ./ademobot.pl Here is what I read On a frosty morning in Cambride MA some 30 people gathered at the Monitor Group's office in 2 Canal Park.

First topic, how to make SMW better known internationally and gain usage.

One possible forum, ..... (lots more text) .......
 * And maybe what we need is a CNS (like the DNS) a Concept Naming System. An analog is MOAT (Meaning of a Tag)
 * Mayo will post a link to examples of how RDF, RDFS, SKOS, etc. tags might be referenced from a wiki. (For a rather broken preview, see: http://www.wiktolog.com/agrowiki/index.php?title=Main_Page)

bug report

bots

storing Mike Cariaso storing Dave Forgianni storing Rich Slezak Attendee Dave Forgianni 617-834-8565 Attendee Mike Cariaso 415-449-0743 Attendee Rich Slezak Attendee Steven Forth

which generated these pages Mike Cariaso, Dave Forgianni, Rich Slezak