On Apr 7, 2025, at 3:28 PM, Stuart A. Yeates <[log in to unmask]> wrote:
> I have some queries at:
>
> https://www.wikidata.org/wiki/User:Stuartyeates/InterestingPeopleQuery
>
> which show how to query for people and handle things like multiple dates of birth or LCCNs. The core idea is to concat the LCCNs into a single field using:
>
> (GROUP_CONCAT(DISTINCT ?lccnurl; SEPARATOR = ";") AS ?LCCN_urls)
>
> and then GROUP BY.
>
> --
> stuart
Yep, exactly.
Susan Hoover, over on Slack LD4Libraries gave me a cool query doing just those things. I enhanced the query to include OPTIONAL variables, wrapped it in a Python script that takes a QNumber of a person as input, and outputs a JSON stream describing the person. See attached? Example usages:
# Abraham Lincoln (attached)
./person2metadata.py Q91
# Hector piped to jq for pretty display
./person2metadata.py Q159666 | jq
# Charlemagne piped to jq and paged
./person2metadata.py Q3044 | jq | less -S
The next steps are to:
1. expand the list of properties so the metadata
of other things (like honor, beauty, or United
States of America) can be garnered
2. allow the script to take multiple inputs
3. create a network graph file from the results
In the end, I will be able to study and visualize the characteristics and relationships of many named-entities in a given collection of narrative works.
Fun!
--
Eric Morgan
University of Notre Dame
|