To get the ids of a selection of components or references, the id()-step can be used.
The following query finds all the components in the organization and then returns their ids. Ids in Ardoq are unique, so there is no need to remove duplicates from the results.
g.V().id()
The following query finds the component whose id is "b9bab817a145254ce4b921ef" and then returns the id of this component. As such, the only result is the string "b9bab817a145254ce4b921ef".
g.V().hasId('b9bab817a145254ce4b921ef').id()