How many {port of registry} are to/by {Tallinn} ?
The number of port registries by Tallinn are?
How many ports of registry are by Tallinn?
SELECT ( COUNT ( ?t ) AS ?y ) { ?t property:port_of_registry resource:Tallinn }
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/P532> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q1770 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P532 wd:Q1770 }
16