How many {officially opened by} are to/by {Prince Philip, Duke of Edinburgh} ?
Give me the number of castles opened by Prince Philip.
How many were officially opened by Prince Philip, Duke of Edinburgh?
SELECT ( COUNT ( ?o ) AS ?q ) { ?o property:officially_opened_by resource:Prince_Philip,_Duke_of_Edinburgh }
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/P542> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q80976 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P542 wd:Q80976 }
9