How many {basic form of government} are to/by {republic} ?
Republics have formed what number of democracies?
How many democracies are formed by republics?
SELECT ( COUNT ( ?p ) AS ?g ) { ?p property:basic_form_of_government resource:republic }
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/P122> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q7270 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P122 wd:Q7270 }
182