To get the types of a selection of components or references, the label()-step can be used.
The following query finds all the components in the organization, accesses its type, and then removes duplicate results. In other words, the query returns the component types which exist in the organization.
The following query finds all components of type Person, and then returns the type of those components. As such, the result is a collection of the string "Person".