How many {office held by head of government} are to/by {president} ?
Is the president the head of the government?
Does the president hold the office that is the head of the government?
SELECT ( COUNT ( ?y ) AS ?h ) { ?y property:office_held_by_head_of_government resource:president }
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/P1313> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q30461 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P1313 wd:Q30461 }
10