From c7207861b9dfb9261bc192719774511cf91dd80f Mon Sep 17 00:00:00 2001 From: cboulanger <info@bibliograph.org> Date: Fri, 22 Mar 2024 14:58:08 +0100 Subject: [PATCH] Fix output, add UK scholars --- wikidata/lib/wikidata.py | 262 ++++++++++++++++- wikidata/output/scholars-de.csv | 53 ++++ wikidata/output/scholars-de.md | 54 ++++ wikidata/output/scholars-uk.csv | 12 + wikidata/output/scholars-uk.md | 13 + wikidata/query-wikidata.ipynb | 505 -------------------------------- wikidata/scholars-de.ipynb | 400 +++++++++++++++++++++++++ wikidata/scholars-uk.ipynb | 174 +++++++++++ 8 files changed, 966 insertions(+), 507 deletions(-) create mode 100644 wikidata/output/scholars-de.csv create mode 100644 wikidata/output/scholars-de.md create mode 100644 wikidata/output/scholars-uk.csv create mode 100644 wikidata/output/scholars-uk.md delete mode 100644 wikidata/query-wikidata.ipynb create mode 100644 wikidata/scholars-de.ipynb create mode 100644 wikidata/scholars-uk.ipynb diff --git a/wikidata/lib/wikidata.py b/wikidata/lib/wikidata.py index 5953954..fdf47c9 100644 --- a/wikidata/lib/wikidata.py +++ b/wikidata/lib/wikidata.py @@ -1,15 +1,243 @@ # based on code written by GPT-4 import csv import os +import mwclient +import os.path +import requests +import pandas as pd +import textwrap +import re from pywikibot import Claim, WbTime, ItemPage, PropertyPage, Site from datetime import datetime -import mwclient from dotenv import load_dotenv load_dotenv() +def generate_sparql_query(fullName, property_labels_to_ids, language='en', qid=None, include_description=False): + """ + Query WikiData for the properties of the given person listed in the given property map, + either by fullName or QID. When a QID is provided, ?itemLabel is not included in the query. + :param fullName: Name of the person to query + :param property_labels_to_ids: Dictionary mapping property labels to WikiData property IDs + :param language: Language code for the query results + :param qid: WikiData entity ID (QID) for the person + :return: SPARQL query string + """ + + selectClause = "SELECT DISTINCT ?item" + groupByClause = "GROUP BY ?item" + + if qid: + #selectClause = "SELECT DISTINCT ?item" + itemConstraint = f"BIND(wd:{qid} AS ?item)." + #groupByClause = "GROUP BY ?item" + else: + #selectClause = "SELECT DISTINCT ?item" + itemConstraint = f'?item wdt:P31 wd:Q5; rdfs:label "{fullName}"@{language} .' + #groupByClause = "GROUP BY ?item" + + if include_description: + selectClause += " ?itemdesc" + itemConstraint += f''' + OPTIONAL {{ ?item schema:description ?itemdesc. FILTER(LANG(?itemdesc) = "{language}") }}''' + groupByClause += " ?itemdesc" + + for label, pid in property_labels_to_ids.items(): + # add to property selection + if label.endswith('Name'): + selectClause += f''' + (GROUP_CONCAT(DISTINCT ?{label}Value; separator=" ") AS ?{label})''' + else: + selectClause += f''' + (SAMPLE(?{label}) AS ?{label})''' + + # add to item constraint + if label.endswith("_id") or label.startswith("image") or label.startswith("date"): + itemConstraint += f""" + OPTIONAL {{ ?item wdt:{pid} ?{label}. }}""" + elif label.endswith("Name"): + itemConstraint += f""" + OPTIONAL {{ + ?item p:{pid} ?{label}Statement. + ?{label}Statement ps:{pid} ?{label}. + OPTIONAL {{ ?{label}Statement pq:P1545 ?order. }} + OPTIONAL {{ + ?{label} rdfs:label ?{label}Label. + FILTER(LANG(?{label}Label) = "{language}") + }} + BIND(COALESCE(?{label}Label, STR(?{label})) AS ?{label}Value) + }}""" + else: + itemConstraint += f""" + OPTIONAL {{ ?item wdt:{pid} ?{label}Id . ?{label}Id rdfs:label ?{label} FILTER(LANG(?{label}) = "{language}") . }}""" + + query = textwrap.dedent(f""" + {selectClause} + WHERE {{ + {itemConstraint} + }} + {groupByClause} + """) + + return query + + +def query_wikidata(fullName, property_map, language='en', qid=None, debug=False, include_description=False): + SPARQL_ENDPOINT = "https://query.wikidata.org/sparql" + query = generate_sparql_query(fullName, property_map, language, qid=qid, include_description=include_description) + if debug: + print(query) + headers = {'User-Agent': 'Mozilla/5.0', 'Accept': 'application/json'} + response = requests.get(SPARQL_ENDPOINT, headers=headers, params={'query': query, 'format': 'json'}) + + if response.status_code != 200: + print(query) + response.raise_for_status() + + results = response.json()['results']['bindings'] + + if not results: + return [] + + for i, result in enumerate(results): + # Initialize with fullName to ensure it appears first + data = { + 'fullName': fullName + } + + labels = list(property_map.keys()) + if include_description: + labels.append('itemdesc') + + for label in labels: + if label in result: + value = result[label]['value'] + data[label] = value + else: + data[label] = None + + # add qid and item URI + data['qid'] = os.path.basename(result['item']['value']) + data['wikidata_url'] = result['item']['value'] + results[i] = data + + return results + + +def get_wikipedia_links(qid, languages): + """ + Fetch Wikipedia links for a given Wikidata QID and a list of languages. + + Parameters: + - qid (str): The QID of the Wikidata item. + - languages (list): A list of language codes (e.g., ['en', 'de']). + + Returns: + - dict: A dictionary with languages as keys and Wikipedia URLs as values. + """ + url = "https://www.wikidata.org/w/api.php" + params = { + "action": "wbgetentities", + "ids": qid, + "props": "sitelinks/urls", + "format": "json" + } + + response = requests.get(url, params=params) + data = response.json() + links = {} + if "entities" in data and qid in data["entities"]: + sitelinks = data["entities"][qid].get("sitelinks", {}) + for lang in languages: + sitekey = f"{lang}wiki" + if sitekey in sitelinks: + siteLinkData = sitelinks.get(sitekey) + if 'url' in siteLinkData: + links[lang] = siteLinkData.get('url') + else: + # Use the 'title' key and construct the URL manually + title = sitelinks[sitekey]["title"] + links[lang] = f"https://{lang}.wikipedia.org/wiki/{requests.utils.quote(title)}" + else: + links[lang] = None # Or use '' to represent absence of link + + return links + + +def extract_name_qid_with_regex(strings): + pattern = re.compile(r'^(.+?)(?: \(?Q(\d+)\)?)? *$') + result = [] + for s in strings: + if match := pattern.search(s.strip()): + name = match.group(1).strip() + qid = 'Q' + match.group(2) if match.group(2) else None + result.append((name, qid)) + return result + + +def get_person_info_from_wikidata(names: list, + property_map: dict, + languages: list = None, + debug=False, + include_description=False) -> pd.DataFrame: + """ + Given a list of "Name (QID)" strings, return the property values stored in wikidata, including wikipedia page links + Args: + names: + a list of strings in the format "Name (QID)". "(QID") is optional. If left out, the result will contain all + items having that name + property_map: + a dict mapping names of the property to PIDs + languages: + a list of languages for which to retrieve the wikipedia page URL, if it exists + debug: + if true, output debug information + + Returns: + A dataframe with the property names as column names + + """ + + if languages is None: + languages = ['en', 'de'] + + language = languages[0] + + all_data = [] + print('Retrieving scholar data...') + for name, qid in extract_name_qid_with_regex(names): + all_data += query_wikidata(name, + property_map=property_map, + language=language, + qid=qid, + include_description=include_description, + debug=debug) + + # Ensure fullName appears first by reordering columns based on property_labels_to_ids keys + columns = (['fullName', 'qid'] + + (['itemdesc'] if include_description else []) + + list(property_map.keys()) + + ['wikidata_url'] + [f'wikipedia_{l}' for l in languages]) + + if len(all_data) > 0: + df = pd.DataFrame(all_data, columns=columns, dtype=str) + # Add wikipedia links + print("Retrieving wikipedia URLs...") + # For each QID in the DataFrame, fetch Wikipedia links for all languages and update the DataFrame accordingly + for index, row in df.iterrows(): + qid = row['qid'] + links = get_wikipedia_links(qid, languages) + + # Update the DataFrame directly with the fetched links for each language + for language in languages: + df.at[index, f'wikipedia_{language}'] = links.get(language, None) + else: + df = pd.DataFrame(columns=columns, dtype=str) + return df + + def claim_to_string(claim): subject_qid = claim.on_item.id predicate_pid = claim.getID() @@ -187,4 +415,34 @@ def get_wikipedia_page_data(pageTitle: str, language="en"): 'revision': page.revision, 'url': f'{site.host}/wiki/{pageTitle.replace(" ", "_")}?oldid={page.revision}', 'content': page.text() - } \ No newline at end of file + } + + +# Function to convert URLs to HTML links +def make_clickable(val, name): + if val: + return f'<a target="_blank" href="{val}">{name}</a>' + else: + return "" + + +def format_name(name, date_birth, date_death): + return f'{name} ({"" if pd.isna(date_birth) else date_birth.year}-{"" if pd.isna(date_death) else date_death.year})' + +def format_language_codes(name): + # Find all occurrences of language codes (e.g., _en, _de) and transform them to uppercase within parentheses + return re.sub(r'(.*?)_([a-z]{2})', lambda m: f" ({m.group(2).upper()})", name) + +def create_styled_table(df: pd.DataFrame, include_rows:list): + df = df.copy() + df['fullName'] = df.apply(lambda r: format_name(r['fullName'], r['dateOfBirth'], r['dateOfDeath']), axis=1) + df = df[include_rows] + for col in df.columns: + if col.startswith('wiki'): + if col.startswith('wikipedia'): + link_name = 'WP ' + format_language_codes(col) + else: + link_name = "Wikidata" + df.loc[:, col] = df.loc[:, col].apply(make_clickable, name=link_name) + + return df diff --git a/wikidata/output/scholars-de.csv b/wikidata/output/scholars-de.csv new file mode 100644 index 0000000..7b78627 --- /dev/null +++ b/wikidata/output/scholars-de.csv @@ -0,0 +1,53 @@ +fullName,qid,itemdesc,sexOrGender,familyName,givenName,dateOfBirth,dateOfDeath,wikidata_url,wikipedia_en,wikipedia_de +Karl Renner,Q11726,first President of Austria (1870–1950),male,Renner,Karl,1870-12-14 00:00:00+00:00,1950-12-31 00:00:00+00:00,http://www.wikidata.org/entity/Q11726,https://en.wikipedia.org/wiki/Karl_Renner,https://de.wikipedia.org/wiki/Karl_Renner +Hugo Sinzheimer,Q86043,German politician (1875-1945),male,Sinzheimer,Hugo D.,1875-01-01 00:00:00+00:00,1945-09-16 00:00:00+00:00,http://www.wikidata.org/entity/Q86043,https://en.wikipedia.org/wiki/Hugo_Sinzheimer,https://de.wikipedia.org/wiki/Hugo_Sinzheimer +Arthur Nussbaum,Q103088,German American jurist,male,Nussbaum,Arthur,1877-01-01 00:00:00+00:00,1964-01-01 00:00:00+00:00,http://www.wikidata.org/entity/Q103088,https://en.wikipedia.org/wiki/Arthur_Nussbaum,https://de.wikipedia.org/wiki/Arthur_Nussbaum +Ludwig Bendix,Q15449424,"German economist, civil law notary and lawyer (1877–1954)",male,Bendix,Ludwig,1877-06-28 00:00:00+00:00,1954-01-03 00:00:00+00:00,http://www.wikidata.org/entity/Q15449424,,https://de.wikipedia.org/wiki/Ludwig_Bendix +Hans Kelsen,Q84165,Austrian lawyer,male,Kelsen,Hans,1881-10-11 00:00:00+00:00,1973-04-19 00:00:00+00:00,http://www.wikidata.org/entity/Q84165,https://en.wikipedia.org/wiki/Hans_Kelsen,https://de.wikipedia.org/wiki/Hans_Kelsen +Theodor Geiger,Q96410,German sociologist (1891-1952),male,Geiger,Theodor,1891-11-09 00:00:00+00:00,1952-06-16 00:00:00+00:00,http://www.wikidata.org/entity/Q96410,https://en.wikipedia.org/wiki/Theodor_Geiger,https://de.wikipedia.org/wiki/Theodor_Geiger +Ernst Fraenkel,Q86812,political scientist (1898-1975),male,Fraenkel,Ernst,1898-12-26 00:00:00+00:00,1975-03-28 00:00:00+00:00,http://www.wikidata.org/entity/Q86812,https://en.wikipedia.org/wiki/Ernst_Fraenkel_(political_scientist),https://de.wikipedia.org/wiki/Ernst_Fraenkel_(Politikwissenschaftler) +Franz Leopold Neumann,Q63195,German political activist,male,Neumann,Leopold Franz,1900-05-23 00:00:00+00:00,1954-09-02 00:00:00+00:00,http://www.wikidata.org/entity/Q63195,https://en.wikipedia.org/wiki/Franz_Neumann_(political_scientist),https://de.wikipedia.org/wiki/Franz_Neumann_(Politikwissenschaftler) +Otto Kahn-Freund,Q121832,German-British jurist,male,Kahn Freund,Otto,1900-11-17 00:00:00+00:00,1979-06-16 00:00:00+00:00,http://www.wikidata.org/entity/Q121832,https://en.wikipedia.org/wiki/Otto_Kahn-Freund,https://de.wikipedia.org/wiki/Otto_Kahn-Freund +Ernst Eduard Hirsch,Q107033,German judge (1902-1985),male,Hirsch,Ernst,1902-01-20 00:00:00+00:00,1985-03-29 00:00:00+00:00,http://www.wikidata.org/entity/Q107033,,https://de.wikipedia.org/wiki/Ernst_Eduard_Hirsch +Otto Kirchheimer,Q214397,German-American legal scholar,male,Kirchheimer,Otto,1905-11-11 00:00:00+00:00,1965-11-22 00:00:00+00:00,http://www.wikidata.org/entity/Q214397,https://en.wikipedia.org/wiki/Otto_Kirchheimer,https://de.wikipedia.org/wiki/Otto_Kirchheimer +Helmut Schelsky,Q104272,German sociologist (1912-1984),male,,Helmut,1912-10-14 00:00:00+00:00,1984-02-24 00:00:00+00:00,http://www.wikidata.org/entity/Q104272,https://en.wikipedia.org/wiki/Helmut_Schelsky,https://de.wikipedia.org/wiki/Helmut_Schelsky +Hans Ryffel,Q21035905,(1913-1989),male,Ryffel,Hans,1913-06-27 00:00:00+00:00,1989-09-30 00:00:00+00:00,http://www.wikidata.org/entity/Q21035905,,https://de.wikipedia.org/wiki/Hans_Ryffel_(Rechtsphilosoph) +Theo Rasehorn,Q1304659,German judge and author,male,,Theo,1918-10-26 00:00:00+00:00,2016-01-16 00:00:00+00:00,http://www.wikidata.org/entity/Q1304659,,https://de.wikipedia.org/wiki/Theo_Rasehorn +Rudolf Wassermann,Q1551290,German judge (1925-2008),male,Wassermann,Rudolf,1925-01-05 00:00:00+00:00,2008-06-13 00:00:00+00:00,http://www.wikidata.org/entity/Q1551290,,https://de.wikipedia.org/wiki/Rudolf_Wassermann +Thilo Ramm,Q59533838,German legal scholar and author,male,Ramm,Thilo,1925-04-04 00:00:00+00:00,2018-06-17 00:00:00+00:00,http://www.wikidata.org/entity/Q59533838,,https://de.wikipedia.org/wiki/Thilo_Ramm +Niklas Luhmann,Q57238,"German sociologist, administration expert, and social systems theorist (1927-1998)",male,Luhmann,Niklas,1927-12-08 00:00:00+00:00,1998-11-06 00:00:00+00:00,http://www.wikidata.org/entity/Q57238,https://en.wikipedia.org/wiki/Niklas_Luhmann,https://de.wikipedia.org/wiki/Niklas_Luhmann +Rudolf Wiethölter,Q1512482,German jurist,male,,Rudolf,1929-07-17 00:00:00+00:00,,http://www.wikidata.org/entity/Q1512482,,https://de.wikipedia.org/wiki/Rudolf_Wieth%C3%B6lter +Günter Dux,Q1560417,German sociologist,male,Dux,Günter,1933-06-23 00:00:00+00:00,,http://www.wikidata.org/entity/Q1560417,,https://de.wikipedia.org/wiki/G%C3%BCnter_Dux +Jutta Limbach,Q72551,German judge and politician (SPD) (1934-2016),female,Limbach,Jutta,1934-03-27 00:00:00+00:00,2016-09-10 00:00:00+00:00,http://www.wikidata.org/entity/Q72551,https://en.wikipedia.org/wiki/Jutta_Limbach,https://de.wikipedia.org/wiki/Jutta_Limbach +Thomas Raiser,Q27909309,,male,,Thomas,1935-02-20 00:00:00+00:00,,http://www.wikidata.org/entity/Q27909309,,https://de.wikipedia.org/wiki/Thomas_Raiser +Manfred Rehbinder,Q1889820,German jurist,male,,Manfred,1935-03-22 00:00:00+00:00,,http://www.wikidata.org/entity/Q1889820,,https://de.wikipedia.org/wiki/Manfred_Rehbinder +Rüdiger Lautmann,Q91074,German sociologist and LGBT researcher,male,,Rüdiger,1935-12-22 00:00:00+00:00,,http://www.wikidata.org/entity/Q91074,https://en.wikipedia.org/wiki/R%C3%BCdiger_Lautmann,https://de.wikipedia.org/wiki/R%C3%BCdiger_Lautmann +Wolfgang Kaupen,Q93221485,,male,,Wolfgang,1936-01-01 00:00:00+00:00,1981-01-01 00:00:00+00:00,http://www.wikidata.org/entity/Q93221485,, +Volkmar Gessner,Q15435946,University professor,male,Gessner,Volkmar,1937-10-09 00:00:00+00:00,2014-11-08 00:00:00+00:00,http://www.wikidata.org/entity/Q15435946,https://en.wikipedia.org/wiki/Volkmar_Gessner,https://de.wikipedia.org/wiki/Volkmar_Gessner +Klaus F. Röhl,Q27148390,,male,Röhl,Klaus,1938-05-22 00:00:00+00:00,,http://www.wikidata.org/entity/Q27148390,,https://de.wikipedia.org/wiki/Klaus_F._R%C3%B6hl +Erhard Blankenburg,Q51595283,German sociologist of law (1938-2018),male,Blankenburg,Erhard,1938-10-30 00:00:00+00:00,2018-03-28 00:00:00+00:00,http://www.wikidata.org/entity/Q51595283,https://en.wikipedia.org/wiki/Erhard_Blankenburg,https://de.wikipedia.org/wiki/Erhard_Blankenburg +Manfred Weiss,Q1588285,German jurist,male,Weiss,Manfred,1940-06-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q1588285,,https://de.wikipedia.org/wiki/Manfred_Weiss_(Jurist) +Rüdiger Voigt,Q1682026,German author,male,Voigt,Rüdiger,1941-04-07 00:00:00+00:00,,http://www.wikidata.org/entity/Q1682026,,https://de.wikipedia.org/wiki/R%C3%BCdiger_Voigt +Roland Girtler,Q112873,Austrian historian and sociologist,male,Girtler,Roland,1941-05-31 00:00:00+00:00,,http://www.wikidata.org/entity/Q112873,,https://de.wikipedia.org/wiki/Roland_Girtler +Hubert Treiber,Q1633462,German university teacher,male,,Hubert,1942-07-30 00:00:00+00:00,,http://www.wikidata.org/entity/Q1633462,,https://de.wikipedia.org/wiki/Hubert_Treiber +Brun-Otto Bryde,Q107784,German judge,male,,,1943-01-12 00:00:00+00:00,,http://www.wikidata.org/entity/Q107784,https://en.wikipedia.org/wiki/Brun-Otto_Bryde,https://de.wikipedia.org/wiki/Brun-Otto_Bryde +Hubert Rottleuthner,Q55622018,,male,,Hubert,1944-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q55622018,,https://de.wikipedia.org/wiki/Hubert_Rottleuthner +Klaus A. Ziegert,Q112513122,German sociologist of law,male,Ziegert,Klaus,1944-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q112513122,, +Dieter Martiny,Q1222459,German jurist,male,Martiny,Dieter,1944-03-21 00:00:00+00:00,,http://www.wikidata.org/entity/Q1222459,,https://de.wikipedia.org/wiki/Dieter_Martiny +Gunther Teubner,Q98304,German academic,male,Teubner,Gunther,1944-04-30 00:00:00+00:00,,http://www.wikidata.org/entity/Q98304,https://en.wikipedia.org/wiki/Gunther_Teubner,https://de.wikipedia.org/wiki/Gunther_Teubner +Konstanze Plett,Q95192683,,female,,,1947-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q95192683,,https://de.wikipedia.org/wiki/Konstanze_Plett +Armin Höland,Q15435996,German university professor,male,,Armin,1948-11-04 00:00:00+00:00,,http://www.wikidata.org/entity/Q15435996,,https://de.wikipedia.org/wiki/Armin_H%C3%B6land +Susanne Karstedt,Q2369299,criminologist,female,,Susanne,1949-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q2369299,https://en.wikipedia.org/wiki/Susanne_Karstedt,https://de.wikipedia.org/wiki/Susanne_Karstedt +Leo Kißler,Q63203841,,male,,Leo,1949-01-08 00:00:00+00:00,,http://www.wikidata.org/entity/Q63203841,,https://de.wikipedia.org/wiki/Leo_Ki%C3%9Fler +Fritz Jost,Q105946060,,male,,Fritz,1949-08-07 00:00:00+00:00,,http://www.wikidata.org/entity/Q105946060,,https://de.wikipedia.org/wiki/Fritz_Jost_(Rechtswissenschaftler) +Doris Lucke,Q1245242,German university teacher,female,,Doris,1953-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q1245242,,https://de.wikipedia.org/wiki/Doris_Lucke +Ralf Rogowski,Q20128038,Law professor (born 1953),male,Rogowski,Ralf,1953-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q20128038,https://en.wikipedia.org/wiki/Ralf_Rogowski, +Wolfgang Ludwig-Mayerhofer,Q2590472,German sociologist,male,,Wolfgang,1954-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q2590472,,https://de.wikipedia.org/wiki/Wolfgang_Ludwig-Mayerhofer +Kai Bussmann,Q1552696,German jurist,male,Bussmann,Kai,1955-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q1552696,,https://de.wikipedia.org/wiki/Kai_Bussmann +Dorothea Jansen,Q21258453,,female,Jansen,Dorothea,1956-08-21 00:00:00+00:00,2017-05-12 00:00:00+00:00,http://www.wikidata.org/entity/Q21258453,,https://de.wikipedia.org/wiki/Dorothea_Jansen +Alfons Bora,Q2644328,German sociologist,male,,Alfons,1957-05-03 00:00:00+00:00,,http://www.wikidata.org/entity/Q2644328,,https://de.wikipedia.org/wiki/Alfons_Bora +Ute Sacksofsky,Q48562036,German legal scholar,female,,Ute,1960-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q48562036,,https://de.wikipedia.org/wiki/Ute_Sacksofsky +Stefan Machura,Q95245830,,male,,Stefan,1962-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q95245830,, +Ralf Poscher,Q2129347,German legal historian,male,,Ralf,1962-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q2129347,,https://de.wikipedia.org/wiki/Ralf_Poscher +Susanne Baer,Q101872,German judge,female,Baer,Susanne,1964-02-16 00:00:00+00:00,,http://www.wikidata.org/entity/Q101872,https://en.wikipedia.org/wiki/Susanne_Baer,https://de.wikipedia.org/wiki/Susanne_Baer +Gralf-Peter Calliess,Q1542033,German jurist,male,Calliess,Gralf-Peter,1967-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q1542033,,https://de.wikipedia.org/wiki/Gralf-Peter_Calliess diff --git a/wikidata/output/scholars-de.md b/wikidata/output/scholars-de.md new file mode 100644 index 0000000..059fe7d --- /dev/null +++ b/wikidata/output/scholars-de.md @@ -0,0 +1,54 @@ +| fullName | itemdesc | wikidata_url | wikipedia_en | wikipedia_de | +|:-----------------------------------|:-----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------| +| Karl Renner (1870-1950) | first President of Austria (1870–1950) | <a target="_blank" href="http://www.wikidata.org/entity/Q11726">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Karl_Renner">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Karl_Renner">WP (DE)</a> | +| Hugo Sinzheimer (1875-1945) | German politician (1875-1945) | <a target="_blank" href="http://www.wikidata.org/entity/Q86043">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Hugo_Sinzheimer">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Hugo_Sinzheimer">WP (DE)</a> | +| Arthur Nussbaum (1877-1964) | German American jurist | <a target="_blank" href="http://www.wikidata.org/entity/Q103088">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Arthur_Nussbaum">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Arthur_Nussbaum">WP (DE)</a> | +| Ludwig Bendix (1877-1954) | German economist, civil law notary and lawyer (1877–1954) | <a target="_blank" href="http://www.wikidata.org/entity/Q15449424">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Ludwig_Bendix">WP (DE)</a> | +| Hans Kelsen (1881-1973) | Austrian lawyer | <a target="_blank" href="http://www.wikidata.org/entity/Q84165">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Hans_Kelsen">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Hans_Kelsen">WP (DE)</a> | +| Theodor Geiger (1891-1952) | German sociologist (1891-1952) | <a target="_blank" href="http://www.wikidata.org/entity/Q96410">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Theodor_Geiger">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Theodor_Geiger">WP (DE)</a> | +| Ernst Fraenkel (1898-1975) | political scientist (1898-1975) | <a target="_blank" href="http://www.wikidata.org/entity/Q86812">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Ernst_Fraenkel_(political_scientist)">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Ernst_Fraenkel_(Politikwissenschaftler)">WP (DE)</a> | +| Franz Leopold Neumann (1900-1954) | German political activist | <a target="_blank" href="http://www.wikidata.org/entity/Q63195">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Franz_Neumann_(political_scientist)">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Franz_Neumann_(Politikwissenschaftler)">WP (DE)</a> | +| Otto Kahn-Freund (1900-1979) | German-British jurist | <a target="_blank" href="http://www.wikidata.org/entity/Q121832">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Otto_Kahn-Freund">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Otto_Kahn-Freund">WP (DE)</a> | +| Ernst Eduard Hirsch (1902-1985) | German judge (1902-1985) | <a target="_blank" href="http://www.wikidata.org/entity/Q107033">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Ernst_Eduard_Hirsch">WP (DE)</a> | +| Otto Kirchheimer (1905-1965) | German-American legal scholar | <a target="_blank" href="http://www.wikidata.org/entity/Q214397">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Otto_Kirchheimer">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Otto_Kirchheimer">WP (DE)</a> | +| Helmut Schelsky (1912-1984) | German sociologist (1912-1984) | <a target="_blank" href="http://www.wikidata.org/entity/Q104272">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Helmut_Schelsky">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Helmut_Schelsky">WP (DE)</a> | +| Hans Ryffel (1913-1989) | (1913-1989) | <a target="_blank" href="http://www.wikidata.org/entity/Q21035905">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Hans_Ryffel_(Rechtsphilosoph)">WP (DE)</a> | +| Theo Rasehorn (1918-2016) | German judge and author | <a target="_blank" href="http://www.wikidata.org/entity/Q1304659">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Theo_Rasehorn">WP (DE)</a> | +| Rudolf Wassermann (1925-2008) | German judge (1925-2008) | <a target="_blank" href="http://www.wikidata.org/entity/Q1551290">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Rudolf_Wassermann">WP (DE)</a> | +| Thilo Ramm (1925-2018) | German legal scholar and author | <a target="_blank" href="http://www.wikidata.org/entity/Q59533838">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Thilo_Ramm">WP (DE)</a> | +| Niklas Luhmann (1927-1998) | German sociologist, administration expert, and social systems theorist (1927-1998) | <a target="_blank" href="http://www.wikidata.org/entity/Q57238">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Niklas_Luhmann">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Niklas_Luhmann">WP (DE)</a> | +| Rudolf Wiethölter (1929-) | German jurist | <a target="_blank" href="http://www.wikidata.org/entity/Q1512482">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Rudolf_Wieth%C3%B6lter">WP (DE)</a> | +| Günter Dux (1933-) | German sociologist | <a target="_blank" href="http://www.wikidata.org/entity/Q1560417">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/G%C3%BCnter_Dux">WP (DE)</a> | +| Jutta Limbach (1934-2016) | German judge and politician (SPD) (1934-2016) | <a target="_blank" href="http://www.wikidata.org/entity/Q72551">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Jutta_Limbach">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Jutta_Limbach">WP (DE)</a> | +| Thomas Raiser (1935-) | | <a target="_blank" href="http://www.wikidata.org/entity/Q27909309">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Thomas_Raiser">WP (DE)</a> | +| Manfred Rehbinder (1935-) | German jurist | <a target="_blank" href="http://www.wikidata.org/entity/Q1889820">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Manfred_Rehbinder">WP (DE)</a> | +| Rüdiger Lautmann (1935-) | German sociologist and LGBT researcher | <a target="_blank" href="http://www.wikidata.org/entity/Q91074">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/R%C3%BCdiger_Lautmann">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/R%C3%BCdiger_Lautmann">WP (DE)</a> | +| Wolfgang Kaupen (1936-1981) | | <a target="_blank" href="http://www.wikidata.org/entity/Q93221485">Wikidata</a> | | | +| Volkmar Gessner (1937-2014) | University professor | <a target="_blank" href="http://www.wikidata.org/entity/Q15435946">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Volkmar_Gessner">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Volkmar_Gessner">WP (DE)</a> | +| Klaus F. Röhl (1938-) | | <a target="_blank" href="http://www.wikidata.org/entity/Q27148390">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Klaus_F._R%C3%B6hl">WP (DE)</a> | +| Erhard Blankenburg (1938-2018) | German sociologist of law (1938-2018) | <a target="_blank" href="http://www.wikidata.org/entity/Q51595283">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Erhard_Blankenburg">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Erhard_Blankenburg">WP (DE)</a> | +| Manfred Weiss (1940-) | German jurist | <a target="_blank" href="http://www.wikidata.org/entity/Q1588285">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Manfred_Weiss_(Jurist)">WP (DE)</a> | +| Rüdiger Voigt (1941-) | German author | <a target="_blank" href="http://www.wikidata.org/entity/Q1682026">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/R%C3%BCdiger_Voigt">WP (DE)</a> | +| Roland Girtler (1941-) | Austrian historian and sociologist | <a target="_blank" href="http://www.wikidata.org/entity/Q112873">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Roland_Girtler">WP (DE)</a> | +| Hubert Treiber (1942-) | German university teacher | <a target="_blank" href="http://www.wikidata.org/entity/Q1633462">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Hubert_Treiber">WP (DE)</a> | +| Brun-Otto Bryde (1943-) | German judge | <a target="_blank" href="http://www.wikidata.org/entity/Q107784">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Brun-Otto_Bryde">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Brun-Otto_Bryde">WP (DE)</a> | +| Hubert Rottleuthner (1944-) | | <a target="_blank" href="http://www.wikidata.org/entity/Q55622018">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Hubert_Rottleuthner">WP (DE)</a> | +| Klaus A. Ziegert (1944-) | German sociologist of law | <a target="_blank" href="http://www.wikidata.org/entity/Q112513122">Wikidata</a> | | | +| Dieter Martiny (1944-) | German jurist | <a target="_blank" href="http://www.wikidata.org/entity/Q1222459">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Dieter_Martiny">WP (DE)</a> | +| Gunther Teubner (1944-) | German academic | <a target="_blank" href="http://www.wikidata.org/entity/Q98304">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Gunther_Teubner">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Gunther_Teubner">WP (DE)</a> | +| Konstanze Plett (1947-) | | <a target="_blank" href="http://www.wikidata.org/entity/Q95192683">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Konstanze_Plett">WP (DE)</a> | +| Armin Höland (1948-) | German university professor | <a target="_blank" href="http://www.wikidata.org/entity/Q15435996">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Armin_H%C3%B6land">WP (DE)</a> | +| Susanne Karstedt (1949-) | criminologist | <a target="_blank" href="http://www.wikidata.org/entity/Q2369299">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Susanne_Karstedt">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Susanne_Karstedt">WP (DE)</a> | +| Leo Kißler (1949-) | | <a target="_blank" href="http://www.wikidata.org/entity/Q63203841">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Leo_Ki%C3%9Fler">WP (DE)</a> | +| Fritz Jost (1949-) | | <a target="_blank" href="http://www.wikidata.org/entity/Q105946060">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Fritz_Jost_(Rechtswissenschaftler)">WP (DE)</a> | +| Doris Lucke (1953-) | German university teacher | <a target="_blank" href="http://www.wikidata.org/entity/Q1245242">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Doris_Lucke">WP (DE)</a> | +| Ralf Rogowski (1953-) | Law professor (born 1953) | <a target="_blank" href="http://www.wikidata.org/entity/Q20128038">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Ralf_Rogowski">WP (EN)</a> | | +| Wolfgang Ludwig-Mayerhofer (1954-) | German sociologist | <a target="_blank" href="http://www.wikidata.org/entity/Q2590472">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Wolfgang_Ludwig-Mayerhofer">WP (DE)</a> | +| Kai Bussmann (1955-) | German jurist | <a target="_blank" href="http://www.wikidata.org/entity/Q1552696">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Kai_Bussmann">WP (DE)</a> | +| Dorothea Jansen (1956-2017) | | <a target="_blank" href="http://www.wikidata.org/entity/Q21258453">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Dorothea_Jansen">WP (DE)</a> | +| Alfons Bora (1957-) | German sociologist | <a target="_blank" href="http://www.wikidata.org/entity/Q2644328">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Alfons_Bora">WP (DE)</a> | +| Ute Sacksofsky (1960-) | German legal scholar | <a target="_blank" href="http://www.wikidata.org/entity/Q48562036">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Ute_Sacksofsky">WP (DE)</a> | +| Stefan Machura (1962-) | | <a target="_blank" href="http://www.wikidata.org/entity/Q95245830">Wikidata</a> | | | +| Ralf Poscher (1962-) | German legal historian | <a target="_blank" href="http://www.wikidata.org/entity/Q2129347">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Ralf_Poscher">WP (DE)</a> | +| Susanne Baer (1964-) | German judge | <a target="_blank" href="http://www.wikidata.org/entity/Q101872">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Susanne_Baer">WP (EN)</a> | <a target="_blank" href="https://de.wikipedia.org/wiki/Susanne_Baer">WP (DE)</a> | +| Gralf-Peter Calliess (1967-) | German jurist | <a target="_blank" href="http://www.wikidata.org/entity/Q1542033">Wikidata</a> | | <a target="_blank" href="https://de.wikipedia.org/wiki/Gralf-Peter_Calliess">WP (DE)</a> | \ No newline at end of file diff --git a/wikidata/output/scholars-uk.csv b/wikidata/output/scholars-uk.csv new file mode 100644 index 0000000..6242c75 --- /dev/null +++ b/wikidata/output/scholars-uk.csv @@ -0,0 +1,12 @@ +fullName,qid,itemdesc,sexOrGender,familyName,givenName,dateOfBirth,dateOfDeath,wikidata_url,wikipedia_en,wikipedia_de +William Twining,Q16095913,Professor of Jurisprudence,male,Twining,Lawrence William,1934-09-22 00:00:00+00:00,,http://www.wikidata.org/entity/Q16095913,https://en.wikipedia.org/wiki/William_Twining, +Philip Aneurin Thomas,Q112432625,,male,Thomas,,1940-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q112432625,, +David Sugarman,Q112366094,,male,Sugarman,David,1948-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q112366094,, +Carol Smart,Q5044563,Feminist sociologist,female,Smart,Carol,1948-12-20 00:00:00+00:00,,http://www.wikidata.org/entity/Q5044563,https://en.wikipedia.org/wiki/Carol_Smart, +David Nelken,Q5237957,British political scientist,male,,David,1949-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q5237957,https://en.wikipedia.org/wiki/David_Nelken, +Rosemary Hunter,Q7368381,Australian jurist,female,Hunter,Rosemary,1962-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q7368381,https://en.wikipedia.org/wiki/Rosemary_Hunter, +Sally Wheeler,Q28078278,Professor and Head of the School of Law at Queen's University Belfast,female,Wheeler,Sally,1964-01-01 00:00:00+00:00,,http://www.wikidata.org/entity/Q28078278,https://en.wikipedia.org/wiki/Sally_Wheeler_(legal_scholar), +Don Harris,Q125080407,British jurist and professor at the university of Oxford (1928-2020),,,,,,http://www.wikidata.org/entity/Q125080407,, +Roger Cotterrell,Q7358027,British academic,male,,Roger,,,http://www.wikidata.org/entity/Q7358027,https://en.wikipedia.org/wiki/Roger_Cotterrell, +Fiona Cownie,Q113809561,,female,,,,,http://www.wikidata.org/entity/Q113809561,, +Joanne Conaghan,Q108276256,British legal scholar,female,Conaghan,Joanne,,,http://www.wikidata.org/entity/Q108276256,https://en.wikipedia.org/wiki/Joanne_Conaghan, diff --git a/wikidata/output/scholars-uk.md b/wikidata/output/scholars-uk.md new file mode 100644 index 0000000..5aa0e90 --- /dev/null +++ b/wikidata/output/scholars-uk.md @@ -0,0 +1,13 @@ +| fullName | itemdesc | wikidata_url | wikipedia_en | +|:------------------------------|:----------------------------------------------------------------------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------| +| William Twining (1934-) | Professor of Jurisprudence | <a target="_blank" href="http://www.wikidata.org/entity/Q16095913">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/William_Twining">WP (EN)</a> | +| Philip Aneurin Thomas (1940-) | | <a target="_blank" href="http://www.wikidata.org/entity/Q112432625">Wikidata</a> | | +| David Sugarman (1948-) | | <a target="_blank" href="http://www.wikidata.org/entity/Q112366094">Wikidata</a> | | +| Carol Smart (1948-) | Feminist sociologist | <a target="_blank" href="http://www.wikidata.org/entity/Q5044563">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Carol_Smart">WP (EN)</a> | +| David Nelken (1949-) | British political scientist | <a target="_blank" href="http://www.wikidata.org/entity/Q5237957">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/David_Nelken">WP (EN)</a> | +| Rosemary Hunter (1962-) | Australian jurist | <a target="_blank" href="http://www.wikidata.org/entity/Q7368381">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Rosemary_Hunter">WP (EN)</a> | +| Sally Wheeler (1964-) | Professor and Head of the School of Law at Queen's University Belfast | <a target="_blank" href="http://www.wikidata.org/entity/Q28078278">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Sally_Wheeler_(legal_scholar)">WP (EN)</a> | +| Don Harris (-) | British jurist and professor at the university of Oxford (1928-2020) | <a target="_blank" href="http://www.wikidata.org/entity/Q125080407">Wikidata</a> | | +| Roger Cotterrell (-) | British academic | <a target="_blank" href="http://www.wikidata.org/entity/Q7358027">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Roger_Cotterrell">WP (EN)</a> | +| Fiona Cownie (-) | | <a target="_blank" href="http://www.wikidata.org/entity/Q113809561">Wikidata</a> | | +| Joanne Conaghan (-) | British legal scholar | <a target="_blank" href="http://www.wikidata.org/entity/Q108276256">Wikidata</a> | <a target="_blank" href="https://en.wikipedia.org/wiki/Joanne_Conaghan">WP (EN)</a> | \ No newline at end of file diff --git a/wikidata/query-wikidata.ipynb b/wikidata/query-wikidata.ipynb deleted file mode 100644 index daeb1b4..0000000 --- a/wikidata/query-wikidata.ipynb +++ /dev/null @@ -1,505 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "initial_id", - "metadata": { - "collapsed": true, - "ExecuteTime": { - "end_time": "2024-03-17T09:35:51.668004200Z", - "start_time": "2024-03-17T09:35:50.655968800Z" - } - }, - "outputs": [], - "source": [ - "import os.path\n", - "import requests\n", - "import pandas as pd\n", - "import textwrap\n", - "\n", - "def generate_sparql_query(fullName, property_labels_to_ids, language='en', qid=None):\n", - " \"\"\"\n", - " Query WikiData for the properties of the given person listed in the given property map,\n", - " either by fullName or QID. When a QID is provided, ?itemLabel is not included in the query.\n", - " :param fullName: Name of the person to query\n", - " :param property_labels_to_ids: Dictionary mapping property labels to WikiData property IDs\n", - " :param language: Language code for the query results\n", - " :param qid: WikiData entity ID (QID) for the person\n", - " :return: SPARQL query string\n", - " \"\"\"\n", - "\n", - " if qid:\n", - " selectClause = \"SELECT DISTINCT ?item\"\n", - " itemConstraint = f\"BIND(wd:{qid} AS ?item).\"\n", - " groupByClause = \"GROUP BY ?item\"\n", - " else:\n", - " selectClause = \"SELECT DISTINCT ?item ?itemLabel\"\n", - " itemConstraint = f'?item wdt:P31 wd:Q5; rdfs:label \"{fullName}\"@{language} .'\n", - " groupByClause = \"GROUP BY ?item ?itemLabel\"\n", - "\n", - " for label, pid in property_labels_to_ids.items():\n", - " # add to property selection\n", - " if label.endswith('Name'):\n", - " selectClause += f'''\n", - " (GROUP_CONCAT(DISTINCT ?{label}Value; separator=\" \") AS ?{label})'''\n", - " else:\n", - " selectClause += f'''\n", - " (SAMPLE(?{label}) AS ?{label})'''\n", - "\n", - " # add to item constraint\n", - " if label.endswith(\"_id\") or label.startswith(\"image\") or label.startswith(\"date\"):\n", - " itemConstraint += f\"\"\"\n", - " OPTIONAL {{ ?item wdt:{pid} ?{label}. }}\"\"\"\n", - " elif label.endswith(\"Name\"):\n", - " itemConstraint += f\"\"\"\n", - " OPTIONAL {{\n", - " ?item p:{pid} ?{label}Statement.\n", - " ?{label}Statement ps:{pid} ?{label}.\n", - " OPTIONAL {{ ?{label}Statement pq:P1545 ?order. }}\n", - " OPTIONAL {{\n", - " ?{label} rdfs:label ?{label}Label.\n", - " FILTER(LANG(?{label}Label) = \"{language}\")\n", - " }}\n", - " BIND(COALESCE(?{label}Label, STR(?{label})) AS ?{label}Value)\n", - " }}\"\"\"\n", - " else:\n", - " itemConstraint += f\"\"\"\n", - " OPTIONAL {{ ?item wdt:{pid} ?{label}Id . ?{label}Id rdfs:label ?{label} FILTER(LANG(?{label}) = \"{language}\") . }}\"\"\"\n", - " \n", - " query = textwrap.dedent(f\"\"\"\n", - " {selectClause} \n", - " WHERE {{\n", - " {itemConstraint}\n", - " }}\n", - " {groupByClause}\n", - " \"\"\")\n", - "\n", - " return query\n", - "\n", - "\n", - "def query_wikidata(fullName, property_map, language='en', qid=None, debug=False):\n", - " SPARQL_ENDPOINT = \"https://query.wikidata.org/sparql\"\n", - " query = generate_sparql_query(fullName, property_map, language, qid=qid)\n", - " if debug:\n", - " print(query)\n", - " headers = {'User-Agent': 'Mozilla/5.0', 'Accept': 'application/json'}\n", - " response = requests.get(SPARQL_ENDPOINT, headers=headers, params={'query': query, 'format': 'json'})\n", - "\n", - " if response.status_code != 200:\n", - " print(query)\n", - " response.raise_for_status()\n", - " \n", - " results = response.json()['results']['bindings']\n", - " \n", - " if not results:\n", - " return []\n", - "\n", - " for i, result in enumerate(results):\n", - " # Initialize with fullName to ensure it appears first\n", - " data = {\n", - " 'fullName': fullName\n", - " }\n", - " \n", - " for label in property_map:\n", - " if label in result:\n", - " value = result[label]['value']\n", - " data[label] = value\n", - " else:\n", - " data[label] = None\n", - " \n", - " # add qid and item URI\n", - " data['qid'] = os.path.basename(result['item']['value'])\n", - " data['wikidata_url'] = result['item']['value']\n", - " results[i] = data\n", - " \n", - " return results\n", - "\n", - "def get_wikipedia_links(qid, languages):\n", - " \"\"\"\n", - " Fetch Wikipedia links for a given Wikidata QID and a list of languages.\n", - "\n", - " Parameters:\n", - " - qid (str): The QID of the Wikidata item.\n", - " - languages (list): A list of language codes (e.g., ['en', 'de']). \n", - "\n", - " Returns:\n", - " - dict: A dictionary with languages as keys and Wikipedia URLs as values.\n", - " \"\"\"\n", - " url = \"https://www.wikidata.org/w/api.php\"\n", - " params = {\n", - " \"action\": \"wbgetentities\",\n", - " \"ids\": qid,\n", - " \"props\": \"sitelinks/urls\",\n", - " \"format\": \"json\"\n", - " }\n", - "\n", - " response = requests.get(url, params=params)\n", - " data = response.json()\n", - " links = {}\n", - " if \"entities\" in data and qid in data[\"entities\"]:\n", - " sitelinks = data[\"entities\"][qid].get(\"sitelinks\", {})\n", - " for lang in languages:\n", - " sitekey = f\"{lang}wiki\"\n", - " if sitekey in sitelinks:\n", - " siteLinkData = sitelinks.get(sitekey)\n", - " if 'url' in siteLinkData:\n", - " links[lang] = siteLinkData.get('url')\n", - " else:\n", - " # Use the 'title' key and construct the URL manually\n", - " title = sitelinks[sitekey][\"title\"]\n", - " links[lang] = f\"https://{lang}.wikipedia.org/wiki/{requests.utils.quote(title)}\"\n", - " else:\n", - " links[lang] = None # Or use '' to represent absence of link\n", - "\n", - " return links\n", - "\n", - "\n", - "def get_person_info_from_wikidata(names, property_map, languages=None, debug=False):\n", - " if languages is None:\n", - " languages = ['en', 'de']\n", - " all_data = []\n", - " print('Retrieving scholar data...')\n", - " for item in names:\n", - " if type(item) is tuple:\n", - " results = query_wikidata(item[0], property_map, languages[0], qid=item[1], debug=debug)\n", - " else:\n", - " results = query_wikidata(item, property_map, languages[0], debug=debug)\n", - " \n", - " all_data += results\n", - "\n", - " # Ensure fullName appears first by reordering columns based on property_labels_to_ids keys\n", - " columns = ['fullName', 'qid'] + list(property_map.keys()) + ['wikidata_url'] + [f'wikipedia_{l}' for l in languages]\n", - " \n", - " if len(all_data) > 0:\n", - " df = pd.DataFrame(all_data, columns=columns, dtype=str)\n", - " # Add wikipedia links\n", - " print(\"Retrieving wikipedia URLs...\")\n", - " # For each QID in the DataFrame, fetch Wikipedia links for all languages and update the DataFrame accordingly\n", - " for index, row in df.iterrows():\n", - " qid = row['qid']\n", - " links = get_wikipedia_links(qid, languages)\n", - " \n", - " # Update the DataFrame directly with the fetched links for each language\n", - " for language in languages:\n", - " df.at[index, f'wikipedia_{language}'] = links.get(language, None)\n", - " else:\n", - " df = pd.DataFrame(columns=columns, dtype=str)\n", - " return df" - ] - }, - { - "cell_type": "markdown", - "source": [ - "## Retrieve Data for a given list of scholars" - ], - "metadata": { - "collapsed": false - }, - "id": "397920a95584f406" - }, - { - "cell_type": "code", - "execution_count": 79, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Retrieving scholar data...\n", - "Retrieving wikipedia URLs...\n" - ] - }, - { - "data": { - "text/plain": " fullName qid sexOrGender familyName givenName \\\n0 Hans Kelsen Q84165 male Kelsen Hans \n1 Hugo Sinzheimer Q86043 male Sinzheimer Hugo D. \n2 Karl Renner Q11726 male Renner Karl \n3 Ernst Fraenkel Q86812 male Fraenkel Ernst \n4 Franz Leopold Neumann Q63195 male Neumann Leopold Franz \n5 Otto Kahn-Freund Q121832 male Kahn Freund Otto \n6 Otto Kirchheimer Q214397 male Kirchheimer Otto \n7 Ludwig Bendix Q15449424 male Bendix Ludwig \n8 Arthur Nussbaum Q103088 male Nussbaum Arthur \n9 Theodor Geiger Q96410 male Geiger Theodor \n10 Erhard Blankenburg Q51595283 male Blankenburg Erhard \n11 Wolfgang Kaupen Q93221485 male Wolfgang \n12 Rüdiger Lautmann Q91074 male Rüdiger \n13 Thilo Ramm Q59533838 male Ramm Thilo \n14 Rudolf Wiethölter Q1512482 male Rudolf \n15 Niklas Luhmann Q57238 male Luhmann Niklas \n16 Hubert Rottleuthner Q55622018 male Hubert \n17 Ralf Rogowski Q112499743 male Rogowski Ralf \n18 Ralf Rogowski Q20128038 male Rogowski Ralf \n19 Gunther Teubner Q98304 male Teubner Gunther \n20 Volkmar Gessner Q15435946 male Gessner Volkmar \n21 Konstanze Plett Q95192683 female \n22 Ute Sacksofsky Q48562036 female Ute \n23 Susanne Baer Q101872 female Baer Susanne \n\n dateOfBirth dateOfDeath gnd_id \\\n0 1881-10-11 00:00:00+00:00 1973-04-19 00:00:00+00:00 118561219 \n1 1875-01-01 00:00:00+00:00 1945-09-16 00:00:00+00:00 118614711 \n2 1870-12-14 00:00:00+00:00 1950-12-31 00:00:00+00:00 118599739 \n3 1898-12-26 00:00:00+00:00 1975-03-28 00:00:00+00:00 118534602 \n4 1900-05-23 00:00:00+00:00 1954-09-02 00:00:00+00:00 118587293 \n5 1900-11-17 00:00:00+00:00 1979-06-16 00:00:00+00:00 118559362 \n6 1905-11-11 00:00:00+00:00 1965-11-22 00:00:00+00:00 118562371 \n7 1877-06-28 00:00:00+00:00 1954-01-03 00:00:00+00:00 118702033 \n8 1877-01-01 00:00:00+00:00 1964-01-01 00:00:00+00:00 117071676 \n9 1891-11-09 00:00:00+00:00 1952-06-16 00:00:00+00:00 118538187 \n10 1938-10-30 00:00:00+00:00 2018-03-28 00:00:00+00:00 115459235 \n11 1936-01-01 00:00:00+00:00 1981-01-01 00:00:00+00:00 124045405 \n12 1935-12-22 00:00:00+00:00 NaT 120502208 \n13 1925-04-04 00:00:00+00:00 2018-06-17 00:00:00+00:00 116327391 \n14 1929-07-17 00:00:00+00:00 NaT 1034437860 \n15 1927-12-08 00:00:00+00:00 1998-11-06 00:00:00+00:00 118575147 \n16 1944-01-01 00:00:00+00:00 NaT 135622751 \n17 1953-01-01 00:00:00+00:00 NaT 17150982X \n18 NaT NaT None \n19 1944-04-30 00:00:00+00:00 NaT 119443562 \n20 1937-10-09 00:00:00+00:00 2014-11-08 00:00:00+00:00 170469328 \n21 1947-01-01 00:00:00+00:00 NaT 124957048 \n22 1960-01-01 00:00:00+00:00 NaT 132505746 \n23 1964-02-16 00:00:00+00:00 NaT 113854161 \n\n wikidata_url \\\n0 http://www.wikidata.org/entity/Q84165 \n1 http://www.wikidata.org/entity/Q86043 \n2 http://www.wikidata.org/entity/Q11726 \n3 http://www.wikidata.org/entity/Q86812 \n4 http://www.wikidata.org/entity/Q63195 \n5 http://www.wikidata.org/entity/Q121832 \n6 http://www.wikidata.org/entity/Q214397 \n7 http://www.wikidata.org/entity/Q15449424 \n8 http://www.wikidata.org/entity/Q103088 \n9 http://www.wikidata.org/entity/Q96410 \n10 http://www.wikidata.org/entity/Q51595283 \n11 http://www.wikidata.org/entity/Q93221485 \n12 http://www.wikidata.org/entity/Q91074 \n13 http://www.wikidata.org/entity/Q59533838 \n14 http://www.wikidata.org/entity/Q1512482 \n15 http://www.wikidata.org/entity/Q57238 \n16 http://www.wikidata.org/entity/Q55622018 \n17 http://www.wikidata.org/entity/Q112499743 \n18 http://www.wikidata.org/entity/Q20128038 \n19 http://www.wikidata.org/entity/Q98304 \n20 http://www.wikidata.org/entity/Q15435946 \n21 http://www.wikidata.org/entity/Q95192683 \n22 http://www.wikidata.org/entity/Q48562036 \n23 http://www.wikidata.org/entity/Q101872 \n\n wikipedia_en \\\n0 https://en.wikipedia.org/wiki/Hans_Kelsen \n1 https://en.wikipedia.org/wiki/Hugo_Sinzheimer \n2 https://en.wikipedia.org/wiki/Karl_Renner \n3 https://en.wikipedia.org/wiki/Ernst_Fraenkel_(... \n4 https://en.wikipedia.org/wiki/Franz_Neumann_(p... \n5 https://en.wikipedia.org/wiki/Otto_Kahn-Freund \n6 https://en.wikipedia.org/wiki/Otto_Kirchheimer \n7 None \n8 https://en.wikipedia.org/wiki/Arthur_Nussbaum \n9 https://en.wikipedia.org/wiki/Theodor_Geiger \n10 https://en.wikipedia.org/wiki/Erhard_Blankenburg \n11 None \n12 https://en.wikipedia.org/wiki/R%C3%BCdiger_Lau... \n13 None \n14 None \n15 https://en.wikipedia.org/wiki/Niklas_Luhmann \n16 None \n17 None \n18 https://en.wikipedia.org/wiki/Ralf_Rogowski \n19 https://en.wikipedia.org/wiki/Gunther_Teubner \n20 https://en.wikipedia.org/wiki/Volkmar_Gessner \n21 None \n22 None \n23 https://en.wikipedia.org/wiki/Susanne_Baer \n\n wikipedia_de \n0 https://de.wikipedia.org/wiki/Hans_Kelsen \n1 https://de.wikipedia.org/wiki/Hugo_Sinzheimer \n2 https://de.wikipedia.org/wiki/Karl_Renner \n3 https://de.wikipedia.org/wiki/Ernst_Fraenkel_(... \n4 https://de.wikipedia.org/wiki/Franz_Neumann_(P... \n5 https://de.wikipedia.org/wiki/Otto_Kahn-Freund \n6 https://de.wikipedia.org/wiki/Otto_Kirchheimer \n7 https://de.wikipedia.org/wiki/Ludwig_Bendix \n8 https://de.wikipedia.org/wiki/Arthur_Nussbaum \n9 https://de.wikipedia.org/wiki/Theodor_Geiger \n10 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n11 None \n12 https://de.wikipedia.org/wiki/R%C3%BCdiger_Lau... \n13 https://de.wikipedia.org/wiki/Thilo_Ramm \n14 https://de.wikipedia.org/wiki/Rudolf_Wieth%C3%... \n15 https://de.wikipedia.org/wiki/Niklas_Luhmann \n16 https://de.wikipedia.org/wiki/Hubert_Rottleuthner \n17 None \n18 None \n19 https://de.wikipedia.org/wiki/Gunther_Teubner \n20 https://de.wikipedia.org/wiki/Volkmar_Gessner \n21 https://de.wikipedia.org/wiki/Konstanze_Plett \n22 https://de.wikipedia.org/wiki/Ute_Sacksofsky \n23 https://de.wikipedia.org/wiki/Susanne_Baer ", - "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>fullName</th>\n <th>qid</th>\n <th>sexOrGender</th>\n <th>familyName</th>\n <th>givenName</th>\n <th>dateOfBirth</th>\n <th>dateOfDeath</th>\n <th>gnd_id</th>\n <th>wikidata_url</th>\n <th>wikipedia_en</th>\n <th>wikipedia_de</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>Hans Kelsen</td>\n <td>Q84165</td>\n <td>male</td>\n <td>Kelsen</td>\n <td>Hans</td>\n <td>1881-10-11 00:00:00+00:00</td>\n <td>1973-04-19 00:00:00+00:00</td>\n <td>118561219</td>\n <td>http://www.wikidata.org/entity/Q84165</td>\n <td>https://en.wikipedia.org/wiki/Hans_Kelsen</td>\n <td>https://de.wikipedia.org/wiki/Hans_Kelsen</td>\n </tr>\n <tr>\n <th>1</th>\n <td>Hugo Sinzheimer</td>\n <td>Q86043</td>\n <td>male</td>\n <td>Sinzheimer</td>\n <td>Hugo D.</td>\n <td>1875-01-01 00:00:00+00:00</td>\n <td>1945-09-16 00:00:00+00:00</td>\n <td>118614711</td>\n <td>http://www.wikidata.org/entity/Q86043</td>\n <td>https://en.wikipedia.org/wiki/Hugo_Sinzheimer</td>\n <td>https://de.wikipedia.org/wiki/Hugo_Sinzheimer</td>\n </tr>\n <tr>\n <th>2</th>\n <td>Karl Renner</td>\n <td>Q11726</td>\n <td>male</td>\n <td>Renner</td>\n <td>Karl</td>\n <td>1870-12-14 00:00:00+00:00</td>\n <td>1950-12-31 00:00:00+00:00</td>\n <td>118599739</td>\n <td>http://www.wikidata.org/entity/Q11726</td>\n <td>https://en.wikipedia.org/wiki/Karl_Renner</td>\n <td>https://de.wikipedia.org/wiki/Karl_Renner</td>\n </tr>\n <tr>\n <th>3</th>\n <td>Ernst Fraenkel</td>\n <td>Q86812</td>\n <td>male</td>\n <td>Fraenkel</td>\n <td>Ernst</td>\n <td>1898-12-26 00:00:00+00:00</td>\n <td>1975-03-28 00:00:00+00:00</td>\n <td>118534602</td>\n <td>http://www.wikidata.org/entity/Q86812</td>\n <td>https://en.wikipedia.org/wiki/Ernst_Fraenkel_(...</td>\n <td>https://de.wikipedia.org/wiki/Ernst_Fraenkel_(...</td>\n </tr>\n <tr>\n <th>4</th>\n <td>Franz Leopold Neumann</td>\n <td>Q63195</td>\n <td>male</td>\n <td>Neumann</td>\n <td>Leopold Franz</td>\n <td>1900-05-23 00:00:00+00:00</td>\n <td>1954-09-02 00:00:00+00:00</td>\n <td>118587293</td>\n <td>http://www.wikidata.org/entity/Q63195</td>\n <td>https://en.wikipedia.org/wiki/Franz_Neumann_(p...</td>\n <td>https://de.wikipedia.org/wiki/Franz_Neumann_(P...</td>\n </tr>\n <tr>\n <th>5</th>\n <td>Otto Kahn-Freund</td>\n <td>Q121832</td>\n <td>male</td>\n <td>Kahn Freund</td>\n <td>Otto</td>\n <td>1900-11-17 00:00:00+00:00</td>\n <td>1979-06-16 00:00:00+00:00</td>\n <td>118559362</td>\n <td>http://www.wikidata.org/entity/Q121832</td>\n <td>https://en.wikipedia.org/wiki/Otto_Kahn-Freund</td>\n <td>https://de.wikipedia.org/wiki/Otto_Kahn-Freund</td>\n </tr>\n <tr>\n <th>6</th>\n <td>Otto Kirchheimer</td>\n <td>Q214397</td>\n <td>male</td>\n <td>Kirchheimer</td>\n <td>Otto</td>\n <td>1905-11-11 00:00:00+00:00</td>\n <td>1965-11-22 00:00:00+00:00</td>\n <td>118562371</td>\n <td>http://www.wikidata.org/entity/Q214397</td>\n <td>https://en.wikipedia.org/wiki/Otto_Kirchheimer</td>\n <td>https://de.wikipedia.org/wiki/Otto_Kirchheimer</td>\n </tr>\n <tr>\n <th>7</th>\n <td>Ludwig Bendix</td>\n <td>Q15449424</td>\n <td>male</td>\n <td>Bendix</td>\n <td>Ludwig</td>\n <td>1877-06-28 00:00:00+00:00</td>\n <td>1954-01-03 00:00:00+00:00</td>\n <td>118702033</td>\n <td>http://www.wikidata.org/entity/Q15449424</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Ludwig_Bendix</td>\n </tr>\n <tr>\n <th>8</th>\n <td>Arthur Nussbaum</td>\n <td>Q103088</td>\n <td>male</td>\n <td>Nussbaum</td>\n <td>Arthur</td>\n <td>1877-01-01 00:00:00+00:00</td>\n <td>1964-01-01 00:00:00+00:00</td>\n <td>117071676</td>\n <td>http://www.wikidata.org/entity/Q103088</td>\n <td>https://en.wikipedia.org/wiki/Arthur_Nussbaum</td>\n <td>https://de.wikipedia.org/wiki/Arthur_Nussbaum</td>\n </tr>\n <tr>\n <th>9</th>\n <td>Theodor Geiger</td>\n <td>Q96410</td>\n <td>male</td>\n <td>Geiger</td>\n <td>Theodor</td>\n <td>1891-11-09 00:00:00+00:00</td>\n <td>1952-06-16 00:00:00+00:00</td>\n <td>118538187</td>\n <td>http://www.wikidata.org/entity/Q96410</td>\n <td>https://en.wikipedia.org/wiki/Theodor_Geiger</td>\n <td>https://de.wikipedia.org/wiki/Theodor_Geiger</td>\n </tr>\n <tr>\n <th>10</th>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>male</td>\n <td>Blankenburg</td>\n <td>Erhard</td>\n <td>1938-10-30 00:00:00+00:00</td>\n <td>2018-03-28 00:00:00+00:00</td>\n <td>115459235</td>\n <td>http://www.wikidata.org/entity/Q51595283</td>\n <td>https://en.wikipedia.org/wiki/Erhard_Blankenburg</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n </tr>\n <tr>\n <th>11</th>\n <td>Wolfgang Kaupen</td>\n <td>Q93221485</td>\n <td>male</td>\n <td></td>\n <td>Wolfgang</td>\n <td>1936-01-01 00:00:00+00:00</td>\n <td>1981-01-01 00:00:00+00:00</td>\n <td>124045405</td>\n <td>http://www.wikidata.org/entity/Q93221485</td>\n <td>None</td>\n <td>None</td>\n </tr>\n <tr>\n <th>12</th>\n <td>Rüdiger Lautmann</td>\n <td>Q91074</td>\n <td>male</td>\n <td></td>\n <td>Rüdiger</td>\n <td>1935-12-22 00:00:00+00:00</td>\n <td>NaT</td>\n <td>120502208</td>\n <td>http://www.wikidata.org/entity/Q91074</td>\n <td>https://en.wikipedia.org/wiki/R%C3%BCdiger_Lau...</td>\n <td>https://de.wikipedia.org/wiki/R%C3%BCdiger_Lau...</td>\n </tr>\n <tr>\n <th>13</th>\n <td>Thilo Ramm</td>\n <td>Q59533838</td>\n <td>male</td>\n <td>Ramm</td>\n <td>Thilo</td>\n <td>1925-04-04 00:00:00+00:00</td>\n <td>2018-06-17 00:00:00+00:00</td>\n <td>116327391</td>\n <td>http://www.wikidata.org/entity/Q59533838</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Thilo_Ramm</td>\n </tr>\n <tr>\n <th>14</th>\n <td>Rudolf Wiethölter</td>\n <td>Q1512482</td>\n <td>male</td>\n <td></td>\n <td>Rudolf</td>\n <td>1929-07-17 00:00:00+00:00</td>\n <td>NaT</td>\n <td>1034437860</td>\n <td>http://www.wikidata.org/entity/Q1512482</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Rudolf_Wieth%C3%...</td>\n </tr>\n <tr>\n <th>15</th>\n <td>Niklas Luhmann</td>\n <td>Q57238</td>\n <td>male</td>\n <td>Luhmann</td>\n <td>Niklas</td>\n <td>1927-12-08 00:00:00+00:00</td>\n <td>1998-11-06 00:00:00+00:00</td>\n <td>118575147</td>\n <td>http://www.wikidata.org/entity/Q57238</td>\n <td>https://en.wikipedia.org/wiki/Niklas_Luhmann</td>\n <td>https://de.wikipedia.org/wiki/Niklas_Luhmann</td>\n </tr>\n <tr>\n <th>16</th>\n <td>Hubert Rottleuthner</td>\n <td>Q55622018</td>\n <td>male</td>\n <td></td>\n <td>Hubert</td>\n <td>1944-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>135622751</td>\n <td>http://www.wikidata.org/entity/Q55622018</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Hubert_Rottleuthner</td>\n </tr>\n <tr>\n <th>17</th>\n <td>Ralf Rogowski</td>\n <td>Q112499743</td>\n <td>male</td>\n <td>Rogowski</td>\n <td>Ralf</td>\n <td>1953-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>17150982X</td>\n <td>http://www.wikidata.org/entity/Q112499743</td>\n <td>None</td>\n <td>None</td>\n </tr>\n <tr>\n <th>18</th>\n <td>Ralf Rogowski</td>\n <td>Q20128038</td>\n <td>male</td>\n <td>Rogowski</td>\n <td>Ralf</td>\n <td>NaT</td>\n <td>NaT</td>\n <td>None</td>\n <td>http://www.wikidata.org/entity/Q20128038</td>\n <td>https://en.wikipedia.org/wiki/Ralf_Rogowski</td>\n <td>None</td>\n </tr>\n <tr>\n <th>19</th>\n <td>Gunther Teubner</td>\n <td>Q98304</td>\n <td>male</td>\n <td>Teubner</td>\n <td>Gunther</td>\n <td>1944-04-30 00:00:00+00:00</td>\n <td>NaT</td>\n <td>119443562</td>\n <td>http://www.wikidata.org/entity/Q98304</td>\n <td>https://en.wikipedia.org/wiki/Gunther_Teubner</td>\n <td>https://de.wikipedia.org/wiki/Gunther_Teubner</td>\n </tr>\n <tr>\n <th>20</th>\n <td>Volkmar Gessner</td>\n <td>Q15435946</td>\n <td>male</td>\n <td>Gessner</td>\n <td>Volkmar</td>\n <td>1937-10-09 00:00:00+00:00</td>\n <td>2014-11-08 00:00:00+00:00</td>\n <td>170469328</td>\n <td>http://www.wikidata.org/entity/Q15435946</td>\n <td>https://en.wikipedia.org/wiki/Volkmar_Gessner</td>\n <td>https://de.wikipedia.org/wiki/Volkmar_Gessner</td>\n </tr>\n <tr>\n <th>21</th>\n <td>Konstanze Plett</td>\n <td>Q95192683</td>\n <td>female</td>\n <td></td>\n <td></td>\n <td>1947-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>124957048</td>\n <td>http://www.wikidata.org/entity/Q95192683</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Konstanze_Plett</td>\n </tr>\n <tr>\n <th>22</th>\n <td>Ute Sacksofsky</td>\n <td>Q48562036</td>\n <td>female</td>\n <td></td>\n <td>Ute</td>\n <td>1960-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>132505746</td>\n <td>http://www.wikidata.org/entity/Q48562036</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Ute_Sacksofsky</td>\n </tr>\n <tr>\n <th>23</th>\n <td>Susanne Baer</td>\n <td>Q101872</td>\n <td>female</td>\n <td>Baer</td>\n <td>Susanne</td>\n <td>1964-02-16 00:00:00+00:00</td>\n <td>NaT</td>\n <td>113854161</td>\n <td>http://www.wikidata.org/entity/Q101872</td>\n <td>https://en.wikipedia.org/wiki/Susanne_Baer</td>\n <td>https://de.wikipedia.org/wiki/Susanne_Baer</td>\n </tr>\n </tbody>\n</table>\n</div>" - }, - "execution_count": 79, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# Now calling the updated function with the 'language' parameter\n", - "property_labels_to_ids = {\n", - " 'sexOrGender': 'P21',\n", - "# 'image': 'P18',\n", - "# 'countryOfCitizenship': 'P27',\n", - " 'familyName': 'P734',\n", - " 'givenName': 'P735',\n", - " 'dateOfBirth': 'P569',\n", - " 'dateOfDeath': 'P570',\n", - "# 'occupation': 'P106',\n", - "# 'fieldOfWork': 'P101',\n", - "# 'viaf_id': 'P214',\n", - "# 'isni_id': 'P213',\n", - " 'gnd_id': 'P227'\n", - "}\n", - "\n", - "scholars = [\n", - " \"Hans Kelsen\",\n", - " \"Hugo Sinzheimer\",\n", - " (\"Karl Renner\",\"Q11726\"),\n", - " (\"Ernst Fraenkel\", \"Q86812\"),\n", - " (\"Franz Leopold Neumann\", \"Q63195\"),\n", - " \"Otto Kahn-Freund\",\n", - " \"Otto Kirchheimer\",\n", - " \"Herrmann Kantorowicz\",\n", - " (\"Ludwig Bendix\", \"Q15449424\"),\n", - " (\"Arthur Nussbaum\", \"Q103088\"),\n", - " \"Theodor Geiger\",\n", - " \"Erhard Blankenburg\",\n", - " \"Wolfgang Kaupen\",\n", - " \"Rüdiger Lautmann\",\n", - " \"Thilo Ramm\",\n", - " \"Rudolf Wiethölter\",\n", - " (\"Niklas Luhmann\",\"Q57238\"),\n", - " 'Hubert Rottleuthner',\n", - " 'Ralf Rogowski',\n", - " \"Gunther Teubner\",\n", - " \"Volkmar Gessner\",\n", - " \"Konstanze Plett\",\n", - " \"Ute Sacksofsky\",\n", - " (\"Susanne Baer\",\"Q101872\")\n", - "]\n", - "df = get_person_info_from_wikidata(scholars, property_labels_to_ids, debug=False)\n", - "# Convert date strings to datetime\n", - "df['dateOfBirth'] = pd.to_datetime(df['dateOfBirth'])\n", - "df['dateOfDeath'] = pd.to_datetime(df['dateOfDeath'])\n", - "df.to_csv(\"scholars.csv\", index=False)\n", - "df" - ], - "metadata": { - "collapsed": false, - "ExecuteTime": { - "end_time": "2024-03-14T08:56:20.884808600Z", - "start_time": "2024-03-14T08:55:49.510655700Z" - } - }, - "id": "19ddabbda261cc90" - }, - { - "cell_type": "markdown", - "source": [ - "## Create a list of scholar's QIDs only" - ], - "metadata": { - "collapsed": false - }, - "id": "b81815a61da16209" - }, - { - "cell_type": "code", - "execution_count": 83, - "outputs": [], - "source": [ - "df.copy()[['fullName', 'qid']].to_csv(\"scholars-qid.csv\", index=False)" - ], - "metadata": { - "collapsed": false, - "ExecuteTime": { - "end_time": "2024-03-14T09:03:26.160288500Z", - "start_time": "2024-03-14T09:03:26.141305200Z" - } - }, - "id": "4d6da32e2fbc1740" - }, - { - "cell_type": "markdown", - "source": [ - "## Create a clickable list of Wikidata/Wikipedia URLs" - ], - "metadata": { - "collapsed": false - }, - "id": "d9d0790315730b82" - }, - { - "cell_type": "code", - "execution_count": 76, - "outputs": [ - { - "data": { - "text/plain": "<IPython.core.display.Markdown object>", - "text/markdown": "| | fullName | qid | familyName | givenName | wikidata_url | wikipedia_en | wikipedia_de |\n|---:|:----------------------|:----------|:-------------|:--------------|:--------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------|\n| 0 | Hans Kelsen | Q84165 | Kelsen | Hans | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q84165\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Hans_Kelsen\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Hans_Kelsen\">Wikipedia (DE)</a> |\n| 1 | Hugo Sinzheimer | Q86043 | Sinzheimer | Hugo D. | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q86043\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Hugo_Sinzheimer\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Hugo_Sinzheimer\">Wikipedia (DE)</a> |\n| 2 | Karl Renner | Q11726 | Renner | Karl | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q11726\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Karl_Renner\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Karl_Renner\">Wikipedia (DE)</a> |\n| 3 | Ernst Fraenkel | Q86812 | Fraenkel | Ernst | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q86812\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Ernst_Fraenkel_(political_scientist)\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Ernst_Fraenkel_(Politikwissenschaftler)\">Wikipedia (DE)</a> |\n| 4 | Franz Leopold Neumann | Q63195 | Neumann | Leopold Franz | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q63195\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Franz_Neumann_(political_scientist)\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Franz_Neumann_(Politikwissenschaftler)\">Wikipedia (DE)</a> |\n| 5 | Otto Kahn-Freund | Q121832 | Kahn Freund | Otto | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q121832\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Otto_Kahn-Freund\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Otto_Kahn-Freund\">Wikipedia (DE)</a> |\n| 6 | Otto Kirchheimer | Q214397 | Kirchheimer | Otto | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q214397\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Otto_Kirchheimer\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Otto_Kirchheimer\">Wikipedia (DE)</a> |\n| 7 | Ludwig Bendix | Q15449424 | Bendix | Ludwig | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q15449424\">Wikidata</a> | <a target=\"_blank\" href=\"None\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Ludwig_Bendix\">Wikipedia (DE)</a> |\n| 8 | Arthur Nussbaum | Q103088 | Nussbaum | Arthur | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q103088\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Arthur_Nussbaum\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Arthur_Nussbaum\">Wikipedia (DE)</a> |\n| 9 | Theodor Geiger | Q96410 | Geiger | Theodor | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q96410\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Theodor_Geiger\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Theodor_Geiger\">Wikipedia (DE)</a> |\n| 10 | Erhard Blankenburg | Q51595283 | Blankenburg | Erhard | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q51595283\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Erhard_Blankenburg\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Erhard_Blankenburg\">Wikipedia (DE)</a> |\n| 11 | Wolfgang Kaupen | Q93221485 | | Wolfgang | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q93221485\">Wikidata</a> | <a target=\"_blank\" href=\"None\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"None\">Wikipedia (DE)</a> |\n| 12 | Rüdiger Lautmann | Q91074 | | Rüdiger | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q91074\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/R%C3%BCdiger_Lautmann\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/R%C3%BCdiger_Lautmann\">Wikipedia (DE)</a> |\n| 13 | Thilo Ramm | Q59533838 | Ramm | Thilo | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q59533838\">Wikidata</a> | <a target=\"_blank\" href=\"None\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Thilo_Ramm\">Wikipedia (DE)</a> |\n| 14 | Rudolf Wiethölter | Q1512482 | | Rudolf | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q1512482\">Wikidata</a> | <a target=\"_blank\" href=\"None\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Rudolf_Wieth%C3%B6lter\">Wikipedia (DE)</a> |\n| 15 | Niklas Luhmann | Q57238 | Luhmann | Niklas | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q57238\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Niklas_Luhmann\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Niklas_Luhmann\">Wikipedia (DE)</a> |\n| 16 | Hubert Rottleuthner | Q55622018 | | Hubert | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q55622018\">Wikidata</a> | <a target=\"_blank\" href=\"None\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Hubert_Rottleuthner\">Wikipedia (DE)</a> |\n| 17 | Gunther Teubner | Q98304 | Teubner | Gunther | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q98304\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Gunther_Teubner\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Gunther_Teubner\">Wikipedia (DE)</a> |\n| 18 | Volkmar Gessner | Q15435946 | Gessner | Volkmar | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q15435946\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Volkmar_Gessner\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Volkmar_Gessner\">Wikipedia (DE)</a> |\n| 19 | Konstanze Plett | Q95192683 | | | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q95192683\">Wikidata</a> | <a target=\"_blank\" href=\"None\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Konstanze_Plett\">Wikipedia (DE)</a> |\n| 20 | Ute Sacksofsky | Q48562036 | | Ute | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q48562036\">Wikidata</a> | <a target=\"_blank\" href=\"None\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Ute_Sacksofsky\">Wikipedia (DE)</a> |\n| 21 | Susanne Baer | Q101872 | Baer | Susanne | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q101872\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Susanne_Baer\">Wikipedia (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Susanne_Baer\">Wikipedia (DE)</a> |" - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "import pandas as pd\n", - "from IPython.display import display, Markdown\n", - "\n", - "# Function to convert URLs to HTML links\n", - "def make_clickable(val, name):\n", - " return f'<a target=\"_blank\" href=\"{val}\">{name}</a>'\n", - "\n", - "# Apply the function to each URL column\n", - "df_styled = df.copy()[['fullName', 'qid', 'familyName', 'givenName', 'wikidata_url', 'wikipedia_en', 'wikipedia_de' ]]\n", - "df_styled['wikidata_url'] = df['wikidata_url'].apply(make_clickable, name='Wikidata')\n", - "df_styled['wikipedia_en'] = df['wikipedia_en'].apply(make_clickable, name='Wikipedia (EN)')\n", - "df_styled['wikipedia_de'] = df['wikipedia_de'].apply(make_clickable, name='Wikipedia (DE)')\n", - "\n", - "# Display the DataFrame as HTML\n", - "display(Markdown(df_styled.to_markdown()))\n" - ], - "metadata": { - "collapsed": false, - "ExecuteTime": { - "end_time": "2024-03-14T08:53:06.819629Z", - "start_time": "2024-03-14T08:53:06.787707300Z" - } - }, - "id": "2d7bdaeed0f38415" - }, - { - "cell_type": "code", - "execution_count": 13, - "outputs": [ - { - "ename": "TypeError", - "evalue": "'>' not supported between instances of 'float' and 'str'", - "output_type": "error", - "traceback": [ - "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m", - "\u001B[1;31mTypeError\u001B[0m Traceback (most recent call last)", - "Cell \u001B[1;32mIn[13], line 20\u001B[0m\n\u001B[0;32m 18\u001B[0m df[\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mrow\u001B[39m\u001B[38;5;124m'\u001B[39m] \u001B[38;5;241m=\u001B[39m \u001B[38;5;241m0\u001B[39m\n\u001B[0;32m 19\u001B[0m \u001B[38;5;28;01mfor\u001B[39;00m index, scholar \u001B[38;5;129;01min\u001B[39;00m df\u001B[38;5;241m.\u001B[39miterrows():\n\u001B[1;32m---> 20\u001B[0m row \u001B[38;5;241m=\u001B[39m \u001B[43mfind_row\u001B[49m\u001B[43m(\u001B[49m\u001B[43mlast_dates\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mscholar\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43mdateOfBirth\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[43m]\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 21\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m row \u001B[38;5;241m<\u001B[39m \u001B[38;5;28mlen\u001B[39m(last_dates):\n\u001B[0;32m 22\u001B[0m last_dates[row] \u001B[38;5;241m=\u001B[39m scholar[\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mdateOfDeath\u001B[39m\u001B[38;5;124m'\u001B[39m]\n", - "Cell \u001B[1;32mIn[13], line 13\u001B[0m, in \u001B[0;36mfind_row\u001B[1;34m(last_dates, start_date)\u001B[0m\n\u001B[0;32m 11\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m \u001B[38;5;21mfind_row\u001B[39m(last_dates, start_date):\n\u001B[0;32m 12\u001B[0m \u001B[38;5;28;01mfor\u001B[39;00m i, last_date \u001B[38;5;129;01min\u001B[39;00m \u001B[38;5;28menumerate\u001B[39m(last_dates):\n\u001B[1;32m---> 13\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[43mstart_date\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m>\u001B[39;49m\u001B[43m \u001B[49m\u001B[43mlast_date\u001B[49m:\n\u001B[0;32m 14\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m i\n\u001B[0;32m 15\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mlen\u001B[39m(last_dates)\n", - "\u001B[1;31mTypeError\u001B[0m: '>' not supported between instances of 'float' and 'str'" - ] - } - ], - "source": [ - "import pandas as pd\n", - "import plotly.express as px\n", - "\n", - "# Load the data\n", - "df = pd.read_csv(\"scholars.csv\", encoding='utf-8')\n", - "\n", - "# Initialize a list to track the last dateOfDeath in each row to manage overlaps\n", - "last_dates = []\n", - "\n", - "# Function to find the appropriate row for each scholar\n", - "def find_row(last_dates, start_date):\n", - " for i, last_date in enumerate(last_dates):\n", - " if start_date > last_date:\n", - " return i\n", - " return len(last_dates)\n", - "\n", - "# Assign rows without overlaps and sort by the earliest dateOfBirth\n", - "df['row'] = 0\n", - "for index, scholar in df.iterrows():\n", - " row = find_row(last_dates, scholar['dateOfBirth'])\n", - " if row < len(last_dates):\n", - " last_dates[row] = scholar['dateOfDeath']\n", - " else:\n", - " last_dates.append(scholar['dateOfDeath'])\n", - " df.at[index, 'row'] = row\n", - "\n", - "# Now plotting without row labels\n", - "fig = px.timeline(df, x_start=\"dateOfBirth\", x_end=\"dateOfDeath\", y=\"row\", text=\"fullName\", title=\"Scholars' Life Spans Timeline\")\n", - "\n", - "# Update layout\n", - "fig.update_layout(yaxis=dict(tickmode='array', tickvals=[], ticktext=[]))\n", - "fig.update_yaxes(autorange=\"reversed\") # This reverses the y-axis to match your requirement\n", - "\n", - "fig.show()\n", - "\n" - ], - "metadata": { - "collapsed": false, - "ExecuteTime": { - "end_time": "2024-03-11T22:37:55.002823500Z", - "start_time": "2024-03-11T22:37:53.483582400Z" - } - }, - "id": "9bdf188991f29962" - }, - { - "cell_type": "code", - "execution_count": 44, - "outputs": [], - "source": [ - "import pandas as pd\n", - "from datetime import datetime\n", - "\n", - "# Assuming df is your existing DataFrame\n", - "\n", - "# Convert dateOfBirth and dateOfDeath to just the year, handle NaT/NaN appropriately\n", - "df['Year'] = pd.to_datetime(df['dateOfBirth'], errors='coerce').dt.year.astype('Int64')\n", - "df['End Year'] = pd.to_datetime(df['dateOfDeath'], errors='coerce').dt.year.astype('Int64')\n", - "\n", - "# Create 'Display Date' as \"dateOfBirth - dateOfDeath\"\n", - "df['Display Date'] = df['Year'].astype(str).replace('<NA>','') + ' - ' + df['End Year'].astype(str).replace('<NA>','')\n", - "\n", - "# Create 'Headline' as \"fullName (dateOfBirth - dateOfDeath)\"\n", - "df['Headline'] = df['fullName'] + ' (' + df['Display Date'] + ')'\n", - "\n", - "# Create 'Text' column by combining occupation, fieldOfWork, employer\n", - "df['Text'] = df[['occupation', 'fieldOfWork']].apply(lambda x: '<br>'.join(x.dropna()), axis=1)\n", - "\n", - "# Use the image directly; assuming the URLs are already correctly formed in the 'image' column\n", - "df['Media'] = df['image']\n", - "\n", - "# Add a \"Group\" column with the value \"actors\" for all rows\n", - "df['Group'] = 'actors'\n", - "\n", - "# fix date columns\n", - "df['Display Date'] = df['Display Date'].fillna('') # Ensure no NaNs in Display Date\n", - "df['Headline'] = df['Headline'].fillna('') # Ensure no NaNs in Headline\n", - "df['Text'] = df['Text'].fillna('') # Ensure no NaNs in Text\n", - "df['Media'] = df['Media'].fillna('') # Ensure no NaNs in Media\n", - "\n", - "# Now select and order the DataFrame according to the TimelineJS template requirements\n", - "columns = \"Year\tMonth\tDay\tTime\tEnd Year\tEnd Month\tEnd Day\tEnd Time\tDisplay Date\tHeadline\tText\tMedia\tMedia Credit\tMedia Caption\tMedia Thumbnail\tType\tGroup\tBackground\tLink\".split(\"\\t\")\n", - "for col in columns:\n", - " if col not in df:\n", - " df[col] = ''\n", - "timeline_df = df[columns]\n", - "\n", - "timeline_df.to_excel(\"timeline_data.xlsx\", index=False)\n" - ], - "metadata": { - "collapsed": false, - "ExecuteTime": { - "end_time": "2024-03-06T15:08:24.294712700Z", - "start_time": "2024-03-06T15:08:24.250520100Z" - } - }, - "id": "b8058de7fa9212b" - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [], - "metadata": { - "collapsed": false - }, - "id": "f4b14ea7d4941e57" - } - ], - "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/scholars-de.ipynb b/wikidata/scholars-de.ipynb new file mode 100644 index 0000000..658f307 --- /dev/null +++ b/wikidata/scholars-de.ipynb @@ -0,0 +1,400 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "source": [ + "## Retrieve Data for a given list of scholars" + ], + "metadata": { + "collapsed": false + }, + "id": "397920a95584f406" + }, + { + "cell_type": "code", + "execution_count": 1, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Retrieving scholar data...\n", + "Retrieving wikipedia URLs...\n" + ] + }, + { + "data": { + "text/plain": " fullName qid \\\n0 Karl Renner Q11726 \n1 Hugo Sinzheimer Q86043 \n2 Arthur Nussbaum Q103088 \n3 Ludwig Bendix Q15449424 \n4 Hans Kelsen Q84165 \n5 Theodor Geiger Q96410 \n6 Ernst Fraenkel Q86812 \n7 Franz Leopold Neumann Q63195 \n8 Otto Kahn-Freund Q121832 \n9 Ernst Eduard Hirsch Q107033 \n10 Otto Kirchheimer Q214397 \n11 Helmut Schelsky Q104272 \n12 Hans Ryffel Q21035905 \n13 Theo Rasehorn Q1304659 \n14 Rudolf Wassermann Q1551290 \n15 Thilo Ramm Q59533838 \n16 Niklas Luhmann Q57238 \n17 Rudolf Wiethölter Q1512482 \n18 Günter Dux Q1560417 \n19 Jutta Limbach Q72551 \n20 Thomas Raiser Q27909309 \n21 Manfred Rehbinder Q1889820 \n22 Rüdiger Lautmann Q91074 \n23 Wolfgang Kaupen Q93221485 \n24 Volkmar Gessner Q15435946 \n25 Klaus F. Röhl Q27148390 \n26 Erhard Blankenburg Q51595283 \n27 Manfred Weiss Q1588285 \n28 Rüdiger Voigt Q1682026 \n29 Roland Girtler Q112873 \n30 Hubert Treiber Q1633462 \n31 Brun-Otto Bryde Q107784 \n32 Hubert Rottleuthner Q55622018 \n33 Klaus A. Ziegert Q112513122 \n34 Dieter Martiny Q1222459 \n35 Gunther Teubner Q98304 \n36 Konstanze Plett Q95192683 \n37 Armin Höland Q15435996 \n38 Susanne Karstedt Q2369299 \n39 Leo Kißler Q63203841 \n40 Fritz Jost Q105946060 \n41 Doris Lucke Q1245242 \n42 Ralf Rogowski Q20128038 \n43 Wolfgang Ludwig-Mayerhofer Q2590472 \n44 Kai Bussmann Q1552696 \n45 Dorothea Jansen Q21258453 \n46 Alfons Bora Q2644328 \n47 Ute Sacksofsky Q48562036 \n48 Stefan Machura Q95245830 \n49 Ralf Poscher Q2129347 \n50 Susanne Baer Q101872 \n51 Gralf-Peter Calliess Q1542033 \n\n itemdesc sexOrGender \\\n0 first President of Austria (1870–1950) male \n1 German politician (1875-1945) male \n2 German American jurist male \n3 German economist, civil law notary and lawyer ... male \n4 Austrian lawyer male \n5 German sociologist (1891-1952) male \n6 political scientist (1898-1975) male \n7 German political activist male \n8 German-British jurist male \n9 German judge (1902-1985) male \n10 German-American legal scholar male \n11 German sociologist (1912-1984) male \n12 (1913-1989) male \n13 German judge and author male \n14 German judge (1925-2008) male \n15 German legal scholar and author male \n16 German sociologist, administration expert, and... male \n17 German jurist male \n18 German sociologist male \n19 German judge and politician (SPD) (1934-2016) female \n20 None male \n21 German jurist male \n22 German sociologist and LGBT researcher male \n23 None male \n24 University professor male \n25 None male \n26 German sociologist of law (1938-2018) male \n27 German jurist male \n28 German author male \n29 Austrian historian and sociologist male \n30 German university teacher male \n31 German judge male \n32 None male \n33 German sociologist of law male \n34 German jurist male \n35 German academic male \n36 None female \n37 German university professor male \n38 criminologist female \n39 None male \n40 None male \n41 German university teacher female \n42 Law professor (born 1953) male \n43 German sociologist male \n44 German jurist male \n45 None female \n46 German sociologist male \n47 German legal scholar female \n48 None male \n49 German legal historian male \n50 German judge female \n51 German jurist male \n\n familyName givenName dateOfBirth \\\n0 Renner Karl 1870-12-14 00:00:00+00:00 \n1 Sinzheimer Hugo D. 1875-01-01 00:00:00+00:00 \n2 Nussbaum Arthur 1877-01-01 00:00:00+00:00 \n3 Bendix Ludwig 1877-06-28 00:00:00+00:00 \n4 Kelsen Hans 1881-10-11 00:00:00+00:00 \n5 Geiger Theodor 1891-11-09 00:00:00+00:00 \n6 Fraenkel Ernst 1898-12-26 00:00:00+00:00 \n7 Neumann Leopold Franz 1900-05-23 00:00:00+00:00 \n8 Kahn Freund Otto 1900-11-17 00:00:00+00:00 \n9 Hirsch Ernst 1902-01-20 00:00:00+00:00 \n10 Kirchheimer Otto 1905-11-11 00:00:00+00:00 \n11 Helmut 1912-10-14 00:00:00+00:00 \n12 Ryffel Hans 1913-06-27 00:00:00+00:00 \n13 Theo 1918-10-26 00:00:00+00:00 \n14 Wassermann Rudolf 1925-01-05 00:00:00+00:00 \n15 Ramm Thilo 1925-04-04 00:00:00+00:00 \n16 Luhmann Niklas 1927-12-08 00:00:00+00:00 \n17 Rudolf 1929-07-17 00:00:00+00:00 \n18 Dux Günter 1933-06-23 00:00:00+00:00 \n19 Limbach Jutta 1934-03-27 00:00:00+00:00 \n20 Thomas 1935-02-20 00:00:00+00:00 \n21 Manfred 1935-03-22 00:00:00+00:00 \n22 Rüdiger 1935-12-22 00:00:00+00:00 \n23 Wolfgang 1936-01-01 00:00:00+00:00 \n24 Gessner Volkmar 1937-10-09 00:00:00+00:00 \n25 Röhl Klaus 1938-05-22 00:00:00+00:00 \n26 Blankenburg Erhard 1938-10-30 00:00:00+00:00 \n27 Weiss Manfred 1940-06-01 00:00:00+00:00 \n28 Voigt Rüdiger 1941-04-07 00:00:00+00:00 \n29 Girtler Roland 1941-05-31 00:00:00+00:00 \n30 Hubert 1942-07-30 00:00:00+00:00 \n31 1943-01-12 00:00:00+00:00 \n32 Hubert 1944-01-01 00:00:00+00:00 \n33 Ziegert Klaus 1944-01-01 00:00:00+00:00 \n34 Martiny Dieter 1944-03-21 00:00:00+00:00 \n35 Teubner Gunther 1944-04-30 00:00:00+00:00 \n36 1947-01-01 00:00:00+00:00 \n37 Armin 1948-11-04 00:00:00+00:00 \n38 Susanne 1949-01-01 00:00:00+00:00 \n39 Leo 1949-01-08 00:00:00+00:00 \n40 Fritz 1949-08-07 00:00:00+00:00 \n41 Doris 1953-01-01 00:00:00+00:00 \n42 Rogowski Ralf 1953-01-01 00:00:00+00:00 \n43 Wolfgang 1954-01-01 00:00:00+00:00 \n44 Bussmann Kai 1955-01-01 00:00:00+00:00 \n45 Jansen Dorothea 1956-08-21 00:00:00+00:00 \n46 Alfons 1957-05-03 00:00:00+00:00 \n47 Ute 1960-01-01 00:00:00+00:00 \n48 Stefan 1962-01-01 00:00:00+00:00 \n49 Ralf 1962-01-01 00:00:00+00:00 \n50 Baer Susanne 1964-02-16 00:00:00+00:00 \n51 Calliess Gralf-Peter 1967-01-01 00:00:00+00:00 \n\n dateOfDeath wikidata_url \\\n0 1950-12-31 00:00:00+00:00 http://www.wikidata.org/entity/Q11726 \n1 1945-09-16 00:00:00+00:00 http://www.wikidata.org/entity/Q86043 \n2 1964-01-01 00:00:00+00:00 http://www.wikidata.org/entity/Q103088 \n3 1954-01-03 00:00:00+00:00 http://www.wikidata.org/entity/Q15449424 \n4 1973-04-19 00:00:00+00:00 http://www.wikidata.org/entity/Q84165 \n5 1952-06-16 00:00:00+00:00 http://www.wikidata.org/entity/Q96410 \n6 1975-03-28 00:00:00+00:00 http://www.wikidata.org/entity/Q86812 \n7 1954-09-02 00:00:00+00:00 http://www.wikidata.org/entity/Q63195 \n8 1979-06-16 00:00:00+00:00 http://www.wikidata.org/entity/Q121832 \n9 1985-03-29 00:00:00+00:00 http://www.wikidata.org/entity/Q107033 \n10 1965-11-22 00:00:00+00:00 http://www.wikidata.org/entity/Q214397 \n11 1984-02-24 00:00:00+00:00 http://www.wikidata.org/entity/Q104272 \n12 1989-09-30 00:00:00+00:00 http://www.wikidata.org/entity/Q21035905 \n13 2016-01-16 00:00:00+00:00 http://www.wikidata.org/entity/Q1304659 \n14 2008-06-13 00:00:00+00:00 http://www.wikidata.org/entity/Q1551290 \n15 2018-06-17 00:00:00+00:00 http://www.wikidata.org/entity/Q59533838 \n16 1998-11-06 00:00:00+00:00 http://www.wikidata.org/entity/Q57238 \n17 NaT http://www.wikidata.org/entity/Q1512482 \n18 NaT http://www.wikidata.org/entity/Q1560417 \n19 2016-09-10 00:00:00+00:00 http://www.wikidata.org/entity/Q72551 \n20 NaT http://www.wikidata.org/entity/Q27909309 \n21 NaT http://www.wikidata.org/entity/Q1889820 \n22 NaT http://www.wikidata.org/entity/Q91074 \n23 1981-01-01 00:00:00+00:00 http://www.wikidata.org/entity/Q93221485 \n24 2014-11-08 00:00:00+00:00 http://www.wikidata.org/entity/Q15435946 \n25 NaT http://www.wikidata.org/entity/Q27148390 \n26 2018-03-28 00:00:00+00:00 http://www.wikidata.org/entity/Q51595283 \n27 NaT http://www.wikidata.org/entity/Q1588285 \n28 NaT http://www.wikidata.org/entity/Q1682026 \n29 NaT http://www.wikidata.org/entity/Q112873 \n30 NaT http://www.wikidata.org/entity/Q1633462 \n31 NaT http://www.wikidata.org/entity/Q107784 \n32 NaT http://www.wikidata.org/entity/Q55622018 \n33 NaT http://www.wikidata.org/entity/Q112513122 \n34 NaT http://www.wikidata.org/entity/Q1222459 \n35 NaT http://www.wikidata.org/entity/Q98304 \n36 NaT http://www.wikidata.org/entity/Q95192683 \n37 NaT http://www.wikidata.org/entity/Q15435996 \n38 NaT http://www.wikidata.org/entity/Q2369299 \n39 NaT http://www.wikidata.org/entity/Q63203841 \n40 NaT http://www.wikidata.org/entity/Q105946060 \n41 NaT http://www.wikidata.org/entity/Q1245242 \n42 NaT http://www.wikidata.org/entity/Q20128038 \n43 NaT http://www.wikidata.org/entity/Q2590472 \n44 NaT http://www.wikidata.org/entity/Q1552696 \n45 2017-05-12 00:00:00+00:00 http://www.wikidata.org/entity/Q21258453 \n46 NaT http://www.wikidata.org/entity/Q2644328 \n47 NaT http://www.wikidata.org/entity/Q48562036 \n48 NaT http://www.wikidata.org/entity/Q95245830 \n49 NaT http://www.wikidata.org/entity/Q2129347 \n50 NaT http://www.wikidata.org/entity/Q101872 \n51 NaT http://www.wikidata.org/entity/Q1542033 \n\n wikipedia_en \\\n0 https://en.wikipedia.org/wiki/Karl_Renner \n1 https://en.wikipedia.org/wiki/Hugo_Sinzheimer \n2 https://en.wikipedia.org/wiki/Arthur_Nussbaum \n3 None \n4 https://en.wikipedia.org/wiki/Hans_Kelsen \n5 https://en.wikipedia.org/wiki/Theodor_Geiger \n6 https://en.wikipedia.org/wiki/Ernst_Fraenkel_(... \n7 https://en.wikipedia.org/wiki/Franz_Neumann_(p... \n8 https://en.wikipedia.org/wiki/Otto_Kahn-Freund \n9 None \n10 https://en.wikipedia.org/wiki/Otto_Kirchheimer \n11 https://en.wikipedia.org/wiki/Helmut_Schelsky \n12 None \n13 None \n14 None \n15 None \n16 https://en.wikipedia.org/wiki/Niklas_Luhmann \n17 None \n18 None \n19 https://en.wikipedia.org/wiki/Jutta_Limbach \n20 None \n21 None \n22 https://en.wikipedia.org/wiki/R%C3%BCdiger_Lau... \n23 None \n24 https://en.wikipedia.org/wiki/Volkmar_Gessner \n25 None \n26 https://en.wikipedia.org/wiki/Erhard_Blankenburg \n27 None \n28 None \n29 None \n30 None \n31 https://en.wikipedia.org/wiki/Brun-Otto_Bryde \n32 None \n33 None \n34 None \n35 https://en.wikipedia.org/wiki/Gunther_Teubner \n36 None \n37 None \n38 https://en.wikipedia.org/wiki/Susanne_Karstedt \n39 None \n40 None \n41 None \n42 https://en.wikipedia.org/wiki/Ralf_Rogowski \n43 None \n44 None \n45 None \n46 None \n47 None \n48 None \n49 None \n50 https://en.wikipedia.org/wiki/Susanne_Baer \n51 None \n\n wikipedia_de \n0 https://de.wikipedia.org/wiki/Karl_Renner \n1 https://de.wikipedia.org/wiki/Hugo_Sinzheimer \n2 https://de.wikipedia.org/wiki/Arthur_Nussbaum \n3 https://de.wikipedia.org/wiki/Ludwig_Bendix \n4 https://de.wikipedia.org/wiki/Hans_Kelsen \n5 https://de.wikipedia.org/wiki/Theodor_Geiger \n6 https://de.wikipedia.org/wiki/Ernst_Fraenkel_(... \n7 https://de.wikipedia.org/wiki/Franz_Neumann_(P... \n8 https://de.wikipedia.org/wiki/Otto_Kahn-Freund \n9 https://de.wikipedia.org/wiki/Ernst_Eduard_Hirsch \n10 https://de.wikipedia.org/wiki/Otto_Kirchheimer \n11 https://de.wikipedia.org/wiki/Helmut_Schelsky \n12 https://de.wikipedia.org/wiki/Hans_Ryffel_(Rec... \n13 https://de.wikipedia.org/wiki/Theo_Rasehorn \n14 https://de.wikipedia.org/wiki/Rudolf_Wassermann \n15 https://de.wikipedia.org/wiki/Thilo_Ramm \n16 https://de.wikipedia.org/wiki/Niklas_Luhmann \n17 https://de.wikipedia.org/wiki/Rudolf_Wieth%C3%... \n18 https://de.wikipedia.org/wiki/G%C3%BCnter_Dux \n19 https://de.wikipedia.org/wiki/Jutta_Limbach \n20 https://de.wikipedia.org/wiki/Thomas_Raiser \n21 https://de.wikipedia.org/wiki/Manfred_Rehbinder \n22 https://de.wikipedia.org/wiki/R%C3%BCdiger_Lau... \n23 None \n24 https://de.wikipedia.org/wiki/Volkmar_Gessner \n25 https://de.wikipedia.org/wiki/Klaus_F._R%C3%B6hl \n26 https://de.wikipedia.org/wiki/Erhard_Blankenburg \n27 https://de.wikipedia.org/wiki/Manfred_Weiss_(J... \n28 https://de.wikipedia.org/wiki/R%C3%BCdiger_Voigt \n29 https://de.wikipedia.org/wiki/Roland_Girtler \n30 https://de.wikipedia.org/wiki/Hubert_Treiber \n31 https://de.wikipedia.org/wiki/Brun-Otto_Bryde \n32 https://de.wikipedia.org/wiki/Hubert_Rottleuthner \n33 None \n34 https://de.wikipedia.org/wiki/Dieter_Martiny \n35 https://de.wikipedia.org/wiki/Gunther_Teubner \n36 https://de.wikipedia.org/wiki/Konstanze_Plett \n37 https://de.wikipedia.org/wiki/Armin_H%C3%B6land \n38 https://de.wikipedia.org/wiki/Susanne_Karstedt \n39 https://de.wikipedia.org/wiki/Leo_Ki%C3%9Fler \n40 https://de.wikipedia.org/wiki/Fritz_Jost_(Rech... \n41 https://de.wikipedia.org/wiki/Doris_Lucke \n42 None \n43 https://de.wikipedia.org/wiki/Wolfgang_Ludwig-... \n44 https://de.wikipedia.org/wiki/Kai_Bussmann \n45 https://de.wikipedia.org/wiki/Dorothea_Jansen \n46 https://de.wikipedia.org/wiki/Alfons_Bora \n47 https://de.wikipedia.org/wiki/Ute_Sacksofsky \n48 None \n49 https://de.wikipedia.org/wiki/Ralf_Poscher \n50 https://de.wikipedia.org/wiki/Susanne_Baer \n51 https://de.wikipedia.org/wiki/Gralf-Peter_Call... ", + "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>fullName</th>\n <th>qid</th>\n <th>itemdesc</th>\n <th>sexOrGender</th>\n <th>familyName</th>\n <th>givenName</th>\n <th>dateOfBirth</th>\n <th>dateOfDeath</th>\n <th>wikidata_url</th>\n <th>wikipedia_en</th>\n <th>wikipedia_de</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>Karl Renner</td>\n <td>Q11726</td>\n <td>first President of Austria (1870–1950)</td>\n <td>male</td>\n <td>Renner</td>\n <td>Karl</td>\n <td>1870-12-14 00:00:00+00:00</td>\n <td>1950-12-31 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q11726</td>\n <td>https://en.wikipedia.org/wiki/Karl_Renner</td>\n <td>https://de.wikipedia.org/wiki/Karl_Renner</td>\n </tr>\n <tr>\n <th>1</th>\n <td>Hugo Sinzheimer</td>\n <td>Q86043</td>\n <td>German politician (1875-1945)</td>\n <td>male</td>\n <td>Sinzheimer</td>\n <td>Hugo D.</td>\n <td>1875-01-01 00:00:00+00:00</td>\n <td>1945-09-16 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q86043</td>\n <td>https://en.wikipedia.org/wiki/Hugo_Sinzheimer</td>\n <td>https://de.wikipedia.org/wiki/Hugo_Sinzheimer</td>\n </tr>\n <tr>\n <th>2</th>\n <td>Arthur Nussbaum</td>\n <td>Q103088</td>\n <td>German American jurist</td>\n <td>male</td>\n <td>Nussbaum</td>\n <td>Arthur</td>\n <td>1877-01-01 00:00:00+00:00</td>\n <td>1964-01-01 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q103088</td>\n <td>https://en.wikipedia.org/wiki/Arthur_Nussbaum</td>\n <td>https://de.wikipedia.org/wiki/Arthur_Nussbaum</td>\n </tr>\n <tr>\n <th>3</th>\n <td>Ludwig Bendix</td>\n <td>Q15449424</td>\n <td>German economist, civil law notary and lawyer ...</td>\n <td>male</td>\n <td>Bendix</td>\n <td>Ludwig</td>\n <td>1877-06-28 00:00:00+00:00</td>\n <td>1954-01-03 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q15449424</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Ludwig_Bendix</td>\n </tr>\n <tr>\n <th>4</th>\n <td>Hans Kelsen</td>\n <td>Q84165</td>\n <td>Austrian lawyer</td>\n <td>male</td>\n <td>Kelsen</td>\n <td>Hans</td>\n <td>1881-10-11 00:00:00+00:00</td>\n <td>1973-04-19 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q84165</td>\n <td>https://en.wikipedia.org/wiki/Hans_Kelsen</td>\n <td>https://de.wikipedia.org/wiki/Hans_Kelsen</td>\n </tr>\n <tr>\n <th>5</th>\n <td>Theodor Geiger</td>\n <td>Q96410</td>\n <td>German sociologist (1891-1952)</td>\n <td>male</td>\n <td>Geiger</td>\n <td>Theodor</td>\n <td>1891-11-09 00:00:00+00:00</td>\n <td>1952-06-16 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q96410</td>\n <td>https://en.wikipedia.org/wiki/Theodor_Geiger</td>\n <td>https://de.wikipedia.org/wiki/Theodor_Geiger</td>\n </tr>\n <tr>\n <th>6</th>\n <td>Ernst Fraenkel</td>\n <td>Q86812</td>\n <td>political scientist (1898-1975)</td>\n <td>male</td>\n <td>Fraenkel</td>\n <td>Ernst</td>\n <td>1898-12-26 00:00:00+00:00</td>\n <td>1975-03-28 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q86812</td>\n <td>https://en.wikipedia.org/wiki/Ernst_Fraenkel_(...</td>\n <td>https://de.wikipedia.org/wiki/Ernst_Fraenkel_(...</td>\n </tr>\n <tr>\n <th>7</th>\n <td>Franz Leopold Neumann</td>\n <td>Q63195</td>\n <td>German political activist</td>\n <td>male</td>\n <td>Neumann</td>\n <td>Leopold Franz</td>\n <td>1900-05-23 00:00:00+00:00</td>\n <td>1954-09-02 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q63195</td>\n <td>https://en.wikipedia.org/wiki/Franz_Neumann_(p...</td>\n <td>https://de.wikipedia.org/wiki/Franz_Neumann_(P...</td>\n </tr>\n <tr>\n <th>8</th>\n <td>Otto Kahn-Freund</td>\n <td>Q121832</td>\n <td>German-British jurist</td>\n <td>male</td>\n <td>Kahn Freund</td>\n <td>Otto</td>\n <td>1900-11-17 00:00:00+00:00</td>\n <td>1979-06-16 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q121832</td>\n <td>https://en.wikipedia.org/wiki/Otto_Kahn-Freund</td>\n <td>https://de.wikipedia.org/wiki/Otto_Kahn-Freund</td>\n </tr>\n <tr>\n <th>9</th>\n <td>Ernst Eduard Hirsch</td>\n <td>Q107033</td>\n <td>German judge (1902-1985)</td>\n <td>male</td>\n <td>Hirsch</td>\n <td>Ernst</td>\n <td>1902-01-20 00:00:00+00:00</td>\n <td>1985-03-29 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q107033</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Ernst_Eduard_Hirsch</td>\n </tr>\n <tr>\n <th>10</th>\n <td>Otto Kirchheimer</td>\n <td>Q214397</td>\n <td>German-American legal scholar</td>\n <td>male</td>\n <td>Kirchheimer</td>\n <td>Otto</td>\n <td>1905-11-11 00:00:00+00:00</td>\n <td>1965-11-22 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q214397</td>\n <td>https://en.wikipedia.org/wiki/Otto_Kirchheimer</td>\n <td>https://de.wikipedia.org/wiki/Otto_Kirchheimer</td>\n </tr>\n <tr>\n <th>11</th>\n <td>Helmut Schelsky</td>\n <td>Q104272</td>\n <td>German sociologist (1912-1984)</td>\n <td>male</td>\n <td></td>\n <td>Helmut</td>\n <td>1912-10-14 00:00:00+00:00</td>\n <td>1984-02-24 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q104272</td>\n <td>https://en.wikipedia.org/wiki/Helmut_Schelsky</td>\n <td>https://de.wikipedia.org/wiki/Helmut_Schelsky</td>\n </tr>\n <tr>\n <th>12</th>\n <td>Hans Ryffel</td>\n <td>Q21035905</td>\n <td>(1913-1989)</td>\n <td>male</td>\n <td>Ryffel</td>\n <td>Hans</td>\n <td>1913-06-27 00:00:00+00:00</td>\n <td>1989-09-30 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q21035905</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Hans_Ryffel_(Rec...</td>\n </tr>\n <tr>\n <th>13</th>\n <td>Theo Rasehorn</td>\n <td>Q1304659</td>\n <td>German judge and author</td>\n <td>male</td>\n <td></td>\n <td>Theo</td>\n <td>1918-10-26 00:00:00+00:00</td>\n <td>2016-01-16 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q1304659</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Theo_Rasehorn</td>\n </tr>\n <tr>\n <th>14</th>\n <td>Rudolf Wassermann</td>\n <td>Q1551290</td>\n <td>German judge (1925-2008)</td>\n <td>male</td>\n <td>Wassermann</td>\n <td>Rudolf</td>\n <td>1925-01-05 00:00:00+00:00</td>\n <td>2008-06-13 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q1551290</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Rudolf_Wassermann</td>\n </tr>\n <tr>\n <th>15</th>\n <td>Thilo Ramm</td>\n <td>Q59533838</td>\n <td>German legal scholar and author</td>\n <td>male</td>\n <td>Ramm</td>\n <td>Thilo</td>\n <td>1925-04-04 00:00:00+00:00</td>\n <td>2018-06-17 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q59533838</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Thilo_Ramm</td>\n </tr>\n <tr>\n <th>16</th>\n <td>Niklas Luhmann</td>\n <td>Q57238</td>\n <td>German sociologist, administration expert, and...</td>\n <td>male</td>\n <td>Luhmann</td>\n <td>Niklas</td>\n <td>1927-12-08 00:00:00+00:00</td>\n <td>1998-11-06 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q57238</td>\n <td>https://en.wikipedia.org/wiki/Niklas_Luhmann</td>\n <td>https://de.wikipedia.org/wiki/Niklas_Luhmann</td>\n </tr>\n <tr>\n <th>17</th>\n <td>Rudolf Wiethölter</td>\n <td>Q1512482</td>\n <td>German jurist</td>\n <td>male</td>\n <td></td>\n <td>Rudolf</td>\n <td>1929-07-17 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q1512482</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Rudolf_Wieth%C3%...</td>\n </tr>\n <tr>\n <th>18</th>\n <td>Günter Dux</td>\n <td>Q1560417</td>\n <td>German sociologist</td>\n <td>male</td>\n <td>Dux</td>\n <td>Günter</td>\n <td>1933-06-23 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q1560417</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/G%C3%BCnter_Dux</td>\n </tr>\n <tr>\n <th>19</th>\n <td>Jutta Limbach</td>\n <td>Q72551</td>\n <td>German judge and politician (SPD) (1934-2016)</td>\n <td>female</td>\n <td>Limbach</td>\n <td>Jutta</td>\n <td>1934-03-27 00:00:00+00:00</td>\n <td>2016-09-10 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q72551</td>\n <td>https://en.wikipedia.org/wiki/Jutta_Limbach</td>\n <td>https://de.wikipedia.org/wiki/Jutta_Limbach</td>\n </tr>\n <tr>\n <th>20</th>\n <td>Thomas Raiser</td>\n <td>Q27909309</td>\n <td>None</td>\n <td>male</td>\n <td></td>\n <td>Thomas</td>\n <td>1935-02-20 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q27909309</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Thomas_Raiser</td>\n </tr>\n <tr>\n <th>21</th>\n <td>Manfred Rehbinder</td>\n <td>Q1889820</td>\n <td>German jurist</td>\n <td>male</td>\n <td></td>\n <td>Manfred</td>\n <td>1935-03-22 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q1889820</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Manfred_Rehbinder</td>\n </tr>\n <tr>\n <th>22</th>\n <td>Rüdiger Lautmann</td>\n <td>Q91074</td>\n <td>German sociologist and LGBT researcher</td>\n <td>male</td>\n <td></td>\n <td>Rüdiger</td>\n <td>1935-12-22 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q91074</td>\n <td>https://en.wikipedia.org/wiki/R%C3%BCdiger_Lau...</td>\n <td>https://de.wikipedia.org/wiki/R%C3%BCdiger_Lau...</td>\n </tr>\n <tr>\n <th>23</th>\n <td>Wolfgang Kaupen</td>\n <td>Q93221485</td>\n <td>None</td>\n <td>male</td>\n <td></td>\n <td>Wolfgang</td>\n <td>1936-01-01 00:00:00+00:00</td>\n <td>1981-01-01 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q93221485</td>\n <td>None</td>\n <td>None</td>\n </tr>\n <tr>\n <th>24</th>\n <td>Volkmar Gessner</td>\n <td>Q15435946</td>\n <td>University professor</td>\n <td>male</td>\n <td>Gessner</td>\n <td>Volkmar</td>\n <td>1937-10-09 00:00:00+00:00</td>\n <td>2014-11-08 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q15435946</td>\n <td>https://en.wikipedia.org/wiki/Volkmar_Gessner</td>\n <td>https://de.wikipedia.org/wiki/Volkmar_Gessner</td>\n </tr>\n <tr>\n <th>25</th>\n <td>Klaus F. Röhl</td>\n <td>Q27148390</td>\n <td>None</td>\n <td>male</td>\n <td>Röhl</td>\n <td>Klaus</td>\n <td>1938-05-22 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q27148390</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Klaus_F._R%C3%B6hl</td>\n </tr>\n <tr>\n <th>26</th>\n <td>Erhard Blankenburg</td>\n <td>Q51595283</td>\n <td>German sociologist of law (1938-2018)</td>\n <td>male</td>\n <td>Blankenburg</td>\n <td>Erhard</td>\n <td>1938-10-30 00:00:00+00:00</td>\n <td>2018-03-28 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q51595283</td>\n <td>https://en.wikipedia.org/wiki/Erhard_Blankenburg</td>\n <td>https://de.wikipedia.org/wiki/Erhard_Blankenburg</td>\n </tr>\n <tr>\n <th>27</th>\n <td>Manfred Weiss</td>\n <td>Q1588285</td>\n <td>German jurist</td>\n <td>male</td>\n <td>Weiss</td>\n <td>Manfred</td>\n <td>1940-06-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q1588285</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Manfred_Weiss_(J...</td>\n </tr>\n <tr>\n <th>28</th>\n <td>Rüdiger Voigt</td>\n <td>Q1682026</td>\n <td>German author</td>\n <td>male</td>\n <td>Voigt</td>\n <td>Rüdiger</td>\n <td>1941-04-07 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q1682026</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/R%C3%BCdiger_Voigt</td>\n </tr>\n <tr>\n <th>29</th>\n <td>Roland Girtler</td>\n <td>Q112873</td>\n <td>Austrian historian and sociologist</td>\n <td>male</td>\n <td>Girtler</td>\n <td>Roland</td>\n <td>1941-05-31 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q112873</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Roland_Girtler</td>\n </tr>\n <tr>\n <th>30</th>\n <td>Hubert Treiber</td>\n <td>Q1633462</td>\n <td>German university teacher</td>\n <td>male</td>\n <td></td>\n <td>Hubert</td>\n <td>1942-07-30 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q1633462</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Hubert_Treiber</td>\n </tr>\n <tr>\n <th>31</th>\n <td>Brun-Otto Bryde</td>\n <td>Q107784</td>\n <td>German judge</td>\n <td>male</td>\n <td></td>\n <td></td>\n <td>1943-01-12 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q107784</td>\n <td>https://en.wikipedia.org/wiki/Brun-Otto_Bryde</td>\n <td>https://de.wikipedia.org/wiki/Brun-Otto_Bryde</td>\n </tr>\n <tr>\n <th>32</th>\n <td>Hubert Rottleuthner</td>\n <td>Q55622018</td>\n <td>None</td>\n <td>male</td>\n <td></td>\n <td>Hubert</td>\n <td>1944-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q55622018</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Hubert_Rottleuthner</td>\n </tr>\n <tr>\n <th>33</th>\n <td>Klaus A. Ziegert</td>\n <td>Q112513122</td>\n <td>German sociologist of law</td>\n <td>male</td>\n <td>Ziegert</td>\n <td>Klaus</td>\n <td>1944-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q112513122</td>\n <td>None</td>\n <td>None</td>\n </tr>\n <tr>\n <th>34</th>\n <td>Dieter Martiny</td>\n <td>Q1222459</td>\n <td>German jurist</td>\n <td>male</td>\n <td>Martiny</td>\n <td>Dieter</td>\n <td>1944-03-21 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q1222459</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Dieter_Martiny</td>\n </tr>\n <tr>\n <th>35</th>\n <td>Gunther Teubner</td>\n <td>Q98304</td>\n <td>German academic</td>\n <td>male</td>\n <td>Teubner</td>\n <td>Gunther</td>\n <td>1944-04-30 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q98304</td>\n <td>https://en.wikipedia.org/wiki/Gunther_Teubner</td>\n <td>https://de.wikipedia.org/wiki/Gunther_Teubner</td>\n </tr>\n <tr>\n <th>36</th>\n <td>Konstanze Plett</td>\n <td>Q95192683</td>\n <td>None</td>\n <td>female</td>\n <td></td>\n <td></td>\n <td>1947-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q95192683</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Konstanze_Plett</td>\n </tr>\n <tr>\n <th>37</th>\n <td>Armin Höland</td>\n <td>Q15435996</td>\n <td>German university professor</td>\n <td>male</td>\n <td></td>\n <td>Armin</td>\n <td>1948-11-04 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q15435996</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Armin_H%C3%B6land</td>\n </tr>\n <tr>\n <th>38</th>\n <td>Susanne Karstedt</td>\n <td>Q2369299</td>\n <td>criminologist</td>\n <td>female</td>\n <td></td>\n <td>Susanne</td>\n <td>1949-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q2369299</td>\n <td>https://en.wikipedia.org/wiki/Susanne_Karstedt</td>\n <td>https://de.wikipedia.org/wiki/Susanne_Karstedt</td>\n </tr>\n <tr>\n <th>39</th>\n <td>Leo Kißler</td>\n <td>Q63203841</td>\n <td>None</td>\n <td>male</td>\n <td></td>\n <td>Leo</td>\n <td>1949-01-08 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q63203841</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Leo_Ki%C3%9Fler</td>\n </tr>\n <tr>\n <th>40</th>\n <td>Fritz Jost</td>\n <td>Q105946060</td>\n <td>None</td>\n <td>male</td>\n <td></td>\n <td>Fritz</td>\n <td>1949-08-07 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q105946060</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Fritz_Jost_(Rech...</td>\n </tr>\n <tr>\n <th>41</th>\n <td>Doris Lucke</td>\n <td>Q1245242</td>\n <td>German university teacher</td>\n <td>female</td>\n <td></td>\n <td>Doris</td>\n <td>1953-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q1245242</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Doris_Lucke</td>\n </tr>\n <tr>\n <th>42</th>\n <td>Ralf Rogowski</td>\n <td>Q20128038</td>\n <td>Law professor (born 1953)</td>\n <td>male</td>\n <td>Rogowski</td>\n <td>Ralf</td>\n <td>1953-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q20128038</td>\n <td>https://en.wikipedia.org/wiki/Ralf_Rogowski</td>\n <td>None</td>\n </tr>\n <tr>\n <th>43</th>\n <td>Wolfgang Ludwig-Mayerhofer</td>\n <td>Q2590472</td>\n <td>German sociologist</td>\n <td>male</td>\n <td></td>\n <td>Wolfgang</td>\n <td>1954-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q2590472</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Wolfgang_Ludwig-...</td>\n </tr>\n <tr>\n <th>44</th>\n <td>Kai Bussmann</td>\n <td>Q1552696</td>\n <td>German jurist</td>\n <td>male</td>\n <td>Bussmann</td>\n <td>Kai</td>\n <td>1955-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q1552696</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Kai_Bussmann</td>\n </tr>\n <tr>\n <th>45</th>\n <td>Dorothea Jansen</td>\n <td>Q21258453</td>\n <td>None</td>\n <td>female</td>\n <td>Jansen</td>\n <td>Dorothea</td>\n <td>1956-08-21 00:00:00+00:00</td>\n <td>2017-05-12 00:00:00+00:00</td>\n <td>http://www.wikidata.org/entity/Q21258453</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Dorothea_Jansen</td>\n </tr>\n <tr>\n <th>46</th>\n <td>Alfons Bora</td>\n <td>Q2644328</td>\n <td>German sociologist</td>\n <td>male</td>\n <td></td>\n <td>Alfons</td>\n <td>1957-05-03 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q2644328</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Alfons_Bora</td>\n </tr>\n <tr>\n <th>47</th>\n <td>Ute Sacksofsky</td>\n <td>Q48562036</td>\n <td>German legal scholar</td>\n <td>female</td>\n <td></td>\n <td>Ute</td>\n <td>1960-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q48562036</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Ute_Sacksofsky</td>\n </tr>\n <tr>\n <th>48</th>\n <td>Stefan Machura</td>\n <td>Q95245830</td>\n <td>None</td>\n <td>male</td>\n <td></td>\n <td>Stefan</td>\n <td>1962-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q95245830</td>\n <td>None</td>\n <td>None</td>\n </tr>\n <tr>\n <th>49</th>\n <td>Ralf Poscher</td>\n <td>Q2129347</td>\n <td>German legal historian</td>\n <td>male</td>\n <td></td>\n <td>Ralf</td>\n <td>1962-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q2129347</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Ralf_Poscher</td>\n </tr>\n <tr>\n <th>50</th>\n <td>Susanne Baer</td>\n <td>Q101872</td>\n <td>German judge</td>\n <td>female</td>\n <td>Baer</td>\n <td>Susanne</td>\n <td>1964-02-16 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q101872</td>\n <td>https://en.wikipedia.org/wiki/Susanne_Baer</td>\n <td>https://de.wikipedia.org/wiki/Susanne_Baer</td>\n </tr>\n <tr>\n <th>51</th>\n <td>Gralf-Peter Calliess</td>\n <td>Q1542033</td>\n <td>German jurist</td>\n <td>male</td>\n <td>Calliess</td>\n <td>Gralf-Peter</td>\n <td>1967-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q1542033</td>\n <td>None</td>\n <td>https://de.wikipedia.org/wiki/Gralf-Peter_Call...</td>\n </tr>\n </tbody>\n</table>\n</div>" + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Now calling the updated function with the 'language' parameter\n", + "property_labels_to_ids = {\n", + " 'sexOrGender': 'P21',\n", + "# 'image': 'P18',\n", + "# 'countryOfCitizenship': 'P27',\n", + " 'familyName': 'P734',\n", + " 'givenName': 'P735',\n", + " 'dateOfBirth': 'P569',\n", + " 'dateOfDeath': 'P570',\n", + "# 'occupation': 'P106',\n", + "# 'fieldOfWork': 'P101',\n", + "# 'viaf_id': 'P214',\n", + "# 'isni_id': 'P213',\n", + "# 'gnd_id': 'P227'\n", + "}\n", + "\n", + "scholars = \"\"\"\n", + "Karl Renner (Q11726)\n", + "Hugo Sinzheimer (Q86043)\n", + "Arthur Nussbaum (Q103088)\n", + "Ludwig Bendix (Q15449424)\n", + "Hans Kelsen (Q84165)\n", + "Theodor Geiger (Q96410)\n", + "Ernst Fraenkel (Q86812)\n", + "Franz Leopold Neumann (Q63195)\n", + "Otto Kahn-Freund (Q121832)\n", + "Ernst Eduard Hirsch (Q107033)\n", + "Otto Kirchheimer (Q214397)\n", + "Helmut Schelsky (Q104272)\n", + "Hans Ryffel (Q21035905)\n", + "Theo Rasehorn (Q1304659)\n", + "Rudolf Wassermann (Q1551290)\n", + "Thilo Ramm (Q59533838)\n", + "Niklas Luhmann (Q57238)\n", + "Rudolf Wiethölter (Q1512482)\n", + "Günter Dux (Q1560417)\n", + "Jutta Limbach (Q72551)\n", + "Thomas Raiser (Q27909309)\n", + "Manfred Rehbinder (Q1889820)\n", + "Rüdiger Lautmann (Q91074)\n", + "Wolfgang Kaupen (Q93221485)\n", + "Volkmar Gessner (Q15435946)\n", + "Klaus F. Röhl (Q27148390)\n", + "Erhard Blankenburg (Q51595283)\n", + "Manfred Weiss (Q1588285)\n", + "Rüdiger Voigt (Q1682026)\n", + "Roland Girtler (Q112873)\n", + "Hubert Treiber (Q1633462)\n", + "Brun-Otto Bryde (Q107784)\n", + "Hubert Rottleuthner (Q55622018)\n", + "Klaus A. Ziegert (Q112513122)\n", + "Dieter Martiny (Q1222459)\n", + "Gunther Teubner (Q98304)\n", + "Konstanze Plett (Q95192683)\n", + "Armin Höland (Q15435996)\n", + "Susanne Karstedt (Q2369299)\n", + "Leo Kißler (Q63203841)\n", + "Fritz Jost (Q105946060)\n", + "Doris Lucke (Q1245242)\n", + "Ralf Rogowski (Q20128038)\n", + "Wolfgang Ludwig-Mayerhofer (Q2590472)\n", + "Kai Bussmann (Q1552696)\n", + "Dorothea Jansen (Q21258453)\n", + "Alfons Bora (Q2644328)\n", + "Ute Sacksofsky (Q48562036)\n", + "Stefan Machura (Q95245830)\n", + "Ralf Poscher (Q2129347)\n", + "Susanne Baer (Q101872)\n", + "Gralf-Peter Calliess (Q1542033)\n", + "\"\"\".split(\"\\n\")\n", + "\n", + "from lib.wikidata import get_person_info_from_wikidata\n", + "import pandas as pd\n", + "\n", + "df = get_person_info_from_wikidata(scholars, property_labels_to_ids, include_description=True, debug=False)\n", + "df['dateOfBirth'] = pd.to_datetime(df['dateOfBirth'])\n", + "df['dateOfDeath'] = pd.to_datetime(df['dateOfDeath'])\n", + "df.sort_values(by=[\"dateOfBirth\"], inplace=True, ignore_index=True)\n", + "df.to_csv(\"output/scholars-de.csv\", index=False)\n", + "df" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-03-22T13:53:54.151237Z", + "start_time": "2024-03-22T13:53:15.507352Z" + } + }, + "id": "19ddabbda261cc90" + }, + { + "cell_type": "markdown", + "source": [ + "## Create a sorted list that can be fed into the previous cell" + ], + "metadata": { + "collapsed": false + }, + "id": "b81815a61da16209" + }, + { + "cell_type": "code", + "execution_count": 2, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Karl Renner (Q11726)\n", + "Hugo Sinzheimer (Q86043)\n", + "Arthur Nussbaum (Q103088)\n", + "Ludwig Bendix (Q15449424)\n", + "Hans Kelsen (Q84165)\n", + "Theodor Geiger (Q96410)\n", + "Ernst Fraenkel (Q86812)\n", + "Franz Leopold Neumann (Q63195)\n", + "Otto Kahn-Freund (Q121832)\n", + "Ernst Eduard Hirsch (Q107033)\n", + "Otto Kirchheimer (Q214397)\n", + "Helmut Schelsky (Q104272)\n", + "Hans Ryffel (Q21035905)\n", + "Theo Rasehorn (Q1304659)\n", + "Rudolf Wassermann (Q1551290)\n", + "Thilo Ramm (Q59533838)\n", + "Niklas Luhmann (Q57238)\n", + "Rudolf Wiethölter (Q1512482)\n", + "Günter Dux (Q1560417)\n", + "Jutta Limbach (Q72551)\n", + "Thomas Raiser (Q27909309)\n", + "Manfred Rehbinder (Q1889820)\n", + "Rüdiger Lautmann (Q91074)\n", + "Wolfgang Kaupen (Q93221485)\n", + "Volkmar Gessner (Q15435946)\n", + "Klaus F. Röhl (Q27148390)\n", + "Erhard Blankenburg (Q51595283)\n", + "Manfred Weiss (Q1588285)\n", + "Rüdiger Voigt (Q1682026)\n", + "Roland Girtler (Q112873)\n", + "Hubert Treiber (Q1633462)\n", + "Brun-Otto Bryde (Q107784)\n", + "Hubert Rottleuthner (Q55622018)\n", + "Klaus A. Ziegert (Q112513122)\n", + "Dieter Martiny (Q1222459)\n", + "Gunther Teubner (Q98304)\n", + "Konstanze Plett (Q95192683)\n", + "Armin Höland (Q15435996)\n", + "Susanne Karstedt (Q2369299)\n", + "Leo Kißler (Q63203841)\n", + "Fritz Jost (Q105946060)\n", + "Doris Lucke (Q1245242)\n", + "Ralf Rogowski (Q20128038)\n", + "Wolfgang Ludwig-Mayerhofer (Q2590472)\n", + "Kai Bussmann (Q1552696)\n", + "Dorothea Jansen (Q21258453)\n", + "Alfons Bora (Q2644328)\n", + "Ute Sacksofsky (Q48562036)\n", + "Stefan Machura (Q95245830)\n", + "Ralf Poscher (Q2129347)\n", + "Susanne Baer (Q101872)\n", + "Gralf-Peter Calliess (Q1542033)\n" + ] + } + ], + "source": [ + "print(\"\\n\".join(df.apply(lambda r: f\"{r['fullName']} ({r['qid']})\", axis=1).to_list()))\n" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-03-22T13:55:58.537632Z", + "start_time": "2024-03-22T13:55:58.527637Z" + } + }, + "id": "4d6da32e2fbc1740" + }, + { + "cell_type": "markdown", + "source": [ + "## Create a clickable list of Wikidata/Wikipedia URLs" + ], + "metadata": { + "collapsed": false + }, + "id": "d9d0790315730b82" + }, + { + "cell_type": "code", + "execution_count": 3, + "outputs": [ + { + "data": { + "text/plain": "<IPython.core.display.Markdown object>", + "text/markdown": "| fullName | itemdesc | wikidata_url | wikipedia_en | wikipedia_de |\n|:-----------------------------------|:-----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------|\n| Karl Renner (1870-1950) | first President of Austria (1870–1950) | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q11726\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Karl_Renner\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Karl_Renner\">WP (DE)</a> |\n| Hugo Sinzheimer (1875-1945) | German politician (1875-1945) | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q86043\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Hugo_Sinzheimer\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Hugo_Sinzheimer\">WP (DE)</a> |\n| Arthur Nussbaum (1877-1964) | German American jurist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q103088\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Arthur_Nussbaum\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Arthur_Nussbaum\">WP (DE)</a> |\n| Ludwig Bendix (1877-1954) | German economist, civil law notary and lawyer (1877–1954) | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q15449424\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Ludwig_Bendix\">WP (DE)</a> |\n| Hans Kelsen (1881-1973) | Austrian lawyer | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q84165\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Hans_Kelsen\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Hans_Kelsen\">WP (DE)</a> |\n| Theodor Geiger (1891-1952) | German sociologist (1891-1952) | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q96410\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Theodor_Geiger\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Theodor_Geiger\">WP (DE)</a> |\n| Ernst Fraenkel (1898-1975) | political scientist (1898-1975) | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q86812\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Ernst_Fraenkel_(political_scientist)\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Ernst_Fraenkel_(Politikwissenschaftler)\">WP (DE)</a> |\n| Franz Leopold Neumann (1900-1954) | German political activist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q63195\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Franz_Neumann_(political_scientist)\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Franz_Neumann_(Politikwissenschaftler)\">WP (DE)</a> |\n| Otto Kahn-Freund (1900-1979) | German-British jurist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q121832\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Otto_Kahn-Freund\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Otto_Kahn-Freund\">WP (DE)</a> |\n| Ernst Eduard Hirsch (1902-1985) | German judge (1902-1985) | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q107033\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Ernst_Eduard_Hirsch\">WP (DE)</a> |\n| Otto Kirchheimer (1905-1965) | German-American legal scholar | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q214397\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Otto_Kirchheimer\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Otto_Kirchheimer\">WP (DE)</a> |\n| Helmut Schelsky (1912-1984) | German sociologist (1912-1984) | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q104272\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Helmut_Schelsky\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Helmut_Schelsky\">WP (DE)</a> |\n| Hans Ryffel (1913-1989) | (1913-1989) | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q21035905\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Hans_Ryffel_(Rechtsphilosoph)\">WP (DE)</a> |\n| Theo Rasehorn (1918-2016) | German judge and author | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q1304659\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Theo_Rasehorn\">WP (DE)</a> |\n| Rudolf Wassermann (1925-2008) | German judge (1925-2008) | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q1551290\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Rudolf_Wassermann\">WP (DE)</a> |\n| Thilo Ramm (1925-2018) | German legal scholar and author | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q59533838\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Thilo_Ramm\">WP (DE)</a> |\n| Niklas Luhmann (1927-1998) | German sociologist, administration expert, and social systems theorist (1927-1998) | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q57238\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Niklas_Luhmann\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Niklas_Luhmann\">WP (DE)</a> |\n| Rudolf Wiethölter (1929-) | German jurist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q1512482\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Rudolf_Wieth%C3%B6lter\">WP (DE)</a> |\n| Günter Dux (1933-) | German sociologist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q1560417\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/G%C3%BCnter_Dux\">WP (DE)</a> |\n| Jutta Limbach (1934-2016) | German judge and politician (SPD) (1934-2016) | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q72551\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Jutta_Limbach\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Jutta_Limbach\">WP (DE)</a> |\n| Thomas Raiser (1935-) | | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q27909309\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Thomas_Raiser\">WP (DE)</a> |\n| Manfred Rehbinder (1935-) | German jurist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q1889820\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Manfred_Rehbinder\">WP (DE)</a> |\n| Rüdiger Lautmann (1935-) | German sociologist and LGBT researcher | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q91074\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/R%C3%BCdiger_Lautmann\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/R%C3%BCdiger_Lautmann\">WP (DE)</a> |\n| Wolfgang Kaupen (1936-1981) | | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q93221485\">Wikidata</a> | | |\n| Volkmar Gessner (1937-2014) | University professor | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q15435946\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Volkmar_Gessner\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Volkmar_Gessner\">WP (DE)</a> |\n| Klaus F. Röhl (1938-) | | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q27148390\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Klaus_F._R%C3%B6hl\">WP (DE)</a> |\n| Erhard Blankenburg (1938-2018) | German sociologist of law (1938-2018) | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q51595283\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Erhard_Blankenburg\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Erhard_Blankenburg\">WP (DE)</a> |\n| Manfred Weiss (1940-) | German jurist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q1588285\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Manfred_Weiss_(Jurist)\">WP (DE)</a> |\n| Rüdiger Voigt (1941-) | German author | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q1682026\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/R%C3%BCdiger_Voigt\">WP (DE)</a> |\n| Roland Girtler (1941-) | Austrian historian and sociologist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q112873\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Roland_Girtler\">WP (DE)</a> |\n| Hubert Treiber (1942-) | German university teacher | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q1633462\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Hubert_Treiber\">WP (DE)</a> |\n| Brun-Otto Bryde (1943-) | German judge | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q107784\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Brun-Otto_Bryde\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Brun-Otto_Bryde\">WP (DE)</a> |\n| Hubert Rottleuthner (1944-) | | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q55622018\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Hubert_Rottleuthner\">WP (DE)</a> |\n| Klaus A. Ziegert (1944-) | German sociologist of law | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q112513122\">Wikidata</a> | | |\n| Dieter Martiny (1944-) | German jurist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q1222459\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Dieter_Martiny\">WP (DE)</a> |\n| Gunther Teubner (1944-) | German academic | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q98304\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Gunther_Teubner\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Gunther_Teubner\">WP (DE)</a> |\n| Konstanze Plett (1947-) | | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q95192683\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Konstanze_Plett\">WP (DE)</a> |\n| Armin Höland (1948-) | German university professor | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q15435996\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Armin_H%C3%B6land\">WP (DE)</a> |\n| Susanne Karstedt (1949-) | criminologist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q2369299\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Susanne_Karstedt\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Susanne_Karstedt\">WP (DE)</a> |\n| Leo Kißler (1949-) | | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q63203841\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Leo_Ki%C3%9Fler\">WP (DE)</a> |\n| Fritz Jost (1949-) | | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q105946060\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Fritz_Jost_(Rechtswissenschaftler)\">WP (DE)</a> |\n| Doris Lucke (1953-) | German university teacher | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q1245242\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Doris_Lucke\">WP (DE)</a> |\n| Ralf Rogowski (1953-) | Law professor (born 1953) | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q20128038\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Ralf_Rogowski\">WP (EN)</a> | |\n| Wolfgang Ludwig-Mayerhofer (1954-) | German sociologist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q2590472\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Wolfgang_Ludwig-Mayerhofer\">WP (DE)</a> |\n| Kai Bussmann (1955-) | German jurist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q1552696\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Kai_Bussmann\">WP (DE)</a> |\n| Dorothea Jansen (1956-2017) | | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q21258453\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Dorothea_Jansen\">WP (DE)</a> |\n| Alfons Bora (1957-) | German sociologist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q2644328\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Alfons_Bora\">WP (DE)</a> |\n| Ute Sacksofsky (1960-) | German legal scholar | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q48562036\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Ute_Sacksofsky\">WP (DE)</a> |\n| Stefan Machura (1962-) | | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q95245830\">Wikidata</a> | | |\n| Ralf Poscher (1962-) | German legal historian | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q2129347\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Ralf_Poscher\">WP (DE)</a> |\n| Susanne Baer (1964-) | German judge | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q101872\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Susanne_Baer\">WP (EN)</a> | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Susanne_Baer\">WP (DE)</a> |\n| Gralf-Peter Calliess (1967-) | German jurist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q1542033\">Wikidata</a> | | <a target=\"_blank\" href=\"https://de.wikipedia.org/wiki/Gralf-Peter_Calliess\">WP (DE)</a> |" + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from pathlib import Path\n", + "from IPython.display import display, Markdown\n", + "from lib.wikidata import create_styled_table\n", + "include_rows = ['fullName','itemdesc', 'wikidata_url', 'wikipedia_en', 'wikipedia_de']\n", + "md = create_styled_table(df, include_rows).to_markdown(index=False)\n", + "Path('output/scholars-de.md').write_text(md)\n", + "display(Markdown(md))\n" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-03-22T13:56:02.165417Z", + "start_time": "2024-03-22T13:56:02.139160Z" + } + }, + "id": "2d7bdaeed0f38415" + }, + { + "cell_type": "code", + "execution_count": 13, + "outputs": [ + { + "ename": "TypeError", + "evalue": "'>' not supported between instances of 'float' and 'str'", + "output_type": "error", + "traceback": [ + "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m", + "\u001B[1;31mTypeError\u001B[0m Traceback (most recent call last)", + "Cell \u001B[1;32mIn[13], line 20\u001B[0m\n\u001B[0;32m 18\u001B[0m df[\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mrow\u001B[39m\u001B[38;5;124m'\u001B[39m] \u001B[38;5;241m=\u001B[39m \u001B[38;5;241m0\u001B[39m\n\u001B[0;32m 19\u001B[0m \u001B[38;5;28;01mfor\u001B[39;00m index, scholar \u001B[38;5;129;01min\u001B[39;00m df\u001B[38;5;241m.\u001B[39miterrows():\n\u001B[1;32m---> 20\u001B[0m row \u001B[38;5;241m=\u001B[39m \u001B[43mfind_row\u001B[49m\u001B[43m(\u001B[49m\u001B[43mlast_dates\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mscholar\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43mdateOfBirth\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[43m]\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 21\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m row \u001B[38;5;241m<\u001B[39m \u001B[38;5;28mlen\u001B[39m(last_dates):\n\u001B[0;32m 22\u001B[0m last_dates[row] \u001B[38;5;241m=\u001B[39m scholar[\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mdateOfDeath\u001B[39m\u001B[38;5;124m'\u001B[39m]\n", + "Cell \u001B[1;32mIn[13], line 13\u001B[0m, in \u001B[0;36mfind_row\u001B[1;34m(last_dates, start_date)\u001B[0m\n\u001B[0;32m 11\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m \u001B[38;5;21mfind_row\u001B[39m(last_dates, start_date):\n\u001B[0;32m 12\u001B[0m \u001B[38;5;28;01mfor\u001B[39;00m i, last_date \u001B[38;5;129;01min\u001B[39;00m \u001B[38;5;28menumerate\u001B[39m(last_dates):\n\u001B[1;32m---> 13\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[43mstart_date\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m>\u001B[39;49m\u001B[43m \u001B[49m\u001B[43mlast_date\u001B[49m:\n\u001B[0;32m 14\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m i\n\u001B[0;32m 15\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mlen\u001B[39m(last_dates)\n", + "\u001B[1;31mTypeError\u001B[0m: '>' not supported between instances of 'float' and 'str'" + ] + } + ], + "source": [ + "import pandas as pd\n", + "import plotly.express as px\n", + "\n", + "# Load the data\n", + "df = pd.read_csv(\"scholars.csv\", encoding='utf-8')\n", + "\n", + "# Initialize a list to track the last dateOfDeath in each row to manage overlaps\n", + "last_dates = []\n", + "\n", + "# Function to find the appropriate row for each scholar\n", + "def find_row(last_dates, start_date):\n", + " for i, last_date in enumerate(last_dates):\n", + " if start_date > last_date:\n", + " return i\n", + " return len(last_dates)\n", + "\n", + "# Assign rows without overlaps and sort by the earliest dateOfBirth\n", + "df['row'] = 0\n", + "for index, scholar in df.iterrows():\n", + " row = find_row(last_dates, scholar['dateOfBirth'])\n", + " if row < len(last_dates):\n", + " last_dates[row] = scholar['dateOfDeath']\n", + " else:\n", + " last_dates.append(scholar['dateOfDeath'])\n", + " df.at[index, 'row'] = row\n", + "\n", + "# Now plotting without row labels\n", + "fig = px.timeline(df, x_start=\"dateOfBirth\", x_end=\"dateOfDeath\", y=\"row\", text=\"fullName\", title=\"Scholars' Life Spans Timeline\")\n", + "\n", + "# Update layout\n", + "fig.update_layout(yaxis=dict(tickmode='array', tickvals=[], ticktext=[]))\n", + "fig.update_yaxes(autorange=\"reversed\") # This reverses the y-axis to match your requirement\n", + "\n", + "fig.show()\n", + "\n" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-03-11T22:37:55.002823500Z", + "start_time": "2024-03-11T22:37:53.483582400Z" + } + }, + "id": "9bdf188991f29962" + }, + { + "cell_type": "code", + "execution_count": 44, + "outputs": [], + "source": [ + "import pandas as pd\n", + "from datetime import datetime\n", + "\n", + "# Assuming df is your existing DataFrame\n", + "\n", + "# Convert dateOfBirth and dateOfDeath to just the year, handle NaT/NaN appropriately\n", + "df['Year'] = pd.to_datetime(df['dateOfBirth'], errors='coerce').dt.year.astype('Int64')\n", + "df['End Year'] = pd.to_datetime(df['dateOfDeath'], errors='coerce').dt.year.astype('Int64')\n", + "\n", + "# Create 'Display Date' as \"dateOfBirth - dateOfDeath\"\n", + "df['Display Date'] = df['Year'].astype(str).replace('<NA>','') + ' - ' + df['End Year'].astype(str).replace('<NA>','')\n", + "\n", + "# Create 'Headline' as \"fullName (dateOfBirth - dateOfDeath)\"\n", + "df['Headline'] = df['fullName'] + ' (' + df['Display Date'] + ')'\n", + "\n", + "# Create 'Text' column by combining occupation, fieldOfWork, employer\n", + "df['Text'] = df[['occupation', 'fieldOfWork']].apply(lambda x: '<br>'.join(x.dropna()), axis=1)\n", + "\n", + "# Use the image directly; assuming the URLs are already correctly formed in the 'image' column\n", + "df['Media'] = df['image']\n", + "\n", + "# Add a \"Group\" column with the value \"actors\" for all rows\n", + "df['Group'] = 'actors'\n", + "\n", + "# fix date columns\n", + "df['Display Date'] = df['Display Date'].fillna('') # Ensure no NaNs in Display Date\n", + "df['Headline'] = df['Headline'].fillna('') # Ensure no NaNs in Headline\n", + "df['Text'] = df['Text'].fillna('') # Ensure no NaNs in Text\n", + "df['Media'] = df['Media'].fillna('') # Ensure no NaNs in Media\n", + "\n", + "# Now select and order the DataFrame according to the TimelineJS template requirements\n", + "columns = \"Year\tMonth\tDay\tTime\tEnd Year\tEnd Month\tEnd Day\tEnd Time\tDisplay Date\tHeadline\tText\tMedia\tMedia Credit\tMedia Caption\tMedia Thumbnail\tType\tGroup\tBackground\tLink\".split(\"\\t\")\n", + "for col in columns:\n", + " if col not in df:\n", + " df[col] = ''\n", + "timeline_df = df[columns]\n", + "\n", + "timeline_df.to_excel(\"timeline_data.xlsx\", index=False)\n" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-03-06T15:08:24.294712700Z", + "start_time": "2024-03-06T15:08:24.250520100Z" + } + }, + "id": "b8058de7fa9212b" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false + }, + "id": "f4b14ea7d4941e57" + } + ], + "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/scholars-uk.ipynb b/wikidata/scholars-uk.ipynb new file mode 100644 index 0000000..81d8cdd --- /dev/null +++ b/wikidata/scholars-uk.ipynb @@ -0,0 +1,174 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "initial_id", + "metadata": { + "collapsed": true, + "ExecuteTime": { + "end_time": "2024-03-22T13:43:44.974822Z", + "start_time": "2024-03-22T13:43:37.633379Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Retrieving scholar data...\n", + "Retrieving wikipedia URLs...\n" + ] + }, + { + "data": { + "text/plain": " fullName qid \\\n0 William Twining Q16095913 \n1 Philip Aneurin Thomas Q112432625 \n2 David Sugarman Q112366094 \n3 Carol Smart Q5044563 \n4 David Nelken Q5237957 \n5 Rosemary Hunter Q7368381 \n6 Sally Wheeler Q28078278 \n7 Don Harris Q125080407 \n8 Roger Cotterrell Q7358027 \n9 Fiona Cownie Q113809561 \n10 Joanne Conaghan Q108276256 \n\n itemdesc sexOrGender familyName \\\n0 Professor of Jurisprudence male Twining \n1 None male Thomas \n2 None male Sugarman \n3 Feminist sociologist female Smart \n4 British political scientist male \n5 Australian jurist female Hunter \n6 Professor and Head of the School of Law at Que... female Wheeler \n7 British jurist and professor at the university... None \n8 British academic male \n9 None female \n10 British legal scholar female Conaghan \n\n givenName dateOfBirth dateOfDeath \\\n0 Lawrence William 1934-09-22 00:00:00+00:00 NaT \n1 1940-01-01 00:00:00+00:00 NaT \n2 David 1948-01-01 00:00:00+00:00 NaT \n3 Carol 1948-12-20 00:00:00+00:00 NaT \n4 David 1949-01-01 00:00:00+00:00 NaT \n5 Rosemary 1962-01-01 00:00:00+00:00 NaT \n6 Sally 1964-01-01 00:00:00+00:00 NaT \n7 NaT NaT \n8 Roger NaT NaT \n9 NaT NaT \n10 Joanne NaT NaT \n\n wikidata_url \\\n0 http://www.wikidata.org/entity/Q16095913 \n1 http://www.wikidata.org/entity/Q112432625 \n2 http://www.wikidata.org/entity/Q112366094 \n3 http://www.wikidata.org/entity/Q5044563 \n4 http://www.wikidata.org/entity/Q5237957 \n5 http://www.wikidata.org/entity/Q7368381 \n6 http://www.wikidata.org/entity/Q28078278 \n7 http://www.wikidata.org/entity/Q125080407 \n8 http://www.wikidata.org/entity/Q7358027 \n9 http://www.wikidata.org/entity/Q113809561 \n10 http://www.wikidata.org/entity/Q108276256 \n\n wikipedia_en wikipedia_de \n0 https://en.wikipedia.org/wiki/William_Twining None \n1 None None \n2 None None \n3 https://en.wikipedia.org/wiki/Carol_Smart None \n4 https://en.wikipedia.org/wiki/David_Nelken None \n5 https://en.wikipedia.org/wiki/Rosemary_Hunter None \n6 https://en.wikipedia.org/wiki/Sally_Wheeler_(l... None \n7 None None \n8 https://en.wikipedia.org/wiki/Roger_Cotterrell None \n9 None None \n10 https://en.wikipedia.org/wiki/Joanne_Conaghan None ", + "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>fullName</th>\n <th>qid</th>\n <th>itemdesc</th>\n <th>sexOrGender</th>\n <th>familyName</th>\n <th>givenName</th>\n <th>dateOfBirth</th>\n <th>dateOfDeath</th>\n <th>wikidata_url</th>\n <th>wikipedia_en</th>\n <th>wikipedia_de</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>William Twining</td>\n <td>Q16095913</td>\n <td>Professor of Jurisprudence</td>\n <td>male</td>\n <td>Twining</td>\n <td>Lawrence William</td>\n <td>1934-09-22 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q16095913</td>\n <td>https://en.wikipedia.org/wiki/William_Twining</td>\n <td>None</td>\n </tr>\n <tr>\n <th>1</th>\n <td>Philip Aneurin Thomas</td>\n <td>Q112432625</td>\n <td>None</td>\n <td>male</td>\n <td>Thomas</td>\n <td></td>\n <td>1940-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q112432625</td>\n <td>None</td>\n <td>None</td>\n </tr>\n <tr>\n <th>2</th>\n <td>David Sugarman</td>\n <td>Q112366094</td>\n <td>None</td>\n <td>male</td>\n <td>Sugarman</td>\n <td>David</td>\n <td>1948-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q112366094</td>\n <td>None</td>\n <td>None</td>\n </tr>\n <tr>\n <th>3</th>\n <td>Carol Smart</td>\n <td>Q5044563</td>\n <td>Feminist sociologist</td>\n <td>female</td>\n <td>Smart</td>\n <td>Carol</td>\n <td>1948-12-20 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q5044563</td>\n <td>https://en.wikipedia.org/wiki/Carol_Smart</td>\n <td>None</td>\n </tr>\n <tr>\n <th>4</th>\n <td>David Nelken</td>\n <td>Q5237957</td>\n <td>British political scientist</td>\n <td>male</td>\n <td></td>\n <td>David</td>\n <td>1949-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q5237957</td>\n <td>https://en.wikipedia.org/wiki/David_Nelken</td>\n <td>None</td>\n </tr>\n <tr>\n <th>5</th>\n <td>Rosemary Hunter</td>\n <td>Q7368381</td>\n <td>Australian jurist</td>\n <td>female</td>\n <td>Hunter</td>\n <td>Rosemary</td>\n <td>1962-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q7368381</td>\n <td>https://en.wikipedia.org/wiki/Rosemary_Hunter</td>\n <td>None</td>\n </tr>\n <tr>\n <th>6</th>\n <td>Sally Wheeler</td>\n <td>Q28078278</td>\n <td>Professor and Head of the School of Law at Que...</td>\n <td>female</td>\n <td>Wheeler</td>\n <td>Sally</td>\n <td>1964-01-01 00:00:00+00:00</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q28078278</td>\n <td>https://en.wikipedia.org/wiki/Sally_Wheeler_(l...</td>\n <td>None</td>\n </tr>\n <tr>\n <th>7</th>\n <td>Don Harris</td>\n <td>Q125080407</td>\n <td>British jurist and professor at the university...</td>\n <td>None</td>\n <td></td>\n <td></td>\n <td>NaT</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q125080407</td>\n <td>None</td>\n <td>None</td>\n </tr>\n <tr>\n <th>8</th>\n <td>Roger Cotterrell</td>\n <td>Q7358027</td>\n <td>British academic</td>\n <td>male</td>\n <td></td>\n <td>Roger</td>\n <td>NaT</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q7358027</td>\n <td>https://en.wikipedia.org/wiki/Roger_Cotterrell</td>\n <td>None</td>\n </tr>\n <tr>\n <th>9</th>\n <td>Fiona Cownie</td>\n <td>Q113809561</td>\n <td>None</td>\n <td>female</td>\n <td></td>\n <td></td>\n <td>NaT</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q113809561</td>\n <td>None</td>\n <td>None</td>\n </tr>\n <tr>\n <th>10</th>\n <td>Joanne Conaghan</td>\n <td>Q108276256</td>\n <td>British legal scholar</td>\n <td>female</td>\n <td>Conaghan</td>\n <td>Joanne</td>\n <td>NaT</td>\n <td>NaT</td>\n <td>http://www.wikidata.org/entity/Q108276256</td>\n <td>https://en.wikipedia.org/wiki/Joanne_Conaghan</td>\n <td>None</td>\n </tr>\n </tbody>\n</table>\n</div>" + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "property_labels_to_ids = {\n", + " 'sexOrGender': 'P21',\n", + " 'familyName': 'P734',\n", + " 'givenName': 'P735',\n", + " 'dateOfBirth': 'P569',\n", + " 'dateOfDeath': 'P570',\n", + "}\n", + "\n", + "scholars = \"\"\"\n", + "William Twining (Q16095913)\n", + "Philip Aneurin Thomas (Q112432625)\n", + "David Sugarman (Q112366094)\n", + "Carol Smart (Q5044563)\n", + "David Nelken (Q5237957)\n", + "Rosemary Hunter (Q7368381)\n", + "Sally Wheeler (Q28078278)\n", + "Don Harris (Q125080407)\n", + "Roger Cotterrell (Q7358027)\n", + "Fiona Cownie (Q113809561)\n", + "Joanne Conaghan (Q108276256)\n", + "\"\"\".split(\"\\n\")\n", + "\n", + "from lib.wikidata import get_person_info_from_wikidata\n", + "import pandas as pd\n", + "\n", + "df = get_person_info_from_wikidata(scholars, property_labels_to_ids, include_description=True, debug=False)\n", + "df['dateOfBirth'] = pd.to_datetime(df['dateOfBirth'])\n", + "df['dateOfDeath'] = pd.to_datetime(df['dateOfDeath'])\n", + "df.sort_values(by=[\"dateOfBirth\"], inplace=True, ignore_index=True)\n", + "df.to_csv(\"output/scholars-uk.csv\", index=False)\n", + "df" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "William Twining (Q16095913)\n", + "Philip Aneurin Thomas (Q112432625)\n", + "David Sugarman (Q112366094)\n", + "Carol Smart (Q5044563)\n", + "David Nelken (Q5237957)\n", + "Rosemary Hunter (Q7368381)\n", + "Sally Wheeler (Q28078278)\n", + "Don Harris (Q125080407)\n", + "Roger Cotterrell (Q7358027)\n", + "Fiona Cownie (Q113809561)\n", + "Joanne Conaghan (Q108276256)\n" + ] + } + ], + "source": [ + "print(\"\\n\".join(df.apply(lambda r: f\"{r['fullName']} ({r['qid']})\", axis=1).to_list()))" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-03-22T13:43:45.910663Z", + "start_time": "2024-03-22T13:43:45.906339Z" + } + }, + "id": "293eecdcf97d4fd1" + }, + { + "cell_type": "code", + "execution_count": 7, + "outputs": [ + { + "data": { + "text/plain": "<IPython.core.display.Markdown object>", + "text/markdown": "| fullName | itemdesc | wikidata_url | wikipedia_en |\n|:------------------------------|:----------------------------------------------------------------------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------|\n| William Twining (1934-) | Professor of Jurisprudence | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q16095913\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/William_Twining\">WP (EN)</a> |\n| Philip Aneurin Thomas (1940-) | | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q112432625\">Wikidata</a> | |\n| David Sugarman (1948-) | | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q112366094\">Wikidata</a> | |\n| Carol Smart (1948-) | Feminist sociologist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q5044563\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Carol_Smart\">WP (EN)</a> |\n| David Nelken (1949-) | British political scientist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q5237957\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/David_Nelken\">WP (EN)</a> |\n| Rosemary Hunter (1962-) | Australian jurist | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q7368381\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Rosemary_Hunter\">WP (EN)</a> |\n| Sally Wheeler (1964-) | Professor and Head of the School of Law at Queen's University Belfast | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q28078278\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Sally_Wheeler_(legal_scholar)\">WP (EN)</a> |\n| Don Harris (-) | British jurist and professor at the university of Oxford (1928-2020) | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q125080407\">Wikidata</a> | |\n| Roger Cotterrell (-) | British academic | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q7358027\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Roger_Cotterrell\">WP (EN)</a> |\n| Fiona Cownie (-) | | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q113809561\">Wikidata</a> | |\n| Joanne Conaghan (-) | British legal scholar | <a target=\"_blank\" href=\"http://www.wikidata.org/entity/Q108276256\">Wikidata</a> | <a target=\"_blank\" href=\"https://en.wikipedia.org/wiki/Joanne_Conaghan\">WP (EN)</a> |" + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from pathlib import Path\n", + "from IPython.display import display, Markdown\n", + "from lib.wikidata import create_styled_table\n", + "include_rows = ['fullName', 'itemdesc', 'wikidata_url', 'wikipedia_en']\n", + "md = create_styled_table(df, include_rows).to_markdown(index=False)\n", + "Path('output/scholars-uk.md').write_text(md)\n", + "display(Markdown(md))" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-03-22T13:52:18.734028Z", + "start_time": "2024-03-22T13:52:18.726502Z" + } + }, + "id": "e6e8f4591eff1e62" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false + }, + "id": "e49091071f6d1e93" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false + }, + "id": "a84ea8429f57d924" + } + ], + "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 +} -- GitLab