Relations and references differ in terms of required system resources and the quantity of saved data. When you decide between asset relations and references, consider the flexibility, scalability, and efficient resource management. This article compares the data models and helps you decide when to use which relation type.


Introduction

The basic data model in censhare and the representation in the asset structure is fundamentally different for asset relations and asset references. For a relation, censhare saves more data than for a reference. Relations are stored in its own database table and represented in both of the related assets. On the other hand, censhare saves a reference only in the asset table of an asset. There is less data. To find an asset reference, censhare still has to search all assets for an appropriate feature because the referenced asset doesn't know anything about its referencing. Here, a relation is advantageous because censhare only needs to look in the corresponding table in order to find both related assets.

censhare works with two different databases: an SQL database and a database integrated in the censhare server (censhare database or cdb). The cdb generates a representation of the related database and increases the query speed in the system. Assets and relations are saved in the SQL database in different tables.

If an asset is checked out, censhare also reads the relations table using combined access and therefore knows which relations exist for the asset. The representation of a relation in the cdb looks different. Here censhare writes a complete XML representation for every asset and it also contains asset relations. Every relation is also represented in two assets, not in its own table. This procedure significantly accelerates searches for relations.

Database scheme and XML representation of related assets

References are features and are therefore only saved in the parent asset. A reference can only be found in the dataset of the parent asset in both the SQL database and in the XML representation in the cdb. In addition, in the cdb there is another index entry that accelerates the search.

Database scheme and XML representation of referenced assets

If you display an author-text relationship as a relation, censhare creates a dataset for the relation and for each of them an XML representation of the relation in the text asset and in the person asset. If an author has written many texts, censhare correspondingly creates a dataset for each relation in the SQL database. In the author asset, every relation is represented by its own element in the XML structure. The related text assets each contain an XML element that represents the author relation.

If the same relationship is saved as a reference, censhare only enters this in the dataset of the parent asset. No additional dataset is created and the reference is not saved in the child asset. Depending on the selected direction, multiple text assets reference one author asset, or an author asset references multiple text assets. Both variants show the same relationship.

When editing a relation, censhare updates both the dataset of the relation in the SQL database and the XML structure of both assets in the cdb. When editing an asset reference, censhare only updates the dataset and the XML structure of the parent asset. When updating relations, multiple processes are initiated and it takes up more system resources.

Performance should also be considered when displaying asset pages. Widgets that show asset relations and asset references are updated in the background. That means, the more asset relation widgets that are placed on a page, the more processes that need to be run in the background as soon as the page is opened. This can affect performance.

Widgets can also be used to display references in child assets. However, censhare cannot directly show parent assets because it does not save the reference in child assets. To do this, censhare needs to first look in the index for the corresponding feature and the associated ID. This operation requires more computing power than the direct method. For this reason, in the menu option "Show relations" censhare does not show asset references in the parent-child relationship.

Best Practices

In the following table you'll find the decision criteria for using relations and references that help you in practical orientation:

Critera

Asset reference

Asset relation

What is represented by the relationship?

Assets that represent (product) features, master data or properties.

Assets that are part of a semantic, organizational or hierarchical structure.

How symmetrical is the relationship?

The relationship exhibits a clear asymmetry, which means a feature asset is referenced in many assets.

The relationship can be asymmetrical or symmetrical in both directions. The asymmetrical or symmetrical usage of a relation is itself a feature of the asset relationship.

Are there other features for describing the relationship?

The relationship is sufficiently characterized by the feature, for example the feature "Color".

The relationship can be represented by other features, for example by a value or a sub-type.

Example:

An author-text relation can be displayed as an asset relation as well as by a feature reference. The decision for one or the other variant can also be made based on the significance of the author in the organization and in the production process.

An editorial staff member, for example, is referenced by the "Author" feature in a text. This feature can be output in one edition of the text. Users can also search for all texts from the same author in an online publication. In this case, the author asset is more of a production feature of the text asset and is referenced for that reason.

In another case, a publisher represents relationships between texts and authors using a relation. These relations are part of an asset structure in which, for example, texts with editions (paperback, hard cover) or texts from different authors (collections) are linked. The author asset can also be related to images, biographies, lists of works or bibliographies. In this case, the asset of an author is part of an asset structure used for different output channels and formats. The different meanings of an author-text relationship are best displayed by a relation.