Skip to content
Snippets Groups Projects
Commit c7207861 authored by cboulanger's avatar cboulanger
Browse files

Fix output, add UK scholars

parent d65c3ae2
No related branches found
No related tags found
No related merge requests found
# based on code written by GPT-4 # based on code written by GPT-4
import csv import csv
import os 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 pywikibot import Claim, WbTime, ItemPage, PropertyPage, Site
from datetime import datetime from datetime import datetime
import mwclient
from dotenv import load_dotenv from dotenv import load_dotenv
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): def claim_to_string(claim):
subject_qid = claim.on_item.id subject_qid = claim.on_item.id
predicate_pid = claim.getID() predicate_pid = claim.getID()
...@@ -187,4 +415,34 @@ def get_wikipedia_page_data(pageTitle: str, language="en"): ...@@ -187,4 +415,34 @@ def get_wikipedia_page_data(pageTitle: str, language="en"):
'revision': page.revision, 'revision': page.revision,
'url': f'{site.host}/wiki/{pageTitle.replace(" ", "_")}?oldid={page.revision}', 'url': f'{site.host}/wiki/{pageTitle.replace(" ", "_")}?oldid={page.revision}',
'content': page.text() '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
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
| 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
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,
| 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
%% Cell type:code id:initial_id tags:
``` python
import os.path
import requests
import pandas as pd
import textwrap
def generate_sparql_query(fullName, property_labels_to_ids, language='en', qid=None):
"""
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
"""
if qid:
selectClause = "SELECT DISTINCT ?item"
itemConstraint = f"BIND(wd:{qid} AS ?item)."
groupByClause = "GROUP BY ?item"
else:
selectClause = "SELECT DISTINCT ?item ?itemLabel"
itemConstraint = f'?item wdt:P31 wd:Q5; rdfs:label "{fullName}"@{language} .'
groupByClause = "GROUP BY ?item ?itemLabel"
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):
SPARQL_ENDPOINT = "https://query.wikidata.org/sparql"
query = generate_sparql_query(fullName, property_map, language, qid=qid)
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
}
for label in property_map:
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 get_person_info_from_wikidata(names, property_map, languages=None, debug=False):
if languages is None:
languages = ['en', 'de']
all_data = []
print('Retrieving scholar data...')
for item in names:
if type(item) is tuple:
results = query_wikidata(item[0], property_map, languages[0], qid=item[1], debug=debug)
else:
results = query_wikidata(item, property_map, languages[0], debug=debug)
all_data += results
# Ensure fullName appears first by reordering columns based on property_labels_to_ids keys
columns = ['fullName', 'qid'] + 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
```
%% Cell type:markdown id:397920a95584f406 tags:
## Retrieve Data for a given list of scholars
%% Cell type:code id:19ddabbda261cc90 tags:
``` python
# Now calling the updated function with the 'language' parameter
property_labels_to_ids = {
'sexOrGender': 'P21',
# 'image': 'P18',
# 'countryOfCitizenship': 'P27',
'familyName': 'P734',
'givenName': 'P735',
'dateOfBirth': 'P569',
'dateOfDeath': 'P570',
# 'occupation': 'P106',
# 'fieldOfWork': 'P101',
# 'viaf_id': 'P214',
# 'isni_id': 'P213',
'gnd_id': 'P227'
}
scholars = [
"Hans Kelsen",
"Hugo Sinzheimer",
("Karl Renner","Q11726"),
("Ernst Fraenkel", "Q86812"),
("Franz Leopold Neumann", "Q63195"),
"Otto Kahn-Freund",
"Otto Kirchheimer",
"Herrmann Kantorowicz",
("Ludwig Bendix", "Q15449424"),
("Arthur Nussbaum", "Q103088"),
"Theodor Geiger",
"Erhard Blankenburg",
"Wolfgang Kaupen",
"Rüdiger Lautmann",
"Thilo Ramm",
"Rudolf Wiethölter",
("Niklas Luhmann","Q57238"),
'Hubert Rottleuthner',
'Ralf Rogowski',
"Gunther Teubner",
"Volkmar Gessner",
"Konstanze Plett",
"Ute Sacksofsky",
("Susanne Baer","Q101872")
]
df = get_person_info_from_wikidata(scholars, property_labels_to_ids, debug=False)
# Convert date strings to datetime
df['dateOfBirth'] = pd.to_datetime(df['dateOfBirth'])
df['dateOfDeath'] = pd.to_datetime(df['dateOfDeath'])
df.to_csv("scholars.csv", index=False)
df
```
%% Output
Retrieving scholar data...
Retrieving wikipedia URLs...
fullName qid sexOrGender familyName givenName \
0 Hans Kelsen Q84165 male Kelsen Hans
1 Hugo Sinzheimer Q86043 male Sinzheimer Hugo D.
2 Karl Renner Q11726 male Renner Karl
3 Ernst Fraenkel Q86812 male Fraenkel Ernst
4 Franz Leopold Neumann Q63195 male Neumann Leopold Franz
5 Otto Kahn-Freund Q121832 male Kahn Freund Otto
6 Otto Kirchheimer Q214397 male Kirchheimer Otto
7 Ludwig Bendix Q15449424 male Bendix Ludwig
8 Arthur Nussbaum Q103088 male Nussbaum Arthur
9 Theodor Geiger Q96410 male Geiger Theodor
10 Erhard Blankenburg Q51595283 male Blankenburg Erhard
11 Wolfgang Kaupen Q93221485 male Wolfgang
12 Rüdiger Lautmann Q91074 male Rüdiger
13 Thilo Ramm Q59533838 male Ramm Thilo
14 Rudolf Wiethölter Q1512482 male Rudolf
15 Niklas Luhmann Q57238 male Luhmann Niklas
16 Hubert Rottleuthner Q55622018 male Hubert
17 Ralf Rogowski Q112499743 male Rogowski Ralf
18 Ralf Rogowski Q20128038 male Rogowski Ralf
19 Gunther Teubner Q98304 male Teubner Gunther
20 Volkmar Gessner Q15435946 male Gessner Volkmar
21 Konstanze Plett Q95192683 female
22 Ute Sacksofsky Q48562036 female Ute
23 Susanne Baer Q101872 female Baer Susanne
dateOfBirth dateOfDeath gnd_id \
0 1881-10-11 00:00:00+00:00 1973-04-19 00:00:00+00:00 118561219
1 1875-01-01 00:00:00+00:00 1945-09-16 00:00:00+00:00 118614711
2 1870-12-14 00:00:00+00:00 1950-12-31 00:00:00+00:00 118599739
3 1898-12-26 00:00:00+00:00 1975-03-28 00:00:00+00:00 118534602
4 1900-05-23 00:00:00+00:00 1954-09-02 00:00:00+00:00 118587293
5 1900-11-17 00:00:00+00:00 1979-06-16 00:00:00+00:00 118559362
6 1905-11-11 00:00:00+00:00 1965-11-22 00:00:00+00:00 118562371
7 1877-06-28 00:00:00+00:00 1954-01-03 00:00:00+00:00 118702033
8 1877-01-01 00:00:00+00:00 1964-01-01 00:00:00+00:00 117071676
9 1891-11-09 00:00:00+00:00 1952-06-16 00:00:00+00:00 118538187
10 1938-10-30 00:00:00+00:00 2018-03-28 00:00:00+00:00 115459235
11 1936-01-01 00:00:00+00:00 1981-01-01 00:00:00+00:00 124045405
12 1935-12-22 00:00:00+00:00 NaT 120502208
13 1925-04-04 00:00:00+00:00 2018-06-17 00:00:00+00:00 116327391
14 1929-07-17 00:00:00+00:00 NaT 1034437860
15 1927-12-08 00:00:00+00:00 1998-11-06 00:00:00+00:00 118575147
16 1944-01-01 00:00:00+00:00 NaT 135622751
17 1953-01-01 00:00:00+00:00 NaT 17150982X
18 NaT NaT None
19 1944-04-30 00:00:00+00:00 NaT 119443562
20 1937-10-09 00:00:00+00:00 2014-11-08 00:00:00+00:00 170469328
21 1947-01-01 00:00:00+00:00 NaT 124957048
22 1960-01-01 00:00:00+00:00 NaT 132505746
23 1964-02-16 00:00:00+00:00 NaT 113854161
wikidata_url \
0 http://www.wikidata.org/entity/Q84165
1 http://www.wikidata.org/entity/Q86043
2 http://www.wikidata.org/entity/Q11726
3 http://www.wikidata.org/entity/Q86812
4 http://www.wikidata.org/entity/Q63195
5 http://www.wikidata.org/entity/Q121832
6 http://www.wikidata.org/entity/Q214397
7 http://www.wikidata.org/entity/Q15449424
8 http://www.wikidata.org/entity/Q103088
9 http://www.wikidata.org/entity/Q96410
10 http://www.wikidata.org/entity/Q51595283
11 http://www.wikidata.org/entity/Q93221485
12 http://www.wikidata.org/entity/Q91074
13 http://www.wikidata.org/entity/Q59533838
14 http://www.wikidata.org/entity/Q1512482
15 http://www.wikidata.org/entity/Q57238
16 http://www.wikidata.org/entity/Q55622018
17 http://www.wikidata.org/entity/Q112499743
18 http://www.wikidata.org/entity/Q20128038
19 http://www.wikidata.org/entity/Q98304
20 http://www.wikidata.org/entity/Q15435946
21 http://www.wikidata.org/entity/Q95192683
22 http://www.wikidata.org/entity/Q48562036
23 http://www.wikidata.org/entity/Q101872
wikipedia_en \
0 https://en.wikipedia.org/wiki/Hans_Kelsen
1 https://en.wikipedia.org/wiki/Hugo_Sinzheimer
2 https://en.wikipedia.org/wiki/Karl_Renner
3 https://en.wikipedia.org/wiki/Ernst_Fraenkel_(...
4 https://en.wikipedia.org/wiki/Franz_Neumann_(p...
5 https://en.wikipedia.org/wiki/Otto_Kahn-Freund
6 https://en.wikipedia.org/wiki/Otto_Kirchheimer
7 None
8 https://en.wikipedia.org/wiki/Arthur_Nussbaum
9 https://en.wikipedia.org/wiki/Theodor_Geiger
10 https://en.wikipedia.org/wiki/Erhard_Blankenburg
11 None
12 https://en.wikipedia.org/wiki/R%C3%BCdiger_Lau...
13 None
14 None
15 https://en.wikipedia.org/wiki/Niklas_Luhmann
16 None
17 None
18 https://en.wikipedia.org/wiki/Ralf_Rogowski
19 https://en.wikipedia.org/wiki/Gunther_Teubner
20 https://en.wikipedia.org/wiki/Volkmar_Gessner
21 None
22 None
23 https://en.wikipedia.org/wiki/Susanne_Baer
wikipedia_de
0 https://de.wikipedia.org/wiki/Hans_Kelsen
1 https://de.wikipedia.org/wiki/Hugo_Sinzheimer
2 https://de.wikipedia.org/wiki/Karl_Renner
3 https://de.wikipedia.org/wiki/Ernst_Fraenkel_(...
4 https://de.wikipedia.org/wiki/Franz_Neumann_(P...
5 https://de.wikipedia.org/wiki/Otto_Kahn-Freund
6 https://de.wikipedia.org/wiki/Otto_Kirchheimer
7 https://de.wikipedia.org/wiki/Ludwig_Bendix
8 https://de.wikipedia.org/wiki/Arthur_Nussbaum
9 https://de.wikipedia.org/wiki/Theodor_Geiger
10 https://de.wikipedia.org/wiki/Erhard_Blankenburg
11 None
12 https://de.wikipedia.org/wiki/R%C3%BCdiger_Lau...
13 https://de.wikipedia.org/wiki/Thilo_Ramm
14 https://de.wikipedia.org/wiki/Rudolf_Wieth%C3%...
15 https://de.wikipedia.org/wiki/Niklas_Luhmann
16 https://de.wikipedia.org/wiki/Hubert_Rottleuthner
17 None
18 None
19 https://de.wikipedia.org/wiki/Gunther_Teubner
20 https://de.wikipedia.org/wiki/Volkmar_Gessner
21 https://de.wikipedia.org/wiki/Konstanze_Plett
22 https://de.wikipedia.org/wiki/Ute_Sacksofsky
23 https://de.wikipedia.org/wiki/Susanne_Baer
%% Cell type:markdown id:b81815a61da16209 tags:
## Create a list of scholar's QIDs only
%% Cell type:code id:4d6da32e2fbc1740 tags:
``` python
df.copy()[['fullName', 'qid']].to_csv("scholars-qid.csv", index=False)
```
%% Cell type:markdown id:d9d0790315730b82 tags:
## Create a clickable list of Wikidata/Wikipedia URLs
%% Cell type:code id:2d7bdaeed0f38415 tags:
``` python
import pandas as pd
from IPython.display import display, Markdown
# Function to convert URLs to HTML links
def make_clickable(val, name):
return f'<a target="_blank" href="{val}">{name}</a>'
# Apply the function to each URL column
df_styled = df.copy()[['fullName', 'qid', 'familyName', 'givenName', 'wikidata_url', 'wikipedia_en', 'wikipedia_de' ]]
df_styled['wikidata_url'] = df['wikidata_url'].apply(make_clickable, name='Wikidata')
df_styled['wikipedia_en'] = df['wikipedia_en'].apply(make_clickable, name='Wikipedia (EN)')
df_styled['wikipedia_de'] = df['wikipedia_de'].apply(make_clickable, name='Wikipedia (DE)')
# Display the DataFrame as HTML
display(Markdown(df_styled.to_markdown()))
```
%% Output
| | fullName | qid | familyName | givenName | wikidata_url | wikipedia_en | wikipedia_de |
|---:|:----------------------|:----------|:-------------|:--------------|:--------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------|
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
%% Cell type:code id:9bdf188991f29962 tags:
``` python
import pandas as pd
import plotly.express as px
# Load the data
df = pd.read_csv("scholars.csv", encoding='utf-8')
# Initialize a list to track the last dateOfDeath in each row to manage overlaps
last_dates = []
# Function to find the appropriate row for each scholar
def find_row(last_dates, start_date):
for i, last_date in enumerate(last_dates):
if start_date > last_date:
return i
return len(last_dates)
# Assign rows without overlaps and sort by the earliest dateOfBirth
df['row'] = 0
for index, scholar in df.iterrows():
row = find_row(last_dates, scholar['dateOfBirth'])
if row < len(last_dates):
last_dates[row] = scholar['dateOfDeath']
else:
last_dates.append(scholar['dateOfDeath'])
df.at[index, 'row'] = row
# Now plotting without row labels
fig = px.timeline(df, x_start="dateOfBirth", x_end="dateOfDeath", y="row", text="fullName", title="Scholars' Life Spans Timeline")
# Update layout
fig.update_layout(yaxis=dict(tickmode='array', tickvals=[], ticktext=[]))
fig.update_yaxes(autorange="reversed") # This reverses the y-axis to match your requirement
fig.show()
```
%% Output
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[13], line 20
18 df['row'] = 0
19 for index, scholar in df.iterrows():
---> 20 row = find_row(last_dates, scholar['dateOfBirth'])
21 if row < len(last_dates):
22 last_dates[row] = scholar['dateOfDeath']
Cell In[13], line 13, in find_row(last_dates, start_date)
11 def find_row(last_dates, start_date):
12 for i, last_date in enumerate(last_dates):
---> 13 if start_date > last_date:
14 return i
15 return len(last_dates)
TypeError: '>' not supported between instances of 'float' and 'str'
%% Cell type:code id:b8058de7fa9212b tags:
``` python
import pandas as pd
from datetime import datetime
# Assuming df is your existing DataFrame
# Convert dateOfBirth and dateOfDeath to just the year, handle NaT/NaN appropriately
df['Year'] = pd.to_datetime(df['dateOfBirth'], errors='coerce').dt.year.astype('Int64')
df['End Year'] = pd.to_datetime(df['dateOfDeath'], errors='coerce').dt.year.astype('Int64')
# Create 'Display Date' as "dateOfBirth - dateOfDeath"
df['Display Date'] = df['Year'].astype(str).replace('<NA>','') + ' - ' + df['End Year'].astype(str).replace('<NA>','')
# Create 'Headline' as "fullName (dateOfBirth - dateOfDeath)"
df['Headline'] = df['fullName'] + ' (' + df['Display Date'] + ')'
# Create 'Text' column by combining occupation, fieldOfWork, employer
df['Text'] = df[['occupation', 'fieldOfWork']].apply(lambda x: '<br>'.join(x.dropna()), axis=1)
# Use the image directly; assuming the URLs are already correctly formed in the 'image' column
df['Media'] = df['image']
# Add a "Group" column with the value "actors" for all rows
df['Group'] = 'actors'
# fix date columns
df['Display Date'] = df['Display Date'].fillna('') # Ensure no NaNs in Display Date
df['Headline'] = df['Headline'].fillna('') # Ensure no NaNs in Headline
df['Text'] = df['Text'].fillna('') # Ensure no NaNs in Text
df['Media'] = df['Media'].fillna('') # Ensure no NaNs in Media
# Now select and order the DataFrame according to the TimelineJS template requirements
columns = "Year Month Day Time End Year End Month End Day End Time Display Date Headline Text Media Media Credit Media Caption Media Thumbnail Type Group Background Link".split("\t")
for col in columns:
if col not in df:
df[col] = ''
timeline_df = df[columns]
timeline_df.to_excel("timeline_data.xlsx", index=False)
```
%% Cell type:code id:f4b14ea7d4941e57 tags:
``` python
```
%% Cell type:markdown id:397920a95584f406 tags:
## Retrieve Data for a given list of scholars
%% Cell type:code id:19ddabbda261cc90 tags:
``` python
# Now calling the updated function with the 'language' parameter
property_labels_to_ids = {
'sexOrGender': 'P21',
# 'image': 'P18',
# 'countryOfCitizenship': 'P27',
'familyName': 'P734',
'givenName': 'P735',
'dateOfBirth': 'P569',
'dateOfDeath': 'P570',
# 'occupation': 'P106',
# 'fieldOfWork': 'P101',
# 'viaf_id': 'P214',
# 'isni_id': 'P213',
# 'gnd_id': 'P227'
}
scholars = """
Karl Renner (Q11726)
Hugo Sinzheimer (Q86043)
Arthur Nussbaum (Q103088)
Ludwig Bendix (Q15449424)
Hans Kelsen (Q84165)
Theodor Geiger (Q96410)
Ernst Fraenkel (Q86812)
Franz Leopold Neumann (Q63195)
Otto Kahn-Freund (Q121832)
Ernst Eduard Hirsch (Q107033)
Otto Kirchheimer (Q214397)
Helmut Schelsky (Q104272)
Hans Ryffel (Q21035905)
Theo Rasehorn (Q1304659)
Rudolf Wassermann (Q1551290)
Thilo Ramm (Q59533838)
Niklas Luhmann (Q57238)
Rudolf Wiethölter (Q1512482)
Günter Dux (Q1560417)
Jutta Limbach (Q72551)
Thomas Raiser (Q27909309)
Manfred Rehbinder (Q1889820)
Rüdiger Lautmann (Q91074)
Wolfgang Kaupen (Q93221485)
Volkmar Gessner (Q15435946)
Klaus F. Röhl (Q27148390)
Erhard Blankenburg (Q51595283)
Manfred Weiss (Q1588285)
Rüdiger Voigt (Q1682026)
Roland Girtler (Q112873)
Hubert Treiber (Q1633462)
Brun-Otto Bryde (Q107784)
Hubert Rottleuthner (Q55622018)
Klaus A. Ziegert (Q112513122)
Dieter Martiny (Q1222459)
Gunther Teubner (Q98304)
Konstanze Plett (Q95192683)
Armin Höland (Q15435996)
Susanne Karstedt (Q2369299)
Leo Kißler (Q63203841)
Fritz Jost (Q105946060)
Doris Lucke (Q1245242)
Ralf Rogowski (Q20128038)
Wolfgang Ludwig-Mayerhofer (Q2590472)
Kai Bussmann (Q1552696)
Dorothea Jansen (Q21258453)
Alfons Bora (Q2644328)
Ute Sacksofsky (Q48562036)
Stefan Machura (Q95245830)
Ralf Poscher (Q2129347)
Susanne Baer (Q101872)
Gralf-Peter Calliess (Q1542033)
""".split("\n")
from lib.wikidata import get_person_info_from_wikidata
import pandas as pd
df = get_person_info_from_wikidata(scholars, property_labels_to_ids, include_description=True, debug=False)
df['dateOfBirth'] = pd.to_datetime(df['dateOfBirth'])
df['dateOfDeath'] = pd.to_datetime(df['dateOfDeath'])
df.sort_values(by=["dateOfBirth"], inplace=True, ignore_index=True)
df.to_csv("output/scholars-de.csv", index=False)
df
```
%% Output
Retrieving scholar data...
Retrieving wikipedia URLs...
fullName qid \
0 Karl Renner Q11726
1 Hugo Sinzheimer Q86043
2 Arthur Nussbaum Q103088
3 Ludwig Bendix Q15449424
4 Hans Kelsen Q84165
5 Theodor Geiger Q96410
6 Ernst Fraenkel Q86812
7 Franz Leopold Neumann Q63195
8 Otto Kahn-Freund Q121832
9 Ernst Eduard Hirsch Q107033
10 Otto Kirchheimer Q214397
11 Helmut Schelsky Q104272
12 Hans Ryffel Q21035905
13 Theo Rasehorn Q1304659
14 Rudolf Wassermann Q1551290
15 Thilo Ramm Q59533838
16 Niklas Luhmann Q57238
17 Rudolf Wiethölter Q1512482
18 Günter Dux Q1560417
19 Jutta Limbach Q72551
20 Thomas Raiser Q27909309
21 Manfred Rehbinder Q1889820
22 Rüdiger Lautmann Q91074
23 Wolfgang Kaupen Q93221485
24 Volkmar Gessner Q15435946
25 Klaus F. Röhl Q27148390
26 Erhard Blankenburg Q51595283
27 Manfred Weiss Q1588285
28 Rüdiger Voigt Q1682026
29 Roland Girtler Q112873
30 Hubert Treiber Q1633462
31 Brun-Otto Bryde Q107784
32 Hubert Rottleuthner Q55622018
33 Klaus A. Ziegert Q112513122
34 Dieter Martiny Q1222459
35 Gunther Teubner Q98304
36 Konstanze Plett Q95192683
37 Armin Höland Q15435996
38 Susanne Karstedt Q2369299
39 Leo Kißler Q63203841
40 Fritz Jost Q105946060
41 Doris Lucke Q1245242
42 Ralf Rogowski Q20128038
43 Wolfgang Ludwig-Mayerhofer Q2590472
44 Kai Bussmann Q1552696
45 Dorothea Jansen Q21258453
46 Alfons Bora Q2644328
47 Ute Sacksofsky Q48562036
48 Stefan Machura Q95245830
49 Ralf Poscher Q2129347
50 Susanne Baer Q101872
51 Gralf-Peter Calliess Q1542033
itemdesc sexOrGender \
0 first President of Austria (1870–1950) male
1 German politician (1875-1945) male
2 German American jurist male
3 German economist, civil law notary and lawyer ... male
4 Austrian lawyer male
5 German sociologist (1891-1952) male
6 political scientist (1898-1975) male
7 German political activist male
8 German-British jurist male
9 German judge (1902-1985) male
10 German-American legal scholar male
11 German sociologist (1912-1984) male
12 (1913-1989) male
13 German judge and author male
14 German judge (1925-2008) male
15 German legal scholar and author male
16 German sociologist, administration expert, and... male
17 German jurist male
18 German sociologist male
19 German judge and politician (SPD) (1934-2016) female
20 None male
21 German jurist male
22 German sociologist and LGBT researcher male
23 None male
24 University professor male
25 None male
26 German sociologist of law (1938-2018) male
27 German jurist male
28 German author male
29 Austrian historian and sociologist male
30 German university teacher male
31 German judge male
32 None male
33 German sociologist of law male
34 German jurist male
35 German academic male
36 None female
37 German university professor male
38 criminologist female
39 None male
40 None male
41 German university teacher female
42 Law professor (born 1953) male
43 German sociologist male
44 German jurist male
45 None female
46 German sociologist male
47 German legal scholar female
48 None male
49 German legal historian male
50 German judge female
51 German jurist male
familyName givenName dateOfBirth \
0 Renner Karl 1870-12-14 00:00:00+00:00
1 Sinzheimer Hugo D. 1875-01-01 00:00:00+00:00
2 Nussbaum Arthur 1877-01-01 00:00:00+00:00
3 Bendix Ludwig 1877-06-28 00:00:00+00:00
4 Kelsen Hans 1881-10-11 00:00:00+00:00
5 Geiger Theodor 1891-11-09 00:00:00+00:00
6 Fraenkel Ernst 1898-12-26 00:00:00+00:00
7 Neumann Leopold Franz 1900-05-23 00:00:00+00:00
8 Kahn Freund Otto 1900-11-17 00:00:00+00:00
9 Hirsch Ernst 1902-01-20 00:00:00+00:00
10 Kirchheimer Otto 1905-11-11 00:00:00+00:00
11 Helmut 1912-10-14 00:00:00+00:00
12 Ryffel Hans 1913-06-27 00:00:00+00:00
13 Theo 1918-10-26 00:00:00+00:00
14 Wassermann Rudolf 1925-01-05 00:00:00+00:00
15 Ramm Thilo 1925-04-04 00:00:00+00:00
16 Luhmann Niklas 1927-12-08 00:00:00+00:00
17 Rudolf 1929-07-17 00:00:00+00:00
18 Dux Günter 1933-06-23 00:00:00+00:00
19 Limbach Jutta 1934-03-27 00:00:00+00:00
20 Thomas 1935-02-20 00:00:00+00:00
21 Manfred 1935-03-22 00:00:00+00:00
22 Rüdiger 1935-12-22 00:00:00+00:00
23 Wolfgang 1936-01-01 00:00:00+00:00
24 Gessner Volkmar 1937-10-09 00:00:00+00:00
25 Röhl Klaus 1938-05-22 00:00:00+00:00
26 Blankenburg Erhard 1938-10-30 00:00:00+00:00
27 Weiss Manfred 1940-06-01 00:00:00+00:00
28 Voigt Rüdiger 1941-04-07 00:00:00+00:00
29 Girtler Roland 1941-05-31 00:00:00+00:00
30 Hubert 1942-07-30 00:00:00+00:00
31 1943-01-12 00:00:00+00:00
32 Hubert 1944-01-01 00:00:00+00:00
33 Ziegert Klaus 1944-01-01 00:00:00+00:00
34 Martiny Dieter 1944-03-21 00:00:00+00:00
35 Teubner Gunther 1944-04-30 00:00:00+00:00
36 1947-01-01 00:00:00+00:00
37 Armin 1948-11-04 00:00:00+00:00
38 Susanne 1949-01-01 00:00:00+00:00
39 Leo 1949-01-08 00:00:00+00:00
40 Fritz 1949-08-07 00:00:00+00:00
41 Doris 1953-01-01 00:00:00+00:00
42 Rogowski Ralf 1953-01-01 00:00:00+00:00
43 Wolfgang 1954-01-01 00:00:00+00:00
44 Bussmann Kai 1955-01-01 00:00:00+00:00
45 Jansen Dorothea 1956-08-21 00:00:00+00:00
46 Alfons 1957-05-03 00:00:00+00:00
47 Ute 1960-01-01 00:00:00+00:00
48 Stefan 1962-01-01 00:00:00+00:00
49 Ralf 1962-01-01 00:00:00+00:00
50 Baer Susanne 1964-02-16 00:00:00+00:00
51 Calliess Gralf-Peter 1967-01-01 00:00:00+00:00
dateOfDeath wikidata_url \
0 1950-12-31 00:00:00+00:00 http://www.wikidata.org/entity/Q11726
1 1945-09-16 00:00:00+00:00 http://www.wikidata.org/entity/Q86043
2 1964-01-01 00:00:00+00:00 http://www.wikidata.org/entity/Q103088
3 1954-01-03 00:00:00+00:00 http://www.wikidata.org/entity/Q15449424
4 1973-04-19 00:00:00+00:00 http://www.wikidata.org/entity/Q84165
5 1952-06-16 00:00:00+00:00 http://www.wikidata.org/entity/Q96410
6 1975-03-28 00:00:00+00:00 http://www.wikidata.org/entity/Q86812
7 1954-09-02 00:00:00+00:00 http://www.wikidata.org/entity/Q63195
8 1979-06-16 00:00:00+00:00 http://www.wikidata.org/entity/Q121832
9 1985-03-29 00:00:00+00:00 http://www.wikidata.org/entity/Q107033
10 1965-11-22 00:00:00+00:00 http://www.wikidata.org/entity/Q214397
11 1984-02-24 00:00:00+00:00 http://www.wikidata.org/entity/Q104272
12 1989-09-30 00:00:00+00:00 http://www.wikidata.org/entity/Q21035905
13 2016-01-16 00:00:00+00:00 http://www.wikidata.org/entity/Q1304659
14 2008-06-13 00:00:00+00:00 http://www.wikidata.org/entity/Q1551290
15 2018-06-17 00:00:00+00:00 http://www.wikidata.org/entity/Q59533838
16 1998-11-06 00:00:00+00:00 http://www.wikidata.org/entity/Q57238
17 NaT http://www.wikidata.org/entity/Q1512482
18 NaT http://www.wikidata.org/entity/Q1560417
19 2016-09-10 00:00:00+00:00 http://www.wikidata.org/entity/Q72551
20 NaT http://www.wikidata.org/entity/Q27909309
21 NaT http://www.wikidata.org/entity/Q1889820
22 NaT http://www.wikidata.org/entity/Q91074
23 1981-01-01 00:00:00+00:00 http://www.wikidata.org/entity/Q93221485
24 2014-11-08 00:00:00+00:00 http://www.wikidata.org/entity/Q15435946
25 NaT http://www.wikidata.org/entity/Q27148390
26 2018-03-28 00:00:00+00:00 http://www.wikidata.org/entity/Q51595283
27 NaT http://www.wikidata.org/entity/Q1588285
28 NaT http://www.wikidata.org/entity/Q1682026
29 NaT http://www.wikidata.org/entity/Q112873
30 NaT http://www.wikidata.org/entity/Q1633462
31 NaT http://www.wikidata.org/entity/Q107784
32 NaT http://www.wikidata.org/entity/Q55622018
33 NaT http://www.wikidata.org/entity/Q112513122
34 NaT http://www.wikidata.org/entity/Q1222459
35 NaT http://www.wikidata.org/entity/Q98304
36 NaT http://www.wikidata.org/entity/Q95192683
37 NaT http://www.wikidata.org/entity/Q15435996
38 NaT http://www.wikidata.org/entity/Q2369299
39 NaT http://www.wikidata.org/entity/Q63203841
40 NaT http://www.wikidata.org/entity/Q105946060
41 NaT http://www.wikidata.org/entity/Q1245242
42 NaT http://www.wikidata.org/entity/Q20128038
43 NaT http://www.wikidata.org/entity/Q2590472
44 NaT http://www.wikidata.org/entity/Q1552696
45 2017-05-12 00:00:00+00:00 http://www.wikidata.org/entity/Q21258453
46 NaT http://www.wikidata.org/entity/Q2644328
47 NaT http://www.wikidata.org/entity/Q48562036
48 NaT http://www.wikidata.org/entity/Q95245830
49 NaT http://www.wikidata.org/entity/Q2129347
50 NaT http://www.wikidata.org/entity/Q101872
51 NaT http://www.wikidata.org/entity/Q1542033
wikipedia_en \
0 https://en.wikipedia.org/wiki/Karl_Renner
1 https://en.wikipedia.org/wiki/Hugo_Sinzheimer
2 https://en.wikipedia.org/wiki/Arthur_Nussbaum
3 None
4 https://en.wikipedia.org/wiki/Hans_Kelsen
5 https://en.wikipedia.org/wiki/Theodor_Geiger
6 https://en.wikipedia.org/wiki/Ernst_Fraenkel_(...
7 https://en.wikipedia.org/wiki/Franz_Neumann_(p...
8 https://en.wikipedia.org/wiki/Otto_Kahn-Freund
9 None
10 https://en.wikipedia.org/wiki/Otto_Kirchheimer
11 https://en.wikipedia.org/wiki/Helmut_Schelsky
12 None
13 None
14 None
15 None
16 https://en.wikipedia.org/wiki/Niklas_Luhmann
17 None
18 None
19 https://en.wikipedia.org/wiki/Jutta_Limbach
20 None
21 None
22 https://en.wikipedia.org/wiki/R%C3%BCdiger_Lau...
23 None
24 https://en.wikipedia.org/wiki/Volkmar_Gessner
25 None
26 https://en.wikipedia.org/wiki/Erhard_Blankenburg
27 None
28 None
29 None
30 None
31 https://en.wikipedia.org/wiki/Brun-Otto_Bryde
32 None
33 None
34 None
35 https://en.wikipedia.org/wiki/Gunther_Teubner
36 None
37 None
38 https://en.wikipedia.org/wiki/Susanne_Karstedt
39 None
40 None
41 None
42 https://en.wikipedia.org/wiki/Ralf_Rogowski
43 None
44 None
45 None
46 None
47 None
48 None
49 None
50 https://en.wikipedia.org/wiki/Susanne_Baer
51 None
wikipedia_de
0 https://de.wikipedia.org/wiki/Karl_Renner
1 https://de.wikipedia.org/wiki/Hugo_Sinzheimer
2 https://de.wikipedia.org/wiki/Arthur_Nussbaum
3 https://de.wikipedia.org/wiki/Ludwig_Bendix
4 https://de.wikipedia.org/wiki/Hans_Kelsen
5 https://de.wikipedia.org/wiki/Theodor_Geiger
6 https://de.wikipedia.org/wiki/Ernst_Fraenkel_(...
7 https://de.wikipedia.org/wiki/Franz_Neumann_(P...
8 https://de.wikipedia.org/wiki/Otto_Kahn-Freund
9 https://de.wikipedia.org/wiki/Ernst_Eduard_Hirsch
10 https://de.wikipedia.org/wiki/Otto_Kirchheimer
11 https://de.wikipedia.org/wiki/Helmut_Schelsky
12 https://de.wikipedia.org/wiki/Hans_Ryffel_(Rec...
13 https://de.wikipedia.org/wiki/Theo_Rasehorn
14 https://de.wikipedia.org/wiki/Rudolf_Wassermann
15 https://de.wikipedia.org/wiki/Thilo_Ramm
16 https://de.wikipedia.org/wiki/Niklas_Luhmann
17 https://de.wikipedia.org/wiki/Rudolf_Wieth%C3%...
18 https://de.wikipedia.org/wiki/G%C3%BCnter_Dux
19 https://de.wikipedia.org/wiki/Jutta_Limbach
20 https://de.wikipedia.org/wiki/Thomas_Raiser
21 https://de.wikipedia.org/wiki/Manfred_Rehbinder
22 https://de.wikipedia.org/wiki/R%C3%BCdiger_Lau...
23 None
24 https://de.wikipedia.org/wiki/Volkmar_Gessner
25 https://de.wikipedia.org/wiki/Klaus_F._R%C3%B6hl
26 https://de.wikipedia.org/wiki/Erhard_Blankenburg
27 https://de.wikipedia.org/wiki/Manfred_Weiss_(J...
28 https://de.wikipedia.org/wiki/R%C3%BCdiger_Voigt
29 https://de.wikipedia.org/wiki/Roland_Girtler
30 https://de.wikipedia.org/wiki/Hubert_Treiber
31 https://de.wikipedia.org/wiki/Brun-Otto_Bryde
32 https://de.wikipedia.org/wiki/Hubert_Rottleuthner
33 None
34 https://de.wikipedia.org/wiki/Dieter_Martiny
35 https://de.wikipedia.org/wiki/Gunther_Teubner
36 https://de.wikipedia.org/wiki/Konstanze_Plett
37 https://de.wikipedia.org/wiki/Armin_H%C3%B6land
38 https://de.wikipedia.org/wiki/Susanne_Karstedt
39 https://de.wikipedia.org/wiki/Leo_Ki%C3%9Fler
40 https://de.wikipedia.org/wiki/Fritz_Jost_(Rech...
41 https://de.wikipedia.org/wiki/Doris_Lucke
42 None
43 https://de.wikipedia.org/wiki/Wolfgang_Ludwig-...
44 https://de.wikipedia.org/wiki/Kai_Bussmann
45 https://de.wikipedia.org/wiki/Dorothea_Jansen
46 https://de.wikipedia.org/wiki/Alfons_Bora
47 https://de.wikipedia.org/wiki/Ute_Sacksofsky
48 None
49 https://de.wikipedia.org/wiki/Ralf_Poscher
50 https://de.wikipedia.org/wiki/Susanne_Baer
51 https://de.wikipedia.org/wiki/Gralf-Peter_Call...
%% Cell type:markdown id:b81815a61da16209 tags:
## Create a sorted list that can be fed into the previous cell
%% Cell type:code id:4d6da32e2fbc1740 tags:
``` python
print("\n".join(df.apply(lambda r: f"{r['fullName']} ({r['qid']})", axis=1).to_list()))
```
%% Output
Karl Renner (Q11726)
Hugo Sinzheimer (Q86043)
Arthur Nussbaum (Q103088)
Ludwig Bendix (Q15449424)
Hans Kelsen (Q84165)
Theodor Geiger (Q96410)
Ernst Fraenkel (Q86812)
Franz Leopold Neumann (Q63195)
Otto Kahn-Freund (Q121832)
Ernst Eduard Hirsch (Q107033)
Otto Kirchheimer (Q214397)
Helmut Schelsky (Q104272)
Hans Ryffel (Q21035905)
Theo Rasehorn (Q1304659)
Rudolf Wassermann (Q1551290)
Thilo Ramm (Q59533838)
Niklas Luhmann (Q57238)
Rudolf Wiethölter (Q1512482)
Günter Dux (Q1560417)
Jutta Limbach (Q72551)
Thomas Raiser (Q27909309)
Manfred Rehbinder (Q1889820)
Rüdiger Lautmann (Q91074)
Wolfgang Kaupen (Q93221485)
Volkmar Gessner (Q15435946)
Klaus F. Röhl (Q27148390)
Erhard Blankenburg (Q51595283)
Manfred Weiss (Q1588285)
Rüdiger Voigt (Q1682026)
Roland Girtler (Q112873)
Hubert Treiber (Q1633462)
Brun-Otto Bryde (Q107784)
Hubert Rottleuthner (Q55622018)
Klaus A. Ziegert (Q112513122)
Dieter Martiny (Q1222459)
Gunther Teubner (Q98304)
Konstanze Plett (Q95192683)
Armin Höland (Q15435996)
Susanne Karstedt (Q2369299)
Leo Kißler (Q63203841)
Fritz Jost (Q105946060)
Doris Lucke (Q1245242)
Ralf Rogowski (Q20128038)
Wolfgang Ludwig-Mayerhofer (Q2590472)
Kai Bussmann (Q1552696)
Dorothea Jansen (Q21258453)
Alfons Bora (Q2644328)
Ute Sacksofsky (Q48562036)
Stefan Machura (Q95245830)
Ralf Poscher (Q2129347)
Susanne Baer (Q101872)
Gralf-Peter Calliess (Q1542033)
%% Cell type:markdown id:d9d0790315730b82 tags:
## Create a clickable list of Wikidata/Wikipedia URLs
%% Cell type:code id:2d7bdaeed0f38415 tags:
``` python
from pathlib import Path
from IPython.display import display, Markdown
from lib.wikidata import create_styled_table
include_rows = ['fullName','itemdesc', 'wikidata_url', 'wikipedia_en', 'wikipedia_de']
md = create_styled_table(df, include_rows).to_markdown(index=False)
Path('output/scholars-de.md').write_text(md)
display(Markdown(md))
```
%% Output
| 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> |
%% Cell type:code id:9bdf188991f29962 tags:
``` python
import pandas as pd
import plotly.express as px
# Load the data
df = pd.read_csv("scholars.csv", encoding='utf-8')
# Initialize a list to track the last dateOfDeath in each row to manage overlaps
last_dates = []
# Function to find the appropriate row for each scholar
def find_row(last_dates, start_date):
for i, last_date in enumerate(last_dates):
if start_date > last_date:
return i
return len(last_dates)
# Assign rows without overlaps and sort by the earliest dateOfBirth
df['row'] = 0
for index, scholar in df.iterrows():
row = find_row(last_dates, scholar['dateOfBirth'])
if row < len(last_dates):
last_dates[row] = scholar['dateOfDeath']
else:
last_dates.append(scholar['dateOfDeath'])
df.at[index, 'row'] = row
# Now plotting without row labels
fig = px.timeline(df, x_start="dateOfBirth", x_end="dateOfDeath", y="row", text="fullName", title="Scholars' Life Spans Timeline")
# Update layout
fig.update_layout(yaxis=dict(tickmode='array', tickvals=[], ticktext=[]))
fig.update_yaxes(autorange="reversed") # This reverses the y-axis to match your requirement
fig.show()
```
%% Output
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[13], line 20
18 df['row'] = 0
19 for index, scholar in df.iterrows():
---> 20 row = find_row(last_dates, scholar['dateOfBirth'])
21 if row < len(last_dates):
22 last_dates[row] = scholar['dateOfDeath']
Cell In[13], line 13, in find_row(last_dates, start_date)
11 def find_row(last_dates, start_date):
12 for i, last_date in enumerate(last_dates):
---> 13 if start_date > last_date:
14 return i
15 return len(last_dates)
TypeError: '>' not supported between instances of 'float' and 'str'
%% Cell type:code id:b8058de7fa9212b tags:
``` python
import pandas as pd
from datetime import datetime
# Assuming df is your existing DataFrame
# Convert dateOfBirth and dateOfDeath to just the year, handle NaT/NaN appropriately
df['Year'] = pd.to_datetime(df['dateOfBirth'], errors='coerce').dt.year.astype('Int64')
df['End Year'] = pd.to_datetime(df['dateOfDeath'], errors='coerce').dt.year.astype('Int64')
# Create 'Display Date' as "dateOfBirth - dateOfDeath"
df['Display Date'] = df['Year'].astype(str).replace('<NA>','') + ' - ' + df['End Year'].astype(str).replace('<NA>','')
# Create 'Headline' as "fullName (dateOfBirth - dateOfDeath)"
df['Headline'] = df['fullName'] + ' (' + df['Display Date'] + ')'
# Create 'Text' column by combining occupation, fieldOfWork, employer
df['Text'] = df[['occupation', 'fieldOfWork']].apply(lambda x: '<br>'.join(x.dropna()), axis=1)
# Use the image directly; assuming the URLs are already correctly formed in the 'image' column
df['Media'] = df['image']
# Add a "Group" column with the value "actors" for all rows
df['Group'] = 'actors'
# fix date columns
df['Display Date'] = df['Display Date'].fillna('') # Ensure no NaNs in Display Date
df['Headline'] = df['Headline'].fillna('') # Ensure no NaNs in Headline
df['Text'] = df['Text'].fillna('') # Ensure no NaNs in Text
df['Media'] = df['Media'].fillna('') # Ensure no NaNs in Media
# Now select and order the DataFrame according to the TimelineJS template requirements
columns = "Year Month Day Time End Year End Month End Day End Time Display Date Headline Text Media Media Credit Media Caption Media Thumbnail Type Group Background Link".split("\t")
for col in columns:
if col not in df:
df[col] = ''
timeline_df = df[columns]
timeline_df.to_excel("timeline_data.xlsx", index=False)
```
%% Cell type:code id:f4b14ea7d4941e57 tags:
``` python
```
%% Cell type:code id:initial_id tags:
``` python
property_labels_to_ids = {
'sexOrGender': 'P21',
'familyName': 'P734',
'givenName': 'P735',
'dateOfBirth': 'P569',
'dateOfDeath': 'P570',
}
scholars = """
William Twining (Q16095913)
Philip Aneurin Thomas (Q112432625)
David Sugarman (Q112366094)
Carol Smart (Q5044563)
David Nelken (Q5237957)
Rosemary Hunter (Q7368381)
Sally Wheeler (Q28078278)
Don Harris (Q125080407)
Roger Cotterrell (Q7358027)
Fiona Cownie (Q113809561)
Joanne Conaghan (Q108276256)
""".split("\n")
from lib.wikidata import get_person_info_from_wikidata
import pandas as pd
df = get_person_info_from_wikidata(scholars, property_labels_to_ids, include_description=True, debug=False)
df['dateOfBirth'] = pd.to_datetime(df['dateOfBirth'])
df['dateOfDeath'] = pd.to_datetime(df['dateOfDeath'])
df.sort_values(by=["dateOfBirth"], inplace=True, ignore_index=True)
df.to_csv("output/scholars-uk.csv", index=False)
df
```
%% Output
Retrieving scholar data...
Retrieving wikipedia URLs...
fullName qid \
0 William Twining Q16095913
1 Philip Aneurin Thomas Q112432625
2 David Sugarman Q112366094
3 Carol Smart Q5044563
4 David Nelken Q5237957
5 Rosemary Hunter Q7368381
6 Sally Wheeler Q28078278
7 Don Harris Q125080407
8 Roger Cotterrell Q7358027
9 Fiona Cownie Q113809561
10 Joanne Conaghan Q108276256
itemdesc sexOrGender familyName \
0 Professor of Jurisprudence male Twining
1 None male Thomas
2 None male Sugarman
3 Feminist sociologist female Smart
4 British political scientist male
5 Australian jurist female Hunter
6 Professor and Head of the School of Law at Que... female Wheeler
7 British jurist and professor at the university... None
8 British academic male
9 None female
10 British legal scholar female Conaghan
givenName dateOfBirth dateOfDeath \
0 Lawrence William 1934-09-22 00:00:00+00:00 NaT
1 1940-01-01 00:00:00+00:00 NaT
2 David 1948-01-01 00:00:00+00:00 NaT
3 Carol 1948-12-20 00:00:00+00:00 NaT
4 David 1949-01-01 00:00:00+00:00 NaT
5 Rosemary 1962-01-01 00:00:00+00:00 NaT
6 Sally 1964-01-01 00:00:00+00:00 NaT
7 NaT NaT
8 Roger NaT NaT
9 NaT NaT
10 Joanne NaT NaT
wikidata_url \
0 http://www.wikidata.org/entity/Q16095913
1 http://www.wikidata.org/entity/Q112432625
2 http://www.wikidata.org/entity/Q112366094
3 http://www.wikidata.org/entity/Q5044563
4 http://www.wikidata.org/entity/Q5237957
5 http://www.wikidata.org/entity/Q7368381
6 http://www.wikidata.org/entity/Q28078278
7 http://www.wikidata.org/entity/Q125080407
8 http://www.wikidata.org/entity/Q7358027
9 http://www.wikidata.org/entity/Q113809561
10 http://www.wikidata.org/entity/Q108276256
wikipedia_en wikipedia_de
0 https://en.wikipedia.org/wiki/William_Twining None
1 None None
2 None None
3 https://en.wikipedia.org/wiki/Carol_Smart None
4 https://en.wikipedia.org/wiki/David_Nelken None
5 https://en.wikipedia.org/wiki/Rosemary_Hunter None
6 https://en.wikipedia.org/wiki/Sally_Wheeler_(l... None
7 None None
8 https://en.wikipedia.org/wiki/Roger_Cotterrell None
9 None None
10 https://en.wikipedia.org/wiki/Joanne_Conaghan None
%% Cell type:code id:293eecdcf97d4fd1 tags:
``` python
print("\n".join(df.apply(lambda r: f"{r['fullName']} ({r['qid']})", axis=1).to_list()))
```
%% Output
William Twining (Q16095913)
Philip Aneurin Thomas (Q112432625)
David Sugarman (Q112366094)
Carol Smart (Q5044563)
David Nelken (Q5237957)
Rosemary Hunter (Q7368381)
Sally Wheeler (Q28078278)
Don Harris (Q125080407)
Roger Cotterrell (Q7358027)
Fiona Cownie (Q113809561)
Joanne Conaghan (Q108276256)
%% Cell type:code id:e6e8f4591eff1e62 tags:
``` python
from pathlib import Path
from IPython.display import display, Markdown
from lib.wikidata import create_styled_table
include_rows = ['fullName', 'itemdesc', 'wikidata_url', 'wikipedia_en']
md = create_styled_table(df, include_rows).to_markdown(index=False)
Path('output/scholars-uk.md').write_text(md)
display(Markdown(md))
```
%% Output
| 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> |
%% Cell type:code id:e49091071f6d1e93 tags:
``` python
```
%% Cell type:code id:a84ea8429f57d924 tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment