How many {category contains} are to/by {castle} ?
Tell me how many categories castle contains.
How many categories does castle contain?
SELECT ( COUNT ( ?u ) AS ?v ) { ?u property:category_contains resource:castle }
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/P4224> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q23413 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P4224 wd:Q23413 }
217