Object Relationships

Content Repository : Developer Guide

Many applications of the content repository require that content items be related to each other as well as to other classes of objects. Examples include:

The ACS kernel provides a standard, highly flexible data model and API for relating objects to other objects. If you have a highly specific problem and are developing your own user interface on the content repository, you can use the ACS relationships framework directly. The relationship framework in the content repository itself is simply intended as a convenience for handling common relationship situations involving content items.

Parent-Child Relationships

In many cases one content item may serve as a natural container for another item. An article divided into sections, or a news story with an associated photo are one example of this. These "parent-child" relationships are handled by the basic hierarchical organization of the content repository. Every item has a parent item, represented internally by the parent_id column in the cr_items table.

It is often desirable to constrain the number and content type of child items. For example, the specifications for a news story may only allow for a single photo. A structured report may have exactly three sections. Furthermore, it may be necessary to classify or identify child items of the same type. Clearly the sections of a report would have a logical order in which they would need to be presented to the user. The layout for a photo album may have a special position for a "featured" photo.

The content repository accommodates these situations in the following ways:

Note that there is no currently no explicit API to "add a child." You specify the parent of an item upon creating it. You can use the API procedure content_item.move to change the parent of an item.

Item-Object Relationships

In addition to the relationships to their parents and children in the content repository hierarchy, content items may be linked to any number of other objects in the system. This may include products, users or content items on related subjects.

The same need to constrain the possibilities for an item-object relationship, as described above for parents and children, also apply to items and objects in general. The content repository provides a data model and API for managing these constraints that parallels what is provided for parent-child relationships:

Extending Parent-Child and Item-Object Relationships

The simple relation mechanisms described above may not be sufficient for some applications. However, because both relationships defined by the content repository are themselves objects, you have the option to extend their types as you would for any other ACS object.


karlg@arsdigita.com
Last modified: $Id: object-relationships.html,v 1.1.1.1.30.3 2017/04/21 14:53:08 gustafn Exp $