The following text was translated by Google Translate Technology

Elgg provides a data model that allows us to abstract away completely from the database.

Provides a unified data model called the Entity-Attribute-Value (EAV), which is based on atomic units of data called "Entities".

As you can see in the picture, everything is based on Elgg Entity (ElggEntity).

Users are entities, the groups also are entities, including the site itself, is an entity.

There are 4 types of entities that are specialization of the principal ElggEntity are:

  • ElggUser (Users): All users on the site are ElggUser an entity type.
  • ElggSite (Site): The site is an object with its properties.
  • ElggGroup (Groups): In an entity that contains / groups other entities. One group is made up of members which are users. May contain different entities, such as blogs, files, forums, which are created within the group.
  • ElggObject (objects) in any other social network content is generated by an object. Example objects are blogs, files, bookmarks.

Through these 4 entities can model any type of functionality in Elgg. These specific entities, have their class and related functions.

These entities can be extended to add information to them in 2 ways:

  • Metadata (Metadata): Metadata are properties that can be assigned to an entity. Adding additional information to it. For example, if a user can be date of birth or nationality.
  • Annotations (annotations): annotations are used for feedback on an entity. For example, when talking about a blog, comments and ratings to the blog, are annotations.

A clear example between annotations and metadata are:

  • Metadata are unique properties of an entity, in this case, only the creator of that entity has the ability to assign.
  • The annotations are the feedback provided to the entity, any user can perform. The notes also have defined roles for the sum, amount, or their average.

Entities can also relate to each other and relations are directional. To create a relationship requires a relation name and two entities.

An example of one-way relationship is when a user is a member of a group, establishing the relationship, 'member' between user and group.

An example is two-way relationship is friendship, which creates a relationship of friendship from the user 1 and user 2 and vice versa.

Any new functionality we will be modeled by these entities. The methods and functions which include persistence and access to data from the database. Means that it is more necessary queries manually, or having to create new tables when we need a new feature on the site.

I hope you liked this post.

Happy Coding Elgg


Diego Gallardo