query-866a1a48aab523ab55db21018ba60cf4
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
- https://query.wikidata.org/sparql
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