Optimise getCardinalityValues to use a single SPARQL query with VALUES