diff --git a/wikidata/.env.dist b/wikidata/.env.dist new file mode 100644 index 0000000000000000000000000000000000000000..f8410922d452061a5cd6a786334cd3bf0041bb72 --- /dev/null +++ b/wikidata/.env.dist @@ -0,0 +1,2 @@ +OPENAI_API_KEY='' +HUGGINGFACEHUB_API_TOKEN='' \ No newline at end of file diff --git a/wikidata/.gitignore b/wikidata/.gitignore index eab782912afeca927c87be0bcb6a4fa49fc01f40..757a94608c3d379c4200dbf93560c696b194e6fe 100644 --- a/wikidata/.gitignore +++ b/wikidata/.gitignore @@ -1 +1,6 @@ -timeline_data.xlsx \ No newline at end of file +timeline_data.xlsx +user-config.py +.env +apicache +/throttle.ctrl +data/*-chatgpt.csv \ No newline at end of file diff --git a/wikidata/data-extraction.ipynb b/wikidata/data-extraction.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..b925963c678bd9de6e144a53aaccdb5becdda719 --- /dev/null +++ b/wikidata/data-extraction.ipynb @@ -0,0 +1,912 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "source": [ + "# Extract information from a Wikipedia page and upload to Wikidata\n", + "\n" + ], + "metadata": { + "collapsed": false + }, + "id": "6f9eb711429fb6cd" + }, + { + "cell_type": "code", + "execution_count": 67, + "outputs": [], + "source": [ + "prompt = '''\n", + "Your task is to extract data from the text and to output it in a format that is suitable as a data source for adding triples to Wikidata.\n", + "\n", + "The text is about \"{fullName}\" with the QID {qid}. It consists of one or more sections separated by \"-----\". The sections begin with a standalone URL followed by an excerpt of the content that can be found at this URL. \n", + "\n", + "Arrange the extracted information into a table with the following columns: subject-label, subject-qid, predicate, pid, object, object-qid, start_time, end_time, reference_url. \n", + "\n", + "Insert data into the columns as per the following rules:\n", + "- subject-label/subject-qid: In general, the subject is \"{fullName}\" with the QID {qid}. However, refining/qualifying statements can also be made about other entities, as with the academic degree (P512) item below. Also, in the case of P112, subject and object must be reversed\n", + "- predicate/pid:\n", + " - educated at (P69): Institutions at which the person studied \n", + " - student of (P1066): If supervisors of doctoral theses and habilitations are specified\n", + " - employer (P108): is the organization that pays the salary of a person (this can be a company, and institution or the university)\n", + " - academic appointment (P8413): usually the department of a university, if this or its QID are not known, like P108\n", + " - student (P802): persons contained in WikiData who were educated by the subject\n", + " - member of (P463): Organizations and associations to which the person belongs (excluding P108)\n", + " - affiliation (P1416): Organization that the subject is affiliated with (not member of or employed by)\n", + " - academic degree (P512): some instance of academic degree (Q189533). After making this claim, add further triples to refine the P512 statement with triples on \"conferred by\" (P1027) and on \"point in time\" (P585).\n", + " - editor (P98): add information on memberships in editorial boards of academic journals\n", + " - founded by (P112): add information on journals, associations or other organizations that the subject helped to establish. When adding this claim, YOU MUST switch subject and object to express the reverse relationship\n", + "- object-label/object-qid: here the English labels and, if known, the QIDs for the institutions and persons who are the objects of the triple. If you are not absolutely sure, leave blank\n", + "- start_time: the date/year from which the triple statement is true. Leave blank if the date is not specified or cannot be inferred, or the triple involves P585 \n", + "- end_time: the date/year up to which the triple statement is true. If it is an event, identical to start_time\n", + "- reference_url: this is the source URL of the text from which the information was extracted.\n", + "\n", + "Return information as a comma-separated values (CSV). Include the column headers. Surround the values with quotes. If values contain quotes, properly escape them.\n", + " \n", + "DO NOT, UNDER ANY CIRCUMSTANCES, provide any commentary or explanations, just return the raw data. Do not make anything up that is not in the source material.\n", + "-----\n", + "{website_text}\n", + "'''\n" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-03-15T16:01:45.855649400Z", + "start_time": "2024-03-15T16:01:45.813805600Z" + } + }, + "id": "27d869b6191fa004" + }, + { + "cell_type": "code", + "execution_count": 68, + "outputs": [], + "source": [ + "website_text = '''\n", + "https://de.wikipedia.org/wiki/Erhard_Blankenburg\n", + "\n", + "Blankenburg belegte ein Studium der Philosophie, Soziologie und Germanistik an der Universität Freiburg und FU Berlin. Es folgten Graduate Studies und eine Tätigkeit als Forschungsassistent am Department of Sociology der University of Oregon. Ein Studium der Soziologie und Wirtschaftswissenschaft an der Universität Basel beendete er mit dem Abschluss Master of Arts 1965.\n", + "\n", + "Seine Promotion zum Dr. phil. erfolgte an der Universität Basel 1966. Als Assistent am Institut für Soziologie der Universität Freiburg arbeitete er von 1966 bis 1968. Von 1969 bis 1971 war er Organisationsberater beim Quickborner Team, Hamburg. Danach arbeitete Blankenburg in Basel als Senior Projektleiter bei der Prognos in Basel. 1973/1974 war er wissenschaftlicher Mitarbeiter am Max-Planck-Institut für ausländisches und internationales Strafrecht in Freiburg. Die Habilitation für das Fach Soziologie erwarb er 1974 an der Universität Freiburg. Blankenburg war von 1975 bis 1980 Mitglied des Wissenschaftszentrums Berlin, Internationales Institut für Management und Verwaltung.\n", + "\n", + "1980 bekam er einen Ruf auf den Lehrstuhl für Rechtssoziologie der Vrije Universiteit Amsterdam. Gemeinsam mit Wolfgang Kaupen spielte er eine wichtige Rolle bei der Neubegründung der Deutschen Rechtssoziologie in den 70er-Jahren (Raiser 1998), ebenso, mit Volkmar Gessner, bei der Gründung des International Institute for the Sociology of Law. Er gehörte auch zu den Initiatoren und zu den Gründungsherausgebern der Zeitschrift für Rechtssoziologie. Gemeinsam mit Bill Felstiner organisierte er 1991 in Amsterdam das erste gemeinsame Treffen der beiden bedeutenden Vereinigungen der Rechtssoziologie (LSA und RCSL). Seine Beschäftigung mit rechtssoziologischen Themen war ungewöhnlich breit, reichte von der Soziologie der Kriminalität über die des Staatsapparates bis zu der des Zivilrechts. Blankenburg war primär Empiriker und Methodiker (vgl. seine Empirische Rechtssoziologie). Seine wichtigsten Beiträge zur rechtssoziologischen Theorie betreffen die Begriffe der \"Mobilisierung des Rechts\" und der \"Rechtskultur(en)\". Vor allem aber wirkte er als Koordinator, Organisator und als Vermittler zwischen Wissenschaft und Praxis: \"Er bemühte sich nicht, eine 'Schule' zu gründen, ihm fiel es leicht, in stets wechselnden Teams mit wechselnden Wissenschaftlern zusammenzuarbeiten. Wie kein anderer Rechtssoziologe vermochte er, erfolgreich Tagungen zu organisieren, kompetente Referenten zu gewinnen und die Veranstaltungen mit Autorität und zugleich locker zu leiten\" (Theo Rasehorn 1998, 23). \n", + "'''" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-03-15T16:01:46.714298900Z", + "start_time": "2024-03-15T16:01:46.713784100Z" + } + }, + "id": "37687f2fd256a439" + }, + { + "cell_type": "code", + "execution_count": 69, + "outputs": [], + "source": [ + "import io\n", + "from langchain_core.prompts import ChatPromptTemplate\n", + "from langchain_openai import ChatOpenAI\n", + "from langchain_core.output_parsers import StrOutputParser\n", + "import pandas as pd\n", + "from dotenv import load_dotenv\n", + "\n", + "load_dotenv()\n", + "\n", + "def use_model(model, template, debug=False, **params):\n", + " prompt = ChatPromptTemplate.from_template(template)\n", + " parser = StrOutputParser()\n", + " chain = ( prompt | model | parser )\n", + " response = chain.invoke(params)\n", + " if debug:\n", + " print(response)\n", + " data = io.StringIO(response)\n", + " return pd.read_csv(data, dtype={'start_time': str, 'end_time': str})" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-03-15T16:01:47.334376400Z", + "start_time": "2024-03-15T16:01:47.330143Z" + } + }, + "id": "b276d407b1a723fb" + }, + { + "cell_type": "code", + "execution_count": 70, + "outputs": [ + { + "data": { + "text/plain": " subject-label subject-qid \\\n0 Erhard Blankenburg Q51595283 \n1 Erhard Blankenburg Q51595283 \n2 Erhard Blankenburg Q51595283 \n3 Erhard Blankenburg Q51595283 \n4 Erhard Blankenburg Q51595283 \n5 Master of Arts NaN \n6 Erhard Blankenburg Q51595283 \n7 Erhard Blankenburg Q51595283 \n8 Erhard Blankenburg Q51595283 \n9 Erhard Blankenburg Q51595283 \n10 Erhard Blankenburg Q51595283 \n11 Habilitation NaN \n12 Erhard Blankenburg Q51595283 \n13 Erhard Blankenburg Q51595283 \n14 International Institute for the Sociology of Law Q1570309 \n15 Zeitschrift für Rechtssoziologie NaN \n\n predicate pid \\\n0 educated at P69 \n1 educated at P69 \n2 educated at P69 \n3 educated at P69 \n4 academic degree P512 \n5 conferred by P1027 \n6 employer P108 \n7 employer P108 \n8 employer P108 \n9 employer P108 \n10 academic degree P512 \n11 conferred by P1027 \n12 member of P463 \n13 academic appointment P8413 \n14 founded by P112 \n15 founded by P112 \n\n object object-qid start_time \\\n0 University of Freiburg NaN NaN \n1 Free University of Berlin NaN NaN \n2 University of Oregon NaN NaN \n3 University of Basel NaN NaN \n4 Master of Arts NaN 1965 \n5 University of Basel NaN 1965 \n6 University of Freiburg NaN 1966 \n7 Quickborner Team NaN 1969 \n8 Prognos NaN NaN \n9 Max-Planck-Institut für ausländisches und inte... NaN 1973 \n10 Habilitation NaN 1974 \n11 University of Freiburg NaN 1974 \n12 Wissenschaftszentrums Berlin, Internationales ... NaN 1975 \n13 Vrije Universiteit Amsterdam NaN 1980 \n14 Erhard Blankenburg Q51595283 NaN \n15 Erhard Blankenburg Q51595283 NaN \n\n end_time \\\n0 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n1 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n2 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n3 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n4 1965 \n5 1965 \n6 1968 \n7 1971 \n8 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n9 1974 \n10 1974 \n11 1974 \n12 1980 \n13 NaN \n14 NaN \n15 NaN \n\n reference_url \n0 NaN \n1 NaN \n2 NaN \n3 NaN \n4 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n5 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n6 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n7 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n8 NaN \n9 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n10 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n11 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n12 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n13 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n14 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n15 https://de.wikipedia.org/wiki/Erhard_Blankenburg ", + "text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>subject-label</th>\n <th>subject-qid</th>\n <th>predicate</th>\n <th>pid</th>\n <th>object</th>\n <th>object-qid</th>\n <th>start_time</th>\n <th>end_time</th>\n <th>reference_url</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>educated at</td>\n <td>P69</td>\n <td>University of Freiburg</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n <td>NaN</td>\n </tr>\n <tr>\n <th>1</th>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>educated at</td>\n <td>P69</td>\n <td>Free University of Berlin</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n <td>NaN</td>\n </tr>\n <tr>\n <th>2</th>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>educated at</td>\n <td>P69</td>\n <td>University of Oregon</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n <td>NaN</td>\n </tr>\n <tr>\n <th>3</th>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>educated at</td>\n <td>P69</td>\n <td>University of Basel</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n <td>NaN</td>\n </tr>\n <tr>\n <th>4</th>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>academic degree</td>\n <td>P512</td>\n <td>Master of Arts</td>\n <td>NaN</td>\n <td>1965</td>\n <td>1965</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n </tr>\n <tr>\n <th>5</th>\n <td>Master of Arts</td>\n <td>NaN</td>\n <td>conferred by</td>\n <td>P1027</td>\n <td>University of Basel</td>\n <td>NaN</td>\n <td>1965</td>\n <td>1965</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n </tr>\n <tr>\n <th>6</th>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>employer</td>\n <td>P108</td>\n <td>University of Freiburg</td>\n <td>NaN</td>\n <td>1966</td>\n <td>1968</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n </tr>\n <tr>\n <th>7</th>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>employer</td>\n <td>P108</td>\n <td>Quickborner Team</td>\n <td>NaN</td>\n <td>1969</td>\n <td>1971</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n </tr>\n <tr>\n <th>8</th>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>employer</td>\n <td>P108</td>\n <td>Prognos</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n <td>NaN</td>\n </tr>\n <tr>\n <th>9</th>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>employer</td>\n <td>P108</td>\n <td>Max-Planck-Institut für ausländisches und inte...</td>\n <td>NaN</td>\n <td>1973</td>\n <td>1974</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n </tr>\n <tr>\n <th>10</th>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>academic degree</td>\n <td>P512</td>\n <td>Habilitation</td>\n <td>NaN</td>\n <td>1974</td>\n <td>1974</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n </tr>\n <tr>\n <th>11</th>\n <td>Habilitation</td>\n <td>NaN</td>\n <td>conferred by</td>\n <td>P1027</td>\n <td>University of Freiburg</td>\n <td>NaN</td>\n <td>1974</td>\n <td>1974</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n </tr>\n <tr>\n <th>12</th>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>member of</td>\n <td>P463</td>\n <td>Wissenschaftszentrums Berlin, Internationales ...</td>\n <td>NaN</td>\n <td>1975</td>\n <td>1980</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n </tr>\n <tr>\n <th>13</th>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>academic appointment</td>\n <td>P8413</td>\n <td>Vrije Universiteit Amsterdam</td>\n <td>NaN</td>\n <td>1980</td>\n <td>NaN</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n </tr>\n <tr>\n <th>14</th>\n <td>International Institute for the Sociology of Law</td>\n <td>Q1570309</td>\n <td>founded by</td>\n <td>P112</td>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n </tr>\n <tr>\n <th>15</th>\n <td>Zeitschrift für Rechtssoziologie</td>\n <td>NaN</td>\n <td>founded by</td>\n <td>P112</td>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n </tr>\n </tbody>\n</table>\n</div>" + }, + "execution_count": 70, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fullName = \"Erhard Blankenburg\"\n", + "qid=\"Q51595283\"\n", + "model = ChatOpenAI(model_name=\"gpt-4\")\n", + "df = use_model(model, prompt, fullName=fullName, qid=qid, website_text=website_text)\n", + "df.to_csv(f'data/{fullName}-chatgpt.csv', index=False)\n", + "df" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-03-15T16:02:17.954423800Z", + "start_time": "2024-03-15T16:01:48.195123500Z" + } + }, + "id": "717d713e38598c57" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created (Q51595283)-[P69]-(Q153987)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:19:54\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added reference https://de.wikipedia.org/wiki/Erhard_Blankenburg with access date\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.2 seconds, 2024-03-15 18:20:04\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created (Q51595283)-[P69]-(Q153006)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:20:14\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added reference https://de.wikipedia.org/wiki/Erhard_Blankenburg with access date\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.2 seconds, 2024-03-15 18:20:24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created (Q51595283)-[P69]-(Q766145)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:20:34\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added reference https://de.wikipedia.org/wiki/Erhard_Blankenburg with access date\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.1 seconds, 2024-03-15 18:20:44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created (Q51595283)-[P69]-(Q372608)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.6 seconds, 2024-03-15 18:20:54\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added end time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:21:04\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added reference https://de.wikipedia.org/wiki/Erhard_Blankenburg with access date\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 8.7 seconds, 2024-03-15 18:21:14\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created (Q51595283)-[P512]-(Q2091008)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:21:24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added start time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.2 seconds, 2024-03-15 18:21:34\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added end time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:21:44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added reference https://de.wikipedia.org/wiki/Erhard_Blankenburg with access date\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.2 seconds, 2024-03-15 18:21:54\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created (Q51595283)-[P512]-(Q752297)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:22:04\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added start time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:22:14\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added end time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:22:24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added reference https://de.wikipedia.org/wiki/Erhard_Blankenburg with access date\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.0 seconds, 2024-03-15 18:22:34\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created (Q51595283)-[P108]-(Q153987)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.6 seconds, 2024-03-15 18:22:44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added start time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.4 seconds, 2024-03-15 18:22:54\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added end time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:23:04\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added reference https://de.wikipedia.org/wiki/Erhard_Blankenburg with access date\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.2 seconds, 2024-03-15 18:23:14\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created (Q51595283)-[P108]-(Q124866772)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.6 seconds, 2024-03-15 18:23:24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added start time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.6 seconds, 2024-03-15 18:23:34\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added end time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:23:44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added reference https://de.wikipedia.org/wiki/Erhard_Blankenburg with access date\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.2 seconds, 2024-03-15 18:23:54\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created (Q51595283)-[P108]-(Q2112115)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:24:04\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added end time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:24:14\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added reference https://de.wikipedia.org/wiki/Erhard_Blankenburg with access date\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.0 seconds, 2024-03-15 18:24:24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created (Q51595283)-[P108]-(Q832780)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:24:34\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added start time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:24:44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added end time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:24:54\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added reference https://de.wikipedia.org/wiki/Erhard_Blankenburg with access date\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.1 seconds, 2024-03-15 18:25:04\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created (Q51595283)-[P512]-(Q308678)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:25:14\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added start time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:25:24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added end time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:25:34\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added reference https://de.wikipedia.org/wiki/Erhard_Blankenburg with access date\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.0 seconds, 2024-03-15 18:25:44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created (Q51595283)-[P463]-(Q475602)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:25:54\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added start time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:26:04\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added end time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.2 seconds, 2024-03-15 18:26:14\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added reference https://de.wikipedia.org/wiki/Erhard_Blankenburg with access date\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 8.9 seconds, 2024-03-15 18:26:25\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created (Q51595283)-[P8413]-(Q1065414)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.6 seconds, 2024-03-15 18:26:34\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added start time\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:26:44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Added reference https://de.wikipedia.org/wiki/Erhard_Blankenburg with access date\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 8.9 seconds, 2024-03-15 18:26:55\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created (Q51595283)-[P1416]-(Q1459361)\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Sleeping for 9.5 seconds, 2024-03-15 18:27:04\n" + ] + } + ], + "source": [ + "# Code written by GPT-4\n", + "import csv\n", + "import pywikibot\n", + "from pywikibot import Claim, WbTime\n", + "from datetime import datetime\n", + "\n", + "def claim_to_string(claim):\n", + " \"\"\"\n", + " Converts a Pywikibot claim to a descriptive string in the format \"(subject QID)-[predicate PID]-(object QID)\".\n", + " \n", + " :param claim: A Pywikibot Claim object\n", + " :return: A string describing the claim in the specified format.\n", + " \"\"\"\n", + " # Subject QID, which is the ID of the item that owns the claim\n", + " subject_qid = claim.on_item.id\n", + "\n", + " # Predicate PID, which is the property ID of the claim\n", + " predicate_pid = claim.getID()\n", + "\n", + " # Object QID, assuming the target is a Wikidata item\n", + " # Note: This simplification assumes the claim's target is an item. \n", + " # For other target types (e.g., quantities, strings), additional handling is needed.\n", + " if isinstance(claim.getTarget(), pywikibot.ItemPage):\n", + " object_qid = claim.getTarget().id\n", + " else:\n", + " # Placeholder or additional logic for non-ItemPage targets\n", + " object_qid = 'N/A' # This could be expanded to handle other types of targets\n", + "\n", + " return f\"({subject_qid})-[{predicate_pid}]-({object_qid})\"\n", + "\n", + "\n", + "def update_wikidata(file_path):\n", + " site = pywikibot.Site(\"wikidata\", \"wikidata\")\n", + " repo = site.data_repository()\n", + "\n", + " previous_object_qid = None\n", + " previous_claim = None\n", + "\n", + " with open(file_path, newline='', encoding='utf-8') as csvfile:\n", + " reader = csv.DictReader(csvfile)\n", + " for row in reader:\n", + " subject_qid = row['subject-qid']\n", + " pid = row['pid']\n", + " object_qid = row['object-qid']\n", + " start_time = row['start_time']\n", + " end_time = row['end_time']\n", + " reference_url = row['reference_url']\n", + "\n", + " # If the new subject is identical to the old object, refine the previous claim\n", + " if subject_qid == previous_object_qid and previous_claim:\n", + " claim = previous_claim\n", + " print(f'Refining {claim_to_string(claim)}')\n", + " else:\n", + " item = pywikibot.ItemPage(repo, subject_qid)\n", + " item.get()\n", + "\n", + " # Check if the claim already exists\n", + " claim_exists = False\n", + " for claim in item.claims.get(pid, []):\n", + " if claim.getTarget().id == object_qid:\n", + " claim_exists = True\n", + " print(f'{claim_to_string(claim)} exists.')\n", + " break\n", + "\n", + " if not claim_exists:\n", + " claim = Claim(repo, pid)\n", + " target = pywikibot.ItemPage(repo, object_qid)\n", + " claim.setTarget(target)\n", + " item.addClaim(claim)\n", + " print(f'Created {claim_to_string(claim)}')\n", + "\n", + " # Add qualifiers\n", + " if start_time:\n", + " start_time_qualifier = Claim(repo, 'P580')\n", + " start_time_qualifier.setTarget(WbTime(year=int(start_time)))\n", + " claim.addQualifier(start_time_qualifier, summary='Adding start time')\n", + " print(f'Added start time')\n", + "\n", + " if end_time:\n", + " end_time_qualifier = Claim(repo, 'P582')\n", + " end_time_qualifier.setTarget(WbTime(year=int(end_time)))\n", + " claim.addQualifier(end_time_qualifier, summary='Adding end time')\n", + " print(f'Added end time')\n", + "\n", + " # Add reference\n", + " if reference_url:\n", + " source_claim = Claim(repo, 'P4656' if 'wikipedia' in reference_url else 'P854')\n", + " source_claim.setTarget(reference_url)\n", + " # add retrieved at\n", + " retrieved_at_claim = Claim(repo, 'P813')\n", + " retrieved_at_claim.setTarget(WbTime(year=datetime.utcnow().year, month=datetime.utcnow().month, day=datetime.utcnow().day))\n", + " source_claim.addQualifier(retrieved_at_claim)\n", + " claim.addSources([source_claim], summary='Adding reference')\n", + " print(f\"Added reference {reference_url} with access date\")\n", + "\n", + " # Remember the object and claim for the next iteration\n", + " previous_object_qid = object_qid\n", + " previous_claim = claim\n", + "\n", + "update_wikidata('data/Erhard Blankenburg.csv')" + ], + "metadata": { + "collapsed": false, + "is_executing": true, + "ExecuteTime": { + "start_time": "2024-03-15T17:19:52.058378600Z" + } + }, + "id": "bdb602fb42b562df" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false + }, + "id": "63d5f8107f4e3fa6" + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/wikidata/data/Erhard Blankenburg.csv b/wikidata/data/Erhard Blankenburg.csv new file mode 100644 index 0000000000000000000000000000000000000000..72ee157e7cf52516dbe341f6241d5ae6a3ca810b --- /dev/null +++ b/wikidata/data/Erhard Blankenburg.csv @@ -0,0 +1,18 @@ +subject-label,subject-qid,predicate,pid,object,object-qid,start_time,end_time,reference_url +Erhard Blankenburg,Q51595283,educated at,P69,University of Freiburg,Q153987,,,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Erhard Blankenburg,Q51595283,educated at,P69,Free University Berlin,Q153006,,,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Erhard Blankenburg,Q51595283,educated at,P69,University of Oregon,Q766145,,,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Erhard Blankenburg,Q51595283,educated at,P69,University of Basel,Q372608,,1965,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Erhard Blankenburg,Q51595283,academic degree,P512,Master of Arts,Q2091008,1965,1965,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Erhard Blankenburg,Q51595283,academic degree,P512,Doctor of Philosophy,Q752297,1966,1966,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Erhard Blankenburg,Q51595283,employer,P108,University of Freiburg,Q153987,1966,1968,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Erhard Blankenburg,Q51595283,employer,P108,Quickborner Team,Q124866772,1969,1971,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Erhard Blankenburg,Q51595283,employer,P108,Prognos AG,Q2112115,,1973,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Erhard Blankenburg,Q51595283,employer,P108,Max Planck Institute for Foreign and International Criminal Law,Q832780,1973,1974,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Erhard Blankenburg,Q51595283,academic degree,P512,habilitation,Q308678,1974,1974,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Erhard Blankenburg,Q51595283,employed by,P463,WZB Berlin Social Science Center,Q475602,1975,1980,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Erhard Blankenburg,Q51595283,academic appointment,P8413,Free University of Amsterdam,Q1065414,1980,,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Erhard Blankenburg,Q51595283,affiliated with,P1416,International Institute for the Sociology of Law,Q1459361,,,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Erhard Blankenburg,Q51595283,editor,P98,Zeitschrift fur Rechtssoziologie,Q96335163,,,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Zeitschrift fur Rechtssoziologie,Q65972149,founded by,P112,Erhard Blankenburg,Q51595283,,,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Erhard Blankenburg,Q51595283,academic appointment,P8413,Free University of Amsterdam,Q1065414,,2003,https://www.linkedin.com/in/erhard-blankenburg-63938058/ diff --git a/wikidata/readme.md b/wikidata/readme.md index 2d4b2fd04ae9b7134f24be9ac5f21c7ba3d03e26..d617fa5728b15c37c7aa7eeb1e52bc24bcfda29a 100644 --- a/wikidata/readme.md +++ b/wikidata/readme.md @@ -1,3 +1,13 @@ # WikiData data retrieval -`pip install openpyxl plotly lxml tabulate` \ No newline at end of file + +## Dependencies + +For data upload to WikiData +`pip install pywikibot requests-oauthlib` + +For timeline plots +`pip install openpyxl plotly lxml tabulate` + +For data extraction using OpenAi models +`pip install langchain_core langchain_openai` \ No newline at end of file diff --git a/wikidata/update-wikidata.ipynb b/wikidata/update-wikidata.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..5b738b1c36557e144c75466c45b14882ce1edbef --- /dev/null +++ b/wikidata/update-wikidata.ipynb @@ -0,0 +1,176 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "source": [ + "# Update WikiData\n" + ], + "metadata": { + "collapsed": false + }, + "id": "8ab9671b6edfa9f" + }, + { + "cell_type": "code", + "execution_count": 5, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Retrieved wikidata item.\n", + "Claim P108 P580 {\n", + " \"after\": 0,\n", + " \"before\": 0,\n", + " \"calendarmodel\": \"http://www.wikidata.org/entity/Q1985727\",\n", + " \"precision\": 9,\n", + " \"time\": \"+00000001980-01-01T00:00:00Z\",\n", + " \"timezone\": 0\n", + "} already exists.\n", + "Claim P108 P582 {\n", + " \"after\": 0,\n", + " \"before\": 0,\n", + " \"calendarmodel\": \"http://www.wikidata.org/entity/Q1985727\",\n", + " \"precision\": 9,\n", + " \"time\": \"+00000002003-01-01T00:00:00Z\",\n", + " \"timezone\": 0\n", + "} already exists.\n", + "Reference P4656 https://de.wikipedia.org/wiki/Erhard_Blankenburg already exists for P108.\n", + "Reference P854 https://www.linkedin.com/in/erhard-blankenburg-63938058/ already exists for P108.\n", + "Modifications applied in an idempotent manner.\n" + ] + } + ], + "source": [ + "import pywikibot\n", + "from pywikibot import Claim, WbTime\n", + "from datetime import datetime\n", + "\n", + "site = pywikibot.Site(\"wikidata\", \"wikidata\")\n", + "repo = site.data_repository()\n", + "\n", + "item = pywikibot.ItemPage(repo, 'Q51595283')\n", + "item.get()\n", + "\n", + "print(\"Retrieved wikidata item.\")\n", + "\n", + "# Function to check if a qualifier exists\n", + "def qualifier_exists(claim, qualifier_property, target_value):\n", + " for qualifier in claim.qualifiers.get(qualifier_property, []):\n", + " if qualifier.getTarget() == target_value:\n", + " print(f'Claim {claim.getID()} {qualifier_property} {target_value} already exists.')\n", + " return True\n", + " return False\n", + "\n", + "# Function to check if a reference exists\n", + "def reference_exists(claim, source_property, target_url):\n", + " for source in claim.sources:\n", + " for prop_id, values in source.items():\n", + " if prop_id == source_property:\n", + " for value in values:\n", + " if value.getTarget() == target_url:\n", + " print(f'Reference {source_property} {target_url} already exists for {claim.getID()}.')\n", + " return True\n", + " return False\n", + "\n", + "# Ensure employment claim is not duplicated\n", + "employment_claim_exists = False\n", + "for claim in item.claims.get('P108', []): # P108 is 'employer'\n", + " if claim.getTarget().getID() == 'Q1065414': # University of Amsterdam\n", + " employment_claim_exists = True\n", + " break\n", + "\n", + "if not employment_claim_exists:\n", + " claim = Claim(repo, 'P108')\n", + " target = pywikibot.ItemPage(repo, 'Q1065414')\n", + " claim.setTarget(target)\n", + " item.addClaim(claim)\n", + " print(f'Created new claim {claim}...')\n", + "\n", + "# Add start and end time qualifiers if they don't already exist\n", + "start_time = WbTime(year=1980)\n", + "if not qualifier_exists(claim, 'P580', start_time):\n", + " start_qualifier = Claim(repo, 'P580')\n", + " start_qualifier.setTarget(start_time)\n", + " claim.addQualifier(start_qualifier)\n", + " print(f'Added new qualifier {start_qualifier}...')\n", + "\n", + "end_time = WbTime(year=2003)\n", + "if not qualifier_exists(claim, 'P582', end_time):\n", + " end_qualifier = Claim(repo, 'P582')\n", + " end_qualifier.setTarget(end_time)\n", + " claim.addQualifier(end_qualifier)\n", + " print(f'Added new qualifier {end_qualifier}...')\n", + "\n", + "# Add references with 'retrieved at' qualifier\n", + "current_datetime = datetime.utcnow()\n", + "retrieved_at_datetime = WbTime(year=current_datetime.year, month=current_datetime.month, day=current_datetime.day)\n", + "\n", + "wikipedia_url = 'https://de.wikipedia.org/wiki/Erhard_Blankenburg'\n", + "linkedin_url = 'https://www.linkedin.com/in/erhard-blankenburg-63938058/'\n", + "\n", + "if not reference_exists(claim, 'P4656', wikipedia_url):\n", + " # Add Wikipedia reference\n", + " wikipedia_reference = Claim(repo, 'P4656')\n", + " wikipedia_reference.setTarget(wikipedia_url)\n", + " retrieved_at_claim_wiki = Claim(repo, 'P813')\n", + " retrieved_at_claim_wiki.setTarget(retrieved_at_datetime)\n", + " wikipedia_reference.addQualifier(retrieved_at_claim_wiki)\n", + " claim.addSources([wikipedia_reference])\n", + " print(f'Added new source {wikipedia_reference}...')\n", + "\n", + "if not reference_exists(claim, 'P854', linkedin_url):\n", + " # Add LinkedIn reference\n", + " linkedin_reference = Claim(repo, 'P854')\n", + " linkedin_reference.setTarget(linkedin_url)\n", + " retrieved_at_claim_linkedin = Claim(repo, 'P813')\n", + " retrieved_at_claim_linkedin.setTarget(retrieved_at_datetime)\n", + " linkedin_reference.addQualifier(retrieved_at_claim_linkedin)\n", + " claim.addSources([linkedin_reference])\n", + " print(f'Added new source {linkedin_reference}...')\n", + "\n", + "print('Modifications applied in an idempotent manner.')\n", + "\n" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-03-15T08:44:19.767213300Z", + "start_time": "2024-03-15T08:44:19.382460Z" + } + }, + "id": "59d15dc93174e6ad" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false + }, + "id": "d702eb98f46957ca" + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/wikidata/user-config.py.dist b/wikidata/user-config.py.dist new file mode 100644 index 0000000000000000000000000000000000000000..942235a7c9614743a4f38a228c710943228f9f08 --- /dev/null +++ b/wikidata/user-config.py.dist @@ -0,0 +1,6 @@ +mylang = 'wikidata' +family = 'wikidata' +usernames['wikidata']['wikidata'] = '<name of bot>' +authenticate['*.wikidata.org'] = ('Consumer token', 'Consumer secret', + 'Access token', 'Access secret') +console_encoding = 'utf-8'