How many {military rank} are to/by {shogun} ?
What number of shogun military ranks exist?
How many shogun military ranks are there?
SELECT ( COUNT ( ?s ) AS ?v ) { ?s property:military_rank resource:Shogun }
SELECT (COUNT(?sub) AS ?subs ) {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ?sub .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P410> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q131767 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P410 wd:Q131767 }
54