query-866a1a48aab523ab55db21018ba60cf4

rq turtle/ttl

Admiral list for the Royal Navy SELECT DISTINCT ?timeAdmiral ?person ?personLabel ?timeBirth ?timeDeath ?fleet ?threeID { # allow the report to work for different years BIND ("1707-01-01"^^xsd:dateTime AS ?timeReport) .

# person in Royal Navy ?person wdt:P241 wd:Q172771 .

# human instead of fictional ?person wdt:P31 wd:Q5 .

# ?person wdt:P410 ?rank . # ?rank wdt:P279 wd:Q977459 . # admiral of the fleet (of the Royal Navy) subclass of admiral of the fleet Q842486 # ?person wdt:P410 wd:Q2501631 . # use P279 to pick up the subclass

# military rank -- should have a start time # admiral of the fleet wd:Q842486 . # admiral of the fleet (Royal Navy) wd:Q2501631 # admiral wd:Q132851 # admiral (Royal Navy) wd:Q2916006

# get statements about the person's rank optional { ?person p:P410 ?stmtFleet . ?stmtFleet ps:P410 wd:Q2501631 . BIND(1 AS ?fleet) . }

?person p:P410 ?stmtAdmiral . ?stmtAdmiral ps:P410 wd:Q2916006 . optional { ?stmtAdmiral pq:P580 ?timeAdmiral . }

optional { ?person wdt:P7389 ?threeID . } .

# get time of death (some have multiple death dates) ?person wdt:P570 ?timeDeath . ?person wdt:P569 ?timeBirth .

filter ( ?timeReport < ?timeDeath) .

filter ( ?timeBirth < "1800-01-01"^^xsd:dateTime ).

SERVICE wikibase:label { bd:serviceParam wikibase:language "en" .} .

} ORDER BY ?timeAdmiral ?timeDeath

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
# Admiral list for the Royal Navy
SELECT DISTINCT ?timeAdmiral ?person ?personLabel ?timeBirth ?timeDeath ?fleet ?threeID
{ 
  # allow the report to work for different years
  BIND ("1707-01-01"^^xsd:date AS ?timeReport) .

  # person in Royal Navy
  ?person wdt:P241 wd:Q172771 .

  # human instead of fictional
  ?person wdt:P31 wd:Q5 .

  # ?person wdt:P410 ?rank .
  # ?rank wdt:P279 wd:Q977459 .
  # admiral of the fleet (of the Royal Navy) subclass of admiral of the fleet Q842486
  # ?person wdt:P410 wd:Q2501631 .
  # use P279 to pick up the subclass

  # military rank -- should have a start time
  # admiral of the fleet wd:Q842486 .
  # admiral of the fleet (Royal Navy) wd:Q2501631
  # admiral wd:Q132851
  # admiral (Royal Navy) wd:Q2916006

  # get statements about the person's rank
  optional {
      ?person p:P410 ?stmtFleet .
      ?stmtFleet ps:P410 wd:Q2501631 .
      BIND(1 AS ?fleet) .
    }

  ?person p:P410 ?stmtAdmiral .
  ?stmtAdmiral ps:P410 wd:Q2916006 .
  optional {
    ?stmtAdmiral pq:P580 ?timeAdmiral .
  }

  optional {
    ?person wdt:P7389 ?threeID .
    } .

  # get time  of death (some have multiple death dates)
  ?person wdt:P570 ?timeDeath .
  ?person wdt:P569 ?timeBirth .

  filter ( ?timeReport < ?timeDeath) .

  filter ( ?timeBirth < "1800-01-01"^^xsd:date ).

  SERVICE wikibase:label {
     bd:serviceParam wikibase:language "en" .} .

} ORDER BY ?timeAdmiral ?timeDeath

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?fleet"):::projected v5("?person"):::projected v8("?stmtAdmiral") v6("?stmtFleet") v9("?threeID"):::projected v1("?timeAdmiral"):::projected v3("?timeBirth"):::projected v2("?timeDeath"):::projected v5("?timeReport") c9(["wd:Q2916006"]):::iri c17(["en"]):::literal c15(["bd:serviceParam"]):::iri c5(["wd:Q5"]):::iri c8(["wd:Q2501631"]):::iri c3(["wd:Q172771"]):::iri f0[["?timeBirth < '1800-01-01^^xsd:date'"]] f0 --> v3 f1[["?timeReport < ?timeDeath"]] f1 --> v5 f1 --> v2 bind2[/"'1707-01-01^^xsd:date'"/] bind2 --as--o v5 v5 --"p:direct/P241"--> c3 v5 --"p:direct/P31"--> c5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:P410".-> v6 v6 --"p:statement/P410"--> c8 bind3[/"'1^^xsd:integer'"/] bind3 --as--o v7 end v5 --"p:P410"--> v8 v8 --"p:statement/P410"--> c9 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v8 -."p:qualifier/P580".-> v1 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:direct/P7389".-> v9 end v5 --"p:direct/P570"--> v2 v5 --"p:direct/P569"--> v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c15 --"wikibase:language"--> c17 end