Skip to content

Not quite working well yet, as the server side is still evolving, but a useful skeleton for my next round of improvement. http://bugzilla.wikimedia.org/show_bug.cgi?id=45303

License

Notifications You must be signed in to change notification settings

cariaso/Semantic-MediaWiki-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MediaWiki::Bot::Plugin::Semantic
==========================

This is Semantic, a Mediawiki::Bot plugin designed to for data retrieval from  Semantic Mediawiki ( http://semantic-mediawiki.org/ ).


SYNOPSIS


my $hostname = 'localhost';
my $botparams = {
		 protocol => 'http',
		 host => $hostname,
		 path => '/',

		};

my $bot = MediaWiki::Bot->new($botparams);


my $title = 'Other Page';
my $beforetext = $bot->get_text($title);

my $addendum = "*More Text\n";
my $newtext = $beforetext . $addendum;

my $login = $bot->login({
		 username    => $username,
		 password    => $password,
		}) or die("unable to login");


$response = $bot->edit({
        page    => $title,
        text    => $newtext,
        summary => 'Adding new content',
    });



foreach my $title ('Larry',
		   'Moe',
		   'Curly') {
  my $text = "[[Stooge::Yes]]\n";

  $response = $bot->edit({
    			  page    => $title,
			  Text    => $text,
			  summary => 'Adding new content',
			 });

}




my $results1 = $bot->ask({
			  format=>'simplified',
			  query=>"[[Stooge::+]]
|?Stooge
",
});

ok $results1 , "got a response from $hostname";

foreach my $row (@$results1) {
	print Dumper $row;
}










my $bot = MediaWiki::Bot->new();
$bot->set_wiki({
    protocol => 'http',
    host => 'bots.snpedia.com',
    path => '/',
                   });

my $results1 = $bot->ask({
    query=>"[[Category:Is a genotype]] [[On chromosome::1]]
|?Allele1
|?Allele2
|limit=500",
                        });



# Output format still reflects the raw JSON response, and is likely to change in the future. 

use Data::Dumper;
print Dumper $results1;
print Dumper $results2;



METHODS

  ask
  askargs


INSTALLATION

To install this module type the following:

   perl Makefile.PL
   make
   make test
   make install

Some of the test scripts included with this distribution of Semantic
require a working Internet connection. If the test phase will not
complete because you do not have access to bots.snpedia.com, you can
(probably) safely install the module anyway.


MINIMAL INSTALL

CPAN can often a trigger a huge dependency cascade. While trying to
build a bug report for someone else I found this to be a minimal
path to testing from a fresh amazon cloud image

    sudo yum -y install make cpan perl-JSON git
    git clone git://github.com/cariaso/Semantic-MediaWiki-Bot.git
    git clone git://github.com/MediaWiki-Bot/MediaWiki-Bot.git
    wget http://cpansearch.perl.org/src/EXOBUZZ/MediaWiki-API-0.37/lib/MediaWiki/API.pm -O MediaWiki-Bot/lib/MediaWiki/API.pm
    export PERL5LIB=MediaWiki-Bot/lib/:Semantic-MediaWiki-Bot/lib/
    perl Semantic-MediaWiki-Bot/t/02-jdd-test.t

DEPENDENCIES

This module requires these other modules and libraries:

MediaWiki::API

In addition, you must have MediaWiki::Bot version 1.5.2 or greater for plugin support.

COPYRIGHT AND LICENCE

Copyright (C) 2012 Michael Cariaso

This library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY.  See the GNU General Public License for more
details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

About

Not quite working well yet, as the server side is still evolving, but a useful skeleton for my next round of improvement. http://bugzilla.wikimedia.org/show_bug.cgi?id=45303

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages