How many {headquarters location} are to/by {Badalona} ?
Badalona has how many headquarter locations?
How many headquarter locations are there in Badalona?
SELECT ( COUNT ( ?u ) AS ?d ) { ?u property:headquarters_location resource:Badalona }
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/P159> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q15468 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P159 wd:Q15468 }
22