Wolfram Language

Sort Entities

The Wolfram Language represents classes of entities using EntityClass. Version 12 introduces SortedEntityClass, which lets you define an order on the entities of a given class. You can not only sort by any propertyin ascending or descending orderbut by an arbitrary expression using EntityFunction.

Define a class of "Planet" entities whose members are sorted by the distance from the Sun.

Now sort by mass instead, in descending order to get the heaviest planet first.

You can ask for properties of its member entities.

To see directly which value corresponds to which planet, return an association.

You can also sort by complex criteria, like the ratio of mass to distance from the Sun.

You can retrieve multiple properties at a time. Here you get the distance-to-mass ratio and an image to make a Dataset.

Related Examples

de es fr ja ko pt-br zh