This article is cross-posted from my personal blog.
In DotNetNuke version 5.3, we introduced the concept of a centralized Content store, together with the ability to apply Taxonomies (categories) to the content. We have extended this in DNN 5.4 by completing the MetaData API as well as adding Folksonomy (user tags).
In this series of blogs I will explain how developers can take advantage of these new features in their own extensions.
In the first blog in this series I covered the Taxonomy Manager and how an admin can use the new taxonomy features. Next I will review the Data Structue for these components
ContentItems
Figure 1 shows the ContentItems and ContentTypes tables.
Figure 1: The ContentItems and ContentTypes Tables
|
|
Most of the columns in the ContentItems Table are self-explanatory, but for completeness they are summarized below:
- ContentItemID – Primary Key Identity column
- ContentTypeID – Foreign Key to the ContentTypes Table
- TabID – The tab/page where the content belongs
- ModuleID – the module which “owns” the content
- Content – the content
- ContentKey – a key which uniquely identifies the Content Item
- Indexed – for future use when Search is integrated
- CreatedByUserID, CreatedOnDate, LastModifiedByUserID, LastModifiedOnDate – standard audit fields
The ContentTypes Table is a look-up table which defines various types of content – by default two types are defined – Tab/Page and Module. Module Developers are free to add their own Content Types – for example Blog Post or Forum Post.
MetaData
Each ContentItem can have many related items of MetaData (see Figure 2)
Figure 2: Content MetaData Tables
|
|
The MetaData table defines the types of MetaData, while the ContentItems_MetaData join table provides the many-to-many relationship, together with a value for the MetaData. By default DNN will define the 15 types of MetaData defined by the Dublin Core standard.
- Title
- Creator
- Subject
- Description
- Publisher
- Contributor
- Date
- Type
- Format
- Identifier
- Source
- Language
- Relation
- Coverage
- Rights
However, the API supports the addition of other MetaData types. It should be noted that their is no restriction in the number of each MetaData item. For example a piece of content could have 3 Sources or a Creator and multiple Contributors.
Vocabularies and Terms
In addition to defining MetaData for a piece of content, we have added support for a rich taxonomy/folksonomy. Taxonomy is defined as “the practice and science of classification” – Wikipedia, while Folksonomy is defined as “collaborative tagging” – Wikipedia.
Usually, taxonomy refers to the practice of using hierarchical categories applied to the content by a “content editor”, while folksonomy refers to the practice of free-form tagging of content by users.
In DotNetNuke, while we expose both of these at the presentation layer, in the API and Data Layer they are implemented using a common data structure.
Figure 3: Vocabularies and Terms Tables
|
|
(Click on the image to see a larger version)
In DNN you can create multiple Vocabularies. A Vocabulary is a collection of terms that relate to each other. For example we could define a Vocabulary of Electronics terms or a Vocabulary of Colors. Let’s first look at the columns defined in the Vocabularies Table
- VocabularyID – Primary Key Identity column
- VocabularyTypeID – Foreign Key to the VocabularyTypes table – this defines the types of vocabulary – we currently support two types a hierarchical Vocabulary and a simple (or flat) Vocabulary.
- Name – the Name of the Vocabulary
- Description – a Description for the Vocabulary
- Weight – unused – but is intended to provide a mechanism to sort the Vocabularies
- ScopeTypeID – A Foreign Key to the ScopeTypes table – this defines a scope for the vocabulary – we currently support two scopes – Application and Portal/Site
- ScopeID – Used in conjunction with the ScopeTypeID – if the scope type is “Portal” this will be the PortalID for which this vocabulary is scoped
- IsSystem – a flag which identifies this vocabulary as a “System” Vocabulary – one which cannot be deleted.
- CreatedByUserID, CreatedOnDate, LastModifiedByUserID, LastModifiedOnDate – standard audit fields
For the Terms Table we have the following columns.
- TermID – Primary Key Identity column
- VocabularyID – Foreign Key to “parent” Vocabulary table
- ParentTermID – Parent Term in hierarchical Vocabularies
- Name – the Name of the Term
- Description – a Description for the Term
- Weight – unused – but is intended to provide a mechanism to sort the Terms
- TermLeft, TermRight – used in the “Nested-Set” method of storing a heirarchical structure in a flat table – more in a future blog.
- CreatedByUserID, CreatedOnDate, LastModifiedByUserID, LastModifiedOnDate – standard audit fields
DNN 5.4 adds a new System Vocabulary called Tags. This Vocabulary is where the user-entered tags (folksonomy) are stored.
This blog is an overview of the Data Structure of the Content/Taxonomy features. In the next blog I will go into detail on the “Nested Set” design used for the storage of hierarchical terms in the flat Terms table.