How many {habitat} are to/by {tropical forest} ?
What is the number of different environments in the rainforest?
How many {habitat} are in {tropical forest}?
SELECT ( COUNT ( ?j ) AS ?r ) { ?j property:habitat resource:tropical_forest }
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/P2974> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q199403 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P2974 wd:Q199403 }
4