Importing Related Content - Documentation topics on: importing related content,relating content,relating structures,relationship,relationships,.

Importing Related Content

It's possible to import content that is related to one or more contentlets that already exist in the system.  Content can be related on import regardless of whether the relationship exists between two different Content Types or the Content Type is related to itself.

Two Related Content Content Types

In the image shown below, a relationship has been created between two different Content Types - Staff and Department.  Several departments have already been created as content in the system.

Staff-Department Relationship

Using the CSV file show below, staff members can be imported AND related to the department contentlets that already exist in the system.  This is achieved by including an extra column that has the relationship name in the header and lucene queries in each row that match the department(s) that each staff member is a part of.

Staff CSV with Related Departments

On import, dotCMS will read the lucene query in each row and relate one or many contentlets (in this case departments), to the staff members being imported.  After the import, editing the staff content reveals the related department under the Relationships tab.

Staff Member with Related Department

Importing Content to a Self-related Content Type

When importing content with a self-join relationship, as in the example below, the header of the relationship column should indicate which side of the relationship the content should be imported from.


Importing CHILD Content: When -RELPARENT is appended to the end of the related content column header, then the results of the lucene query will be considered the parent content and the rows being imported will become their children.

Importing PARENT Content: When -RELCHILD is appended to the end of the related content column header, then the results of the lucene query will be considered the child content and the rows being imported will become their parents.


Special Note: If no option is appended to the header when importing self-related content, the -RELPARENT becomes the default and the content being imported is considered the child of the content pulled by the lucene in the relationship column.