Database structure

While you don't work with the database directly when using Relatude, it can be helpful to understand how the database is structured.

In the database each document type or object you define has its data in one or more tables. These tables are created and maintained automatically. The table are by default the combination of the namespace and the class name. Below is an example showing the basic structure:

There are two kinds of base objects in WAF. One is called “ContentBase”. The other is called “InnerContentBase”. ContentBase is the main object and InnerContentBase is an object that exists “inside” the ContentBase object and is used for things like paragraphs.

  • “native_node” contains one record for every object in the system that inherits from ContentBase. This table contains key data that is universal across all revisions and culture versions of the object, such as node_id, class_id, site_id etc. The primary key is the node_id. Node ID is a id that refers to a specific content object without reference to the revision or culture version.
     
  • “native_node_csd” contains one record for each culture version of content. If the site only has more than one culture installed the relation between native_node and native_node_csd is one to many. The table contains data that is specific to each culture version but is shared across the revisions. Typical data is access rights. Access rights are set individually for each culture, but are shared for all content revisions within one culture. The primary key is the combination of node_id and culture_id.
     
  • “native_content” contains data that is specific to each content revision and culture. The primary key of the table is the combination of “node_id”, “culture_id” and “revision”. Typical data is the contents name, url address etc.
     
  • The blue class tables contain class specific data and are created to fit the semantic data model. Each class you define gets its own table. Each property you define gets one or more data fields in the table. If one class inherits from another like “ car: vehicle ” in the above example. One class instance of “car” will have records in both the “car” and “vehicle” table. The class tables are linked with the content table through the “content_id”. Content Id must not be confused with Node Id. A Content Id refers to a specific content version of a content node. For example: To retrieve a content of type car you normally refer to it using the Node Id. WAF will in the query look up the relevant Content Id based on the culture id of the current session and look for the content_id of the published revision in the content table.
     
  • The green relation table called “rel_art_vehicle” is a relation table to relate vehicles to articles. The table relates one node_id to another node_id and is used by the relation type called “NodeRelationProperties”. A new relation table is created for each relationship. The relation table may or may not contain additional information about culture and revision if the relation is defined to be specific to content cultures or content revisions.
     
  • The purple table named “paragraph” contains data on each InnerContent type called Paragraphs. Each paragraph is related to an article through the cyan table called “irel_article_para”. An InnerContent can only exist as a part of a ContentBase like an article.