1
0

Wikidata.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <!DOCTYPE html>
  2. <html dir="ltr">
  3. <head>
  4. <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  5. <title>Dev/Command-line/Wikidata - XOWA</title>
  6. <link rel="shortcut icon" href="https://gnosygnu.github.io/xowa/xowa_logo.png" />
  7. <link rel="stylesheet" href="https://gnosygnu.github.io/xowa/xowa_common.css" type="text/css">
  8. <style data-source="xowa" type="text/css">
  9. .console {font-family: monospace; color: #EEEEEE ; background-color: black ; border: medium solid black;}
  10. .code
  11. ,.path
  12. ,.url {font-family: monospace; color: black ; background-color: #f9f9f9 ; border: medium solid #f9f9f9;}
  13. .bold {font-weight: 900;}
  14. </style>
  15. </head>
  16. <body class="mediawiki ltr sitedir-ltr ns-0 ns-subject skin-vector action-submit vector-animateLayout" spellcheck="false">
  17. <div id="mw-page-base" class="noprint"></div>
  18. <div id="mw-head-base" class="noprint"></div>
  19. <div id="content" class="mw-body">
  20. <h1 id="firstHeading" class="firstHeading"><span>Dev/Command-line/Wikidata</span></h1>
  21. <div id="bodyContent" class="mw-body-content">
  22. <div id="siteSub">From XOWA: the free, open-source, offline wiki application</div>
  23. <div id="contentSub"></div>
  24. <div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr">
  25. <div id="toc" class="toc">
  26. <div id="toctitle" class="toctitle">
  27. <h2>
  28. Contents
  29. </h2>
  30. </div>
  31. <ul>
  32. <li class="toclevel-1 tocsection-1">
  33. <a href="#Import_using_the_XML_dump"><span class="tocnumber">1</span> <span class="toctext">Import using the XML dump</span></a>
  34. </li>
  35. <li class="toclevel-1 tocsection-2">
  36. <a href="#Import_using_the_JSON_dump"><span class="tocnumber">2</span> <span class="toctext">Import using the JSON dump</span></a>
  37. </li>
  38. </ul>
  39. </div>
  40. <p>
  41. XOWA can import Wikidata through the command-line
  42. </p>
  43. <h2>
  44. <span class="mw-headline" id="Import_using_the_XML_dump">Import using the XML dump</span>
  45. </h2>
  46. <p>
  47. XOWA can build wikidata using the XML dump at www.mediwa/wikidatawiki/. This import is basically the same as an import of any other wiki.
  48. </p>
  49. <p>
  50. The script for the XML import follows.
  51. </p>
  52. <pre class='code'>
  53. // build wikidata database; this only needs to be done once, whenever wikidata is updated
  54. add ('www.wikidata.org' , 'util.cleanup') {delete_all = 'y';}
  55. add ('www.wikidata.org' , 'util.download') {dump_type = 'pages-articles';}
  56. add ('www.wikidata.org' , 'util.download') {dump_type = 'categorylinks';}
  57. add ('www.wikidata.org' , 'util.download') {dump_type = 'page_props';}
  58. add ('www.wikidata.org' , 'util.download') {dump_type = 'image';}
  59. add ('www.wikidata.org' , 'text.init');
  60. add ('www.wikidata.org' , 'text.page');
  61. add ('www.wikidata.org' , 'text.cat.core');
  62. add ('www.wikidata.org' , 'text.cat.link');
  63. add ('www.wikidata.org' , 'text.cat.hidden');
  64. add ('www.wikidata.org' , 'text.term');
  65. add ('www.wikidata.org' , 'text.css');
  66. add ('www.wikidata.org' , 'util.cleanup') {delete_tmp = 'y'; delete_by_match('*.xml|*.sql|*.bz2|*.gz');}
  67. </pre>
  68. <h2>
  69. <span class="mw-headline" id="Import_using_the_JSON_dump">Import using the JSON dump</span>
  70. </h2>
  71. <p>
  72. As of v2.6.3, XOWA also provides basic support for building wikidata from the JSON dump. This support was added for the following reasons:
  73. </p>
  74. <ul>
  75. <li>
  76. <b>Current delay in XML dumps</b>: The last good wikidata XML dump was 2+ months old due to problems with dump generation. See: <a href="https://phabricator.wikimedia.org/T98585" rel="nofollow" class="external free">https://phabricator.wikimedia.org/T98585</a>
  77. </li>
  78. <li>
  79. <b>JSON dumps recommended</b>: Wikidata seems to prefer using the JSON dump over the XML dump. See: <a href="http://www.wikidata.org/wiki/Wikidata:Database_download" rel="nofollow" class="external free">http://www.wikidata.org/wiki/Wikidata:Database_download</a>
  80. </li>
  81. <li>
  82. <b>JSON dumps are more frequent</b>: The JSON dumps have been dumping regularly on a weekly basis. In contrast the XML dumps take 3 - 4 weeks.
  83. </li>
  84. </ul>
  85. <p>
  86. Despite these reasons, there are limitations to the JSON dump.
  87. </p>
  88. <ul>
  89. <li>
  90. <b>Non-JSON pages not available</b>: The JSON dump doesn't provide other pages, such as the Main Page or MediaWiki pages. Only pages in the main and property namespaces are available. This is by design. See: <a href="https://lists.wikimedia.org/pipermail/wikidata/2015-June/006441.html" rel="nofollow" class="external free">https://lists.wikimedia.org/pipermail/wikidata/2015-June/006441.html</a>
  91. </li>
  92. <li>
  93. <b>Page metadata not available</b> : Certain properties are not available, such as page_id and last_modified. XOWA provides substitutes for these values, but they will not match the Wikimedia version
  94. </li>
  95. </ul>
  96. <p>
  97. The script for the JSON import follows.
  98. </p>
  99. <pre class='code'>
  100. add ('www.wikidata.org' , 'util.cleanup') {delete_all = 'y';}
  101. // TODO: add ('www.wikidata.org' , 'util.download') {dump_type = 'wikidata-json';}
  102. add ('www.wikidata.org' , 'wbase.json_dump');
  103. add ('www.wikidata.org' , 'text.term');
  104. add ('www.wikidata.org' , 'text.css');
  105. add ('www.wikidata.org' , 'util.cleanup') {delete_tmp = 'y'; delete_by_match('*.xml|*.sql|*.bz2|*.gz|*.json');}
  106. </pre>
  107. </div>
  108. </div>
  109. </div>
  110. <div id="mw-head" class="noprint">
  111. <div id="left-navigation">
  112. <div id="p-namespaces" class="vectorTabs">
  113. <h3>Namespaces</h3>
  114. <ul>
  115. <li id="ca-nstab-main" class="selected"><span><a id="ca-nstab-main-href" href="index.html">Page</a></span></li>
  116. </ul>
  117. </div>
  118. </div>
  119. </div>
  120. <div id='mw-panel' class='noprint'>
  121. <div id='p-logo'>
  122. <a style="background-image: url(https://gnosygnu.github.io/xowa/xowa_logo.png);" href="http://xowa.org/" title="Visit the main page"></a>
  123. </div>
  124. <div class="portal" id='xowa-portal-home'>
  125. <h3>XOWA</h3>
  126. <div class="body">
  127. <ul>
  128. <li><a href="http://xowa.org/index.html" title='Visit the main page'>Main page</a></li>
  129. <li><a href="http://xowa.org/screenshots.html" title='See screenshots of XOWA'>Screenshots</a></li>
  130. <li><a href="https://www.youtube.com/watch?v=q0qbXYXEH6M" title="See a video of XOWA Desktop in action">Video</a></li>
  131. <li><a href="http://xowa.org/home/wiki/Help/Download_XOWA.html" title='Download the XOWA application'>Download XOWA</a></li>
  132. <li><a href="http://xowa.org/home/wiki/Dashboard/Image_databases.html" title='Download offline wikis and image databases'>Download wikis</a></li>
  133. </ul>
  134. </div>
  135. </div>
  136. <div class="portal" id='xowa-portal-started'>
  137. <h3>Getting started</h3>
  138. <div class="body">
  139. <ul>
  140. <li><a href="http://xowa.org/home/wiki/App/Setup/System_requirements.html" title='Get XOWA&apos;s system requirements'>Requirements</a></li>
  141. <li><a href="http://xowa.org/home/wiki/App/Setup/Installation.html" title='Get instructions for installing XOWA'>Installation</a></li>
  142. <li><a href="http://xowa.org/home/wiki/App/Import/Simple_Wikipedia.html" title='Learn how to set up Simple Wikipedia'>Simple Wikipedia</a></li>
  143. <li><a href="http://xowa.org/home/wiki/App/Import/English_Wikipedia.html" title='Learn how to set up English Wikipedia'>English Wikipedia</a></li>
  144. <li><a href="http://xowa.org/home/wiki/App/Import/Other_wikis.html" title='Learn how to set up other Wikipedias'>Other Wikipedias</a></li>
  145. </ul>
  146. </div>
  147. </div>
  148. <div class="portal" id='xowa-portal-android'>
  149. <h3>Android</h3>
  150. <div class="body">
  151. <ul>
  152. <li><a href="http://xowa.org/home/wiki/Android/Setup.html" title='Setup XOWA on your Android device'>Setup</a></li>
  153. <li><a href="https://www.youtube.com/watch?v=jsMTBxGweUw" title="See a video of XOWA Android in action">Video</a></li>
  154. </ul>
  155. </div>
  156. </div>
  157. <div class="portal" id='xowa-portal-help'>
  158. <h3>Help</h3>
  159. <div class="body">
  160. <ul>
  161. <li><a href="http://xowa.org/home/wiki/Help/About.html" title='Get more information about XOWA'>About</a></li>
  162. <li><a href="http://xowa.org/home/wiki/Help/Contents.html" title='View a list of help topics'>Contents</a></li>
  163. <li><a href="http://xowa.org/home/wiki/Help/Media.html" title='Read what others have written about XOWA'>Media</a></li>
  164. <li><a href="http://xowa.org/home/wiki/Help/Feedback.html" title='Questions? Comments? Leave feedback for XOWA'>Feedback</a></li>
  165. </ul>
  166. </div>
  167. </div>
  168. <div class="portal" id='xowa-portal-blog'>
  169. <h3>Blog</h3>
  170. <div class="body">
  171. <ul>
  172. <li><a href="http://xowa.org/home/wiki/Blog.html" title='Follow XOWA''s development process'>Current</a></li>
  173. </ul>
  174. </div>
  175. </div>
  176. <div class="portal" id='xowa-portal-links'>
  177. <h3>Links</h3>
  178. <div class="body">
  179. <ul>
  180. <li><a href="http://dumps.wikimedia.org/backup-index.html" title="Get wiki datababase dumps directly from Wikimedia">Wikimedia dumps</a></li>
  181. <li><a href="https://archive.org/search.php?query=xowa" title="Search archive.org for XOWA files">XOWA @ archive.org</a></li>
  182. <li><a href="http://en.wikipedia.org" title="Visit Wikipedia (and compare to XOWA!)">English Wikipedia</a></li>
  183. </ul>
  184. </div>
  185. </div>
  186. <div class="portal" id='xowa-portal-donate'>
  187. <h3>Donate</h3>
  188. <div class="body">
  189. <ul>
  190. <li><a href="https://archive.org/donate/index.php" title="Support archive.org!">archive.org</a></li><!-- listed first due to recent fire damages: http://blog.archive.org/2013/11/06/scanning-center-fire-please-help-rebuild/ -->
  191. <li><a href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector" title="Support Wikipedia!">Wikipedia</a></li>
  192. <li><a href="http://xowa.org/home/wiki/Help/Donate.html" title="Support XOWA!">XOWA</a></li>
  193. </ul>
  194. </div>
  195. </div>
  196. </div>
  197. </body>
  198. </html>