query-c2e0487dfdfa2fa8b8e8b715cbe4d209
Captains list for the Royal Navy SELECT DISTINCT ?person ?personLabel ?timeCaptain ?threeID { # allow the report to work for different years BIND ("1741-03-01"^^xsd:dateTime AS ?timeMin) . BIND ("1784-01-01"^^xsd:dateTime AS ?timeReport) .
# person in Royal Navy ?person wdt:P241 wd:Q172771 .
# human instead of fictional ?person wdt:P31 wd:Q5 .
# military rank -- should have a start time # captain (Royal Navy) wd:Q5036514
?person p:P410 ?stmtCaptain . ?stmtCaptain ps:P410 wd:Q5036514 . ?stmtCaptain pq:P580 ?timeCaptain .
# Three Decks ID optional { ?person wdt:P7389 ?threeID . }
# get time of death (some have multiple death dates) ?person wdt:P570 ?timeDeath . filter ( ?timeReport <= ?timeDeath) .
filter ( ?timeMin <= ?timeCaptain) . filter ( ?timeReport >= ?timeCaptain) .
# occupation naval officer # ?person wdt:P106 wd:Q10669499
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
} ORDER BY ?timeCaptain
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#>
# Captains list for the Royal Navy
SELECT DISTINCT ?person ?personLabel ?timeCaptain ?threeID
{
# allow the report to work for different years
BIND ("1741-03-01"^^xsd:date AS ?timeMin) .
BIND ("1784-01-01"^^xsd:date AS ?timeReport) .
# person in Royal Navy
?person wdt:P241 wd:Q172771 .
# human instead of fictional
?person wdt:P31 wd:Q5 .
# military rank -- should have a start time
# captain (Royal Navy) wd:Q5036514
?person p:P410 ?stmtCaptain .
?stmtCaptain ps:P410 wd:Q5036514 .
?stmtCaptain pq:P580 ?timeCaptain .
# Three Decks ID
optional {
?person wdt:P7389 ?threeID .
}
# get time of death (some have multiple death dates)
?person wdt:P570 ?timeDeath .
filter ( ?timeReport <= ?timeDeath) .
filter ( ?timeMin <= ?timeCaptain) .
filter ( ?timeReport >= ?timeCaptain) .
# occupation naval officer
# ?person wdt:P106 wd:Q10669499
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
} ORDER BY ?timeCaptain