IndividualAggregator
Object Hierarchy:
Description:
Stores Individuals which have been created through aggregation of all the Personas provided by the various Backends.
This is the main interface for client applications.
Linking and unlinking of personas and individuals is performed entirely through the aggregator. Personas may be linked together to form
individuals; for example, the personas which form individual1
and individual2
may be linked together with
another_persona
to give a new Individual:
var personas = new HashSet<Persona> ();
personas.add_all (individual1.personas);
personas.add_all (individual2.personas);
personas.add (another_persona);
yield my_individual_aggregator.link_personas (personas);
The individuals which contained those personas will be removed when IndividualAggregator.link_personas is called. Any personas in those individuals which were not included in the linking call may end up implicitly linked to the new individual, or may be aggregated into other new individuals.
For example, consider the situation where individual1
contains two personas, persona1A
and persona1B
;
individual2
contains one persona, persona2A
; and another_persona
comes from individual3
,
which also contains persona3A
and persona3B
. Calling
IndividualAggregator.link_personas on persona1A
,
persona1B
, persona2A
and another_persona
will result in individual1
and individual2
being removed. A new Individual will be created containing all the personas
passed to the linking function. It might also contain persona3A
and persona3B
; or they might be in one or two other
new individuals.
An existing individual may be unlinked to form singleton individuals for each of its personas:
yield my_individual_aggregator.unlink_individual (my_individual);
Note that to link two individuals together, their two sets of personas must be linked together. There is no API to directly link the individuals themselves, as conceptually folks links Personas, not Individuals.
Folks does not support having more than one IndividualAggregator instantiated at the same time. Most clients should use IndividualAggregator.dup to retrieve the IndividualAggregator singleton.