Search code examples
sparqlwikidata

How do you query for current board members of a business using SPARQL on Wikidata?


Here is the base query which returns all directors, including those who are no longer members of the board. I don't know how to access the start or end date of their membership, because the first line of the where statement returns a person entity, and not the relationship.

# Select the current board members of Alphabet
SELECT ?director ?directorLabel ?start ?end
WHERE {
  wd:Q20800404 wdt:P3320 ?director;
  # OPTIONAL { wd:Q20800404 wdt:P3320 [pq:P582 ?end] . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LIMIT 100

How do you query for current board members of a business using SPARQL on Wikidata?

Thanks!

Bonus if you can explain in comments why the board membership is only reflected on the business, and not the individual, political posts seem to be the other way around.


Solution

  • This gets the results I wanted.

    SELECT ?directorLabel ?relationship ?start
    WHERE {
      wd:Q20800404 p:P3320 ?relationship.
      ?relationship ps:P3320 ?director.
      OPTIONAL {?relationship pq:P580 ?start.}
      FILTER NOT EXISTS {?relationship pq:P582 ?end.}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    LIMIT 100
    

    https://w.wiki/3mSe