query-5f897ac9edd77c0b46f2c54db9e85537

rq turtle/ttl

District Attorneys no position held; added Los Angeles County District Attorney(Q10293636)Hamilton Burger ; changed to Los Angeles County District Attorney(Q600751)prosecutor (P39)position held listed as (Q5560519)Gil Garcetti (Q85222257)San Francisco District Attorney (P39)position held listed as (Q5539636)George Gascón (Q600751)prosecutor is a subclass of (Q653368)district attorney (Q113181124)Alameda County District Attorney 2017-present(Q100165598)Summer Stephan 2003-2017(Q4942332)Bonnie Dumanis is an instance of DA (Q7413629)San Diego County District Attorney is not a subclass of DA; added subclass.(Q15242890)Los Angeles County District Attorney is a subclass of district attorney(Q85222257)San Francisco District Attorney Should there be a California DA class? . w:List of district attorneys by countyThe office should have an associated county. See (P1001)applies to jurisdiction looks like This query finds DAs in LA and Santa Clara counties.

Use at

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 ?attorney ?attorneyLabel ?jurisdictionLabel
{
  # find someone who holds a position
  ?attorney wdt:P39 ?position .

  # the position is a subclass of district attorney
  ?position wdt:P279* wd:Q653368 .

  # the position has a jurisdiction
  ?position wdt:P1001 ?jurisdiction .

  # jurisdiction is a county in California
  ?jurisdiction wdt:P31 wd:Q13212489 . 

  SERVICE wikibase:label {
     bd:serviceParam wikibase:language "en" .
  }
} ORDER BY ?jurisdictionLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?attorney"):::projected v4("?jurisdiction") v1("?jurisdictionLabel"):::projected v3("?position") c8(["bd:serviceParam"]):::iri c3(["wd:Q653368"]):::iri c10(["en"]):::literal c6(["wd:Q13212489"]):::iri v2 --"wdt:P39"--> v3 v3 --"wdt:P279"--> c3 v3 --"wdt:P1001"--> v4 v4 --"wdt:P31"--> c6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end