AggregatedEntityClass
✖
AggregatedEntityClass
represents an entity class containing a single entity with the property prop whose value is the result of applying the function f to the whole specified entity class.
constructs multiple properties propi obtained by applying fi to class.
forms groups of elements of class according to their values of the property gprop, then generates an entity class with an entity for each of these groups.
forms groups according to the values obtained by applying the entity function f, with the resulting property named pname.
forms groups for which the set of values defined by the gspeci is distinct.
Details

- In AggregatedEntityClass[class,"prop"f], the function f can either be an EntityFunction[…] object or a function fun that will be treated as EntityFunction[x,fun[x["prop"]]].
- In AggregatedEntityClass[class,propspec], EntityFunction objects in propspec are in effect applied to an association of properties whose values are the list of values for the entities in class.
- EntityFunction expressions appearing in the second argument of AggregatedEntityClass are not applied to single entities in the first argument, but rather to the whole first argument, if no third argument is present, or to the entity classes obtained by grouping according to the third argument.
- EntityFunction expressions appearing in the third argument of AggregatedEntityClass are applied separately to the individual entities in the first argument.
- Unlike GroupBy, AggregatedEntityClass[class,propspec,{prop1,prop2,…}] does not perform hierarchical grouping if its third argument is a list; rather, it will create a class with a number of entities given by the distinct values of EntityValue[class,{prop1,prop2,…}].
- EntityProperties[AggregatedEntityClass[class,{"name1"->entityfunc1,"name2"->entityfunc2,…},{"prop1","prop2",…}]] returns {EntityProperty[agg,"name1"],EntityProperty[agg,"name2"],…,EntityProperty[agg,"prop1"],EntityProperty[agg,"prop2"],…} where agg is the whole AggregatedEntityClass expression.
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
Create an aggregation of all countries and compute their total area:

https://wolfram.com/xid/0b7fp2ojkzbeaapu-eqeofg

An equivalent computation, suitable for small datasets:

https://wolfram.com/xid/0b7fp2ojkzbeaapu-ewenrn

Find the mean atomic mass for elements in each period class:

https://wolfram.com/xid/0b7fp2ojkzbeaapu-6zzdfs

When used with relational-database-backed entities, a two-argument AggregatedEntityClass corresponds to using aggregate functions in the SELECT statement:

https://wolfram.com/xid/0b7fp2ojkzbeaapu-dpe8aj

Compute the total amount of payments:

https://wolfram.com/xid/0b7fp2ojkzbeaapu-r20iif

Compute the maximum credit limit by country (similar to a GROUP BY statement in SQL languages):

https://wolfram.com/xid/0b7fp2ojkzbeaapu-jd0urv

Scope (2)Survey of the scope of standard use cases
The third argument can be an EntityFunction:

https://wolfram.com/xid/0b7fp2ojkzbeaapu-8c2qog

Apply a function to the result, typically an aggregation function:

https://wolfram.com/xid/0b7fp2ojkzbeaapu-f09cqs

Use this to compute the mean value of the result:

https://wolfram.com/xid/0b7fp2ojkzbeaapu-pi8ww

Or create a pie chart with the result:

https://wolfram.com/xid/0b7fp2ojkzbeaapu-j6ri9a

Properties & Relations (2)Properties of the function, and connections to other functions
AggregatedEntityClass generates entities that correspond to groups:

https://wolfram.com/xid/0b7fp2ojkzbeaapu-m0dibt

Single entities obtained from AggregatedEntityClass effectively correspond to implicit entities:

https://wolfram.com/xid/0b7fp2ojkzbeaapu-hagb6c


https://wolfram.com/xid/0b7fp2ojkzbeaapu-5m0d4h

Wolfram Research (2019), AggregatedEntityClass, Wolfram Language function, https://reference.wolfram.com/language/ref/AggregatedEntityClass.html.
Text
Wolfram Research (2019), AggregatedEntityClass, Wolfram Language function, https://reference.wolfram.com/language/ref/AggregatedEntityClass.html.
Wolfram Research (2019), AggregatedEntityClass, Wolfram Language function, https://reference.wolfram.com/language/ref/AggregatedEntityClass.html.
CMS
Wolfram Language. 2019. "AggregatedEntityClass." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AggregatedEntityClass.html.
Wolfram Language. 2019. "AggregatedEntityClass." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AggregatedEntityClass.html.
APA
Wolfram Language. (2019). AggregatedEntityClass. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AggregatedEntityClass.html
Wolfram Language. (2019). AggregatedEntityClass. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AggregatedEntityClass.html
BibTeX
@misc{reference.wolfram_2025_aggregatedentityclass, author="Wolfram Research", title="{AggregatedEntityClass}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/AggregatedEntityClass.html}", note=[Accessed: 19-June-2025
]}
BibLaTeX
@online{reference.wolfram_2025_aggregatedentityclass, organization={Wolfram Research}, title={AggregatedEntityClass}, year={2019}, url={https://reference.wolfram.com/language/ref/AggregatedEntityClass.html}, note=[Accessed: 19-June-2025
]}