How many {lyrics by} are to/by {Hal David} ?
What songs has Hal David written?
How many songs are by Hal David?
SELECT ( COUNT ( ?l ) AS ?v ) { ?l property:lyrics_by resource:Hal_David }
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/P676> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q449030 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P676 wd:Q449030 }
24