How many {official residence} are to/by {Berlin} ?
Whoi officially resided in Berlin?
Berlin is the official residence to who?
SELECT ( COUNT ( ?x ) AS ?r ) { ?x property:official_residence resource:Berlin }
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/P263> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q64 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P263 wd:Q64 }
4