query-a0ef825b1d0aa19b05d855088a2cf49e

rq turtle/ttl

Rear Admiral of the Squadron issue SELECT DISTINCT ?person ?personLabel ?givenLabel ?familyLabel ?timeVice ?timeRear ?timeCaptain ?timeDeath ?threeID WHERE { # restrict to known case of Paul Minchin # BIND (wd:Q75707296 AS ?person) . # restrict to known case of Isaac Coffin # BIND (wd:Q7527341 AS ?person) . VALUES ?person {wd:Q75707296 wd:Q7527341 wd:Q75245560}

# Human ?person wdt:P31 wd:Q5 .

# branch of service is Royal Navy ?person wdt:P241 wd:Q172771 .

optional { # given name ?person wdt:P735 ?given . }

optional { # family name ?person wdt:P734 ?family . }

optional { # Three Decks person ID ?person wdt:P7389 ?threeID . }

# There should only be one date for captain (or post captain) optional { ?person p:P410 ?stmtCaptain . ?stmtCaptain ps:P410/wdt:P279* wd:Q5036514 . ?stmtCaptain pq:P580 ?timeCaptain . }

# There may be several dates for rear admiral optional { # ?person p:P410 ?stmtRear . # ?stmtRear ps:P410/wdt:P279 wd:Q15615347 . # ?stmtRear pq:P580 ?timeRear . SELECT ?person (MIN(?dRear) AS ?timeRear) WHERE { ?person p:P410 ?stmtRear . ?stmtRear ps:P410/wdt:P279 wd:Q15615347 . ?stmtRear pq:P580 ?dRear . } GROUP BY ?person }

# There may be several dates for vice admiral optional { SELECT ?person (MIN(?dVice) AS ?timeVice) WHERE { ?person p:P410 ?stmtVice . ?stmtVice ps:P410/wdt:P279* wd:Q4902790 . ?stmtVice pq:P580 ?dVice . } GROUP BY ?person }

optional { ?person wdt:P570 ?timeDeath . }

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

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Rear Admiral of the Squadron issue
SELECT DISTINCT ?person ?personLabel ?givenLabel ?familyLabel ?timeVice ?timeRear ?timeCaptain ?timeDeath ?threeID WHERE {
  # restrict to known case of Paul Minchin
  # BIND (wd:Q75707296 AS ?person) .
  # restrict to known case of Isaac Coffin
  # BIND (wd:Q7527341 AS ?person) .
  VALUES ?person {wd:Q75707296 wd:Q7527341 wd:Q75245560}

  # Human
  ?person wdt:P31 wd:Q5 .

  # branch of service is Royal Navy
  ?person wdt:P241 wd:Q172771 .

  optional {
    # given name
    ?person wdt:P735 ?given .
  }

  optional {
    # family name
    ?person wdt:P734 ?family .
  }

  optional {
    # Three Decks person ID
    ?person wdt:P7389 ?threeID .
  }

  # There should only be one date for captain (or post captain)
  optional {
    ?person p:P410 ?stmtCaptain .
    ?stmtCaptain ps:P410/wdt:P279* wd:Q5036514 .
    ?stmtCaptain pq:P580 ?timeCaptain .
  }

  # There may be several dates for rear admiral
  optional {
    # ?person p:P410 ?stmtRear .
    # ?stmtRear ps:P410/wdt:P279* wd:Q15615347 .
    # ?stmtRear pq:P580 ?timeRear .
    SELECT ?person (MIN(?dRear) AS ?timeRear) WHERE {
      ?person p:P410 ?stmtRear .
      ?stmtRear ps:P410/wdt:P279* wd:Q15615347 .
      ?stmtRear pq:P580 ?dRear .
    } GROUP BY ?person
  }

  # There may be several dates for vice admiral
  optional {
    SELECT ?person (MIN(?dVice) AS ?timeVice) WHERE {
      ?person p:P410 ?stmtVice .
      ?stmtVice ps:P410/wdt:P279* wd:Q4902790 .
      ?stmtVice pq:P580 ?dVice .
    } GROUP BY ?person
  }

  optional {
    ?person wdt:P570 ?timeDeath .
  }

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

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?dRear") v12("?dVice") v4("?family") v3("?given") v2("?person"):::projected v6("?stmtCaptain") v8("?stmtRear") v11("?stmtVice") v5("?threeID"):::projected v7("?timeCaptain"):::projected v1("?timeDeath"):::projected v10("?timeRear"):::projected v13("?timeVice"):::projected a1((" ")) a2((" ")) a3((" ")) c14(["wd:Q4902790"]):::iri c19(["en"]):::literal c17(["bd:serviceParam"]):::iri c2(["wd:Q5"]):::iri c13(["wd:Q15615347"]):::iri c4(["wd:Q172771"]):::iri c11(["wd:Q5036514"]):::iri bind0[/VALUES ?person/] bind0-->v2 bind00(["wd:Q75707296"]) bind00 --> bind0 bind01(["wd:Q7527341"]) bind01 --> bind0 bind02(["wd:Q75245560"]) bind02 --> bind0 v2 --"p:direct/P31"--> c2 v2 --"p:direct/P241"--> c4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P735".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P734".-> v4 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P7389".-> v5 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:P410".-> v6 v6 --"p:statement/P410"--> a1 a1 --"p:direct/P279"--> c11 v6 --"p:qualifier/P580"--> v7 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:P410".-> v8 v8 --"p:statement/P410"--> a2 a2 --"p:direct/P279"--> c13 v8 --"p:qualifier/P580"--> v9 bind2[/"min(?dRear)"/] v9 --o bind2 bind2 --as--o v10 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:P410".-> v11 v11 --"p:statement/P410"--> a3 a3 --"p:direct/P279"--> c14 v11 --"p:qualifier/P580"--> v12 bind4[/"min(?dVice)"/] v12 --o bind4 bind4 --as--o v13 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P570".-> v1 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c17 --"wikibase:language"--> c19 end