How many {capital} are to/by {Stockholm} ?
Which is the number of capitals that are named Stockholm?
How many capitals are named Stockholm?
SELECT ( COUNT ( ?n ) AS ?h ) { ?n property:capital resource:Stockholm }
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/P36> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q1754 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P36 wd:Q1754 }
7