Aggregation (computer science)

from Wikipedia, the free encyclopedia

An aggregation in computer science is either

  • a connection between data or objects,
  • the process of creating metadata from data (the data is assigned to a specific group and general statements are made about the entire group).

There are other meanings for the sub-areas of computer science.

Database

( SQL ) queries to a database management system usually return quantities of data records. However, aggregate functions can also be used to determine summarized information. A simple example is the calculation of an average age from a table of people.

Example: average age

If there is an existing table of persons with the columns Name and Age, the average age should be calculated.

people
Surname Age
Hans 25th
Herbert 37
Helmut 56

With SELECT Name, Alter FROM Personenall of the records can be obtained. An aggregation (the calculation of the average age) could be carried out afterwards using the programmed application logic.

The modified query SELECT AVG(Alter) FROM Personen(AVG stands for average) immediately returns the average age (in this case 39 1/3).

"Is-part-of" relationship

Another use of the term aggregation can also be found in the entity relationship model . In this way, several individual objects can be logically combined into one overall object. This happens with the "is-part-of" relationship .

OLAP

Aggregation is used in a similar way in the area of OLAP systems . The same principle applies here as for the simple aggregate functions of SQL. However, it is about the compression of entire data cubes.

Object-oriented software development

Examples of composition and aggregation in UML

In object-oriented programming , the aggregation specifies an association between objects . In contrast to the composition (which also describes an “is-part-of” association) the part-object can exist without the aggregate-object; It is not automatically deleted when the aggregate object is deleted. In the UML , the aggregation is symbolized by an empty, the composition by a filled diamond on the side of the aggregate class.

Example: marriage versus building

Aggregation : A marriage consists of two spouses who continue to exist as separate persons even after a divorce.

class Ehe // Ein Beispiel einer Aggregation.
{
private:
    Person& _partner1; // Enthaltener Teil.
    Person& _partner2; // Enthaltener Teil.

public:
    // Initialisierender Konstruktor.
    Ehe (Person& partner1, Person& partner2)
        : _partner1(partner1), _partner2(partner2)
    { }
};

Composition : In contrast to this, a building consists of floors that do not stand independently after it has been demolished.

class Gebaeude // Beispiel einer Komposition.
{
private:
    std::vector<Stockwerk> _stockwerke; // Enthaltene Teile.

public:
    // Initialisierender Konstruktor.
    Gebaeude(std::size_t anzahlStockwerke)
        : _stockwerke(anzahlStockwerke)
    {
        if (anzahlStockwerke < 1)
            throw std::logic_error("Das Gebäude muss mindestens 1 Stockwerk haben.");
    }
};

Routing

In connection with routing protocols ( e.g. BGP , OSPF or IS-IS ), aggregation means that several more specific routes (sometimes called prefixes ) can be combined to form a less specific route without the destination information contained therein being changed in terms of content. The purpose of this measure is to minimize the number of routes to be managed and thus to increase the stability of the routing protocol.

The principle of route aggregation is based on classless inter-domain routing .

Aggregation can also be used to control routing by also propagating part of an aggregated route through a more specific route . The more precise route wins here for the more specific destination, while the remaining area follows the aggregated route.

See also