How many {librettist} are to/by {Philip Glass} ?
Which is the number of operas that Philip Glass wrote?
How many operas did Philip Glass write?
SELECT ( COUNT ( ?q ) AS ?n ) { ?q property:librettist resource:Philip_Glass }
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/P87> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q189729 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P87 wd:Q189729 }
6