Skip to content

Instantly share code, notes, and snippets.

@phuedx
Last active August 29, 2015 14:16
Show Gist options
  • Save phuedx/5fe813967b2265003757 to your computer and use it in GitHub Desktop.
Save phuedx/5fe813967b2265003757 to your computer and use it in GitHub Desktop.
Notes from pairing with @MaxSem on getting WikiGrok working on mediawiki-vagrant.

Before enabling the wikidata role and provisioning set refreshonly = false in the wikidata-populate-site-tables in /path/to/mediawiki-vagrant/puppet/modules/role/manifests/wikidata.pp to ensure that SiteMatrix is up to date.

vagrant enable-role wikidata && vagrant provision

Ensure that Wikidata has appeared in the SiteMatrix (http://en.wiki.local.wmftest.net:8080/wiki/Special:SiteMatrix).

vagrant provision doesn't notice schema updates so: vagrant ssh -- foreachwiki update.php --quick

Create a property, e.g. "instance of". Make sure that it has Data type: item.

Create three items, e.g. "Maybeshewill", "band", "awesome band".

Create a new claim on one item using the property and one of the remaining items, e.g. "Maybeshewill" "instance of" "band"

Create a new slow campaign that finds items with this claim, e.g.

<?php

// /path/to/mediawiki-vagrant/settings.d/10-WikiGrok.php

$wgWikiGrokSlowCampaigns = array(
    'Maybeshewill' => array(
        'type' => 'Simple',
        'property' => 'P1' /* instance of */,
        'ifAll' => array(
            'P2' /* instance of */ => 'Q2' /* band */,
        ),
        'suggestions' => array( 'Q3' /* awesome band */ ),
    ),
);

Link the item with the claim to an article on the default wiki, e.g. http://en.wiki.local.wmftest.net:8080/wiki/Maybeshewill.

Edit the article.

Observe that mw.config.get('wgWikiGrokCampaigns') has been populated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment