How many {collection} are to/by {Royal Danish Library} ?
What collections does the Royal Danish Library have?
How many collections are in the Royal Danish Library?
SELECT ( COUNT ( ?l ) AS ?k ) { ?l property:collection resource:Royal_Danish_Library }
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/P195> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> http://wikidata.dbpedia.org/resource/Q867885 .
} 

SELECT (COUNT(?sub) AS ?value ) { ?sub wdt:P195 wd:Q867885 }
14