How many {connects with} are to/by {Berlin} ?
How many connections does Berlin have?
How many connections are there to Berlin?
SELECT ( COUNT ( ?e ) AS ?g ) { ?e property:connects_with 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/P2789> .
?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:P2789 wd:Q64 }
1