-
Notifications
You must be signed in to change notification settings - Fork 0
/
WikidataTest.php
40 lines (29 loc) · 1.04 KB
/
WikidataTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
require 'boz-mw/autoload-with-laser-cannon.php';
// load a dedicated configuration - it will create that if missing
config_wizard('configWikidata.php');
$wikidata = wiki('wikidatawiki');
// this object registers your proposed changes
$newdata = $wikidata->createDataModel();
$timeObject = new \DateTime();
$timeObject->setTimezone(new \DateTimeZone('UTC'));
$timeObject->setDate(2016, 6, 19);
$timeObject->setTime(9, 3, 36);
$timeString = "+2016-06-19T09:03:36Z";
// Set P571 (inception date)
$statement = new \wb\StatementTime("P571", $timeString, 11);
$newdata->addClaim($statement);
// Set P2002 (Twitter external ID)
/* $statement = new \wb\StatementExternalID("P2002", "testaccount");
$newdata->addClaim($statement); */
/*
$newdata->setLabelValue('en', "New label");
$newdata->setDescriptionValue('en', "New Description");
*/
$wikidata->login();
// this tries to save all your proposed changes in the Wikidata Sandbox
$newdata->editEntity([
'id' => 'Q4115189',
'summary' => "Test time precision with boz-mw",
]);
print("Done.\n");