Use narrowedClass in the query API