require_once "{$IP}/LocalSettings.php";
}
$start = 0;
if ($argv[2]) {
    $start = $argv[2];
}
require_once $IP . '/includes/Defines.php';
require_once 'includes/ProfilerStub.php';
require_once 'Setup.php';
$wgCommandLineMode = true;
$page_count = get_total_number_of_articles();
if ($page_count < $start) {
    fwrite(STDOUT, "-1");
    exit(1);
}
MwRdf::Setup();
$dbr = wfGetDB(DB_SLAVE);
$res = $dbr->query("\n\tSELECT page_id,\n\tpage_title,\n\tpage_namespace,\n\tpage_is_redirect\n\tFROM page\n\tORDER BY page_id\n\tLIMIT 200\n\tOFFSET {$start}");
while ($s = $dbr->fetchObject($res)) {
    if ($s->page_is_redirect) {
        continue;
    }
    $title = Title::makeTitle($s->page_namespace, $s->page_title);
    if (!$title) {
        continue;
    }
    $agent = MwRdf::ModelingAgent($title);
    fwrite(STDERR, $s->page_id . ": " . $title->getPrefixedDbKey());
    $agent->storeAllModels();
    $agent = null;
    $title = null;