How many {exhibition history} are to/by {National Gallery} ?
What is the number of historical exhibitions by the National Gallery?
How many historical exhibitions are there by the National Gallery?
SELECT ( COUNT ( ?i ) AS ?g ) { ?i property:exhibition_history resource:National_Gallery }
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/P608> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q180788 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P608 wd:Q180788 }
4