How many {cast member} are to/by {Ricky Nelson} ?
Which show was Ricky Nelson a cast member in?
What show was Ricky Nelson a cast member?
SELECT ( COUNT ( ?y ) AS ?x ) { ?y property:cast_member resource:Ricky_Nelson }
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/P161> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q303207 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P161 wd:Q303207 }
9