query-0382435154962f8522b69f9045302bc6
Finding connections between celebritiesI am looking to build a query where I can show a list of well-known people (i.e. celebrities, athletes, etc) who are connected to a specific person, and then rank them by fame level (as approximated by the number of wikibase:sitelinks for a person -- although open to any alternate fame approximations). For example, if I want to list any person who has been on a project or had a professional/personal relationship with Seth Rogen (they worked together, they are friends, they are on the same board, etc), how would I do that? For the output columns, I'd like: 1) Name of celebrity 2) Link to wiki page 3) QID 4) Hometown state or country (if not in US) 19:40, 14 May 2024 (UTC)) talk (QueryBeginnerThanks in advance! .(P725)voice actor or (P161)cast member as (Q220308)Seth Rogen : The main problem where translating your question into a query is to define what "connected to a specific person" mean in terms of Wikidata claims. Here is the query with the people that have worked with QueryBeginner@
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?coworker ?coworkerLabel ?sitelinks
WHERE {
{
SELECT ?work WHERE {
{?work wdt:P161 wd:Q220308.}
UNION
{?work wdt:P725 wd:Q220308.}
} } {?work wdt:P161 ?coworker.}
UNION
{?work wdt:P725 ?coworker.}
?coworker wikibase:sitelinks ?sitelinks.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en" } .
}
ORDER BY desc(?sitelinks)