Home Blog Web Experience Management: Basic Assets vs. Flex Assets
󰀄
Basic Assets vs. Flex Assets

In Oracle WebCenter Sites [Content Server], a piece of content [a.k.a. asset] can be one of 2 asset types: Basic or Flex. When building sites, you often have a “battle”, with yourself or others, on what type to use and when the right to use each is. So let’s take a look at the differences in these two…

Basic Asset Types

It all started with Basic assets. A flat structure built upon an Asset Descriptor File. The xml formatted file contains all custom attributes visible in the asset’s content entry form. For instance, consider the following Regions ADF:


<ASSET name=”Regions” description=”Regions” markertext=”*” processor=”5.0″  defdir=”c:\Shared\Storage\Regions” renderusingtemplate=”no” unnamedassociation=”YES”>
<PROPERTIES>
<PROPERTY name=”Country” description=”Country”>
<STORAGE type=”VARCHAR” LENGTH=”50″/>
<INPUTFORM required=”YES” type=”TEXT”  width=”25″ maxlength=”50″ instruction=” Country ” />
<SEARCHFORM required=”YES” type=”TEXT”  width=”25″ maxlength=”50″ instruction=”Country” />
<SEARCHRESULT include=”TRUE”/>
</PROPERTY>
<PROPERTY name=”City” description=”City”>
<STORAGE type=”VARCHAR” LENGTH=”50″/>
<INPUTFORM required=”YES” type=”TEXT”  width=”30″ maxlength=”50″ instruction=”City” />
<SEARCHFORM required=”YES” type=”TEXT”  width=”30″ maxlength=”50″ instruction=”City” />
<SEARCHRESULT include=”TRUE”/>
</PROPERTY>
<PROPERTY name=”RegionCode” description=”Region Code”>
<STORAGE type=”VARCHAR” LENGTH=”50″/>
<INPUTFORM required=”YES” type=”TEXT”  width=”35″ maxlength=”50″ instruction=”Region Code” />
<SEARCHFORM required=”YES” type=”TEXT”  width=”35″ maxlength=”50″ instruction=”Region Code ” />
<SEARCHRESULT include=”TRUE”/>
</PROPERTY>
</PROPERTIES>
</ASSET>


This will result in a content entry form with a combination of Content Server’s metadata attribute fields – name, description, Start Date, End Date, Category, Filename, Path, and Locale – followed by an ordered list of every ‘PROPERTY’ node specified in the Regions ADF – Country, City, and RegionCode.

Important: Basic asset types cannot be modified once created. The schema is fixed.

Instances of the Regions asset type will be created and stored in the database in a single table. Each column is an attribute field (metadata and custom). Each row is a Regions asset.

 

Flex Asset Types

Flat structures are counter-productive when it comes to e-commerce sites. Requirements often include parent/child relationships, attributes modifications, etc… As basic asset types have fixed schemas, flex asset types provide the flexibility to create attributes as individual assets, then bundle the attributes in definitions. Each Flex asset type essentially belongs to a family. Here are the members (or parts) of the family:

  • Content Attribute
  • Content Definition
  • Content
  • Parent Definition
  • Parent
  • Filter

The creation of each asset type subsequently builds multiple database tables:

  • <Name of Asset Type>
  • <Name of Asset Type>_Mungo
  • <Name of Asset Type>_Dim
  • <Name of Asset Type>_DimP
  • <Name of Asset Type>_Args
  • <Name of Asset Type>_Publish
  • <Name of Asset Type>_AMap
  • <Name of Asset Type>_RMap
  • <Name of Asset Type>_Extension
  • <Name of Asset Type>_Group
  • <Name of Asset Type>_TFilter
  • <Name of Asset Type>_TGroup
  • <Name of Asset Type>_TAttr

In future blogs, I will go through each table and analyze its contents and usability. But just mentioning here so that everyone is aware of what happens when we create Flex asset types. Let’s take a look at the Content family:

NOTE: Creating the F1Products family of flex asset types subsequently adds the set of tables, that were mentioned earlier, in the database for each asset type.

 

 

 

 

 

 

 

In order to create an instance of an asset type, content contributors need access to content entry forms. WebCenter Sites puts together a content entry form per asset type. Indeed upon creating the F1Products family, System CSElements and SQL codes were added to the ElementCatalog under OpenMarket/Xcelerate/AssetType/<Asset Type Name>:

System CSElements per Content Asset Type

The Search strategy is sustained by SQL statements stored under SystemSQL/OpenMarket/Xcelerate/AssetType/<Asset Type Name>:

System Query for a Content Asset Type

 

Basic Asset Types vs. Flex Asset Types

Already you might be doing the math. Each flex member of a family generates multiple tables. Whereas one basic asset type yields only one. And you are right. A basic asset will be retrieved much faster than a flex asset as each new instance/asset is a single row in the <Asset Type> database table. What would you gain with Flex assets might you ask?:

  1. The ability to create/delete/modify as many attributes as needed without deleting the asset type from WebCenter Sites.
  2. The flexibility in modifying the structure of your asset definitions on the fly.
  3. The capability of creating a folder-like structure parent/child relationship between your content and parent assets
  4. The ability to create multi-valued attributes and use attribute editors and filters for data manipulation.
  5. And more…

Basic assets should only be created for information that is very unlikely to change. The reason being that each PROPERTY in the xml file is an attribute that cannot be modified as the xml schema is fixed. If you want to rename an attribute or remove it from the asset type, you must delete the Asset type itself, which consequently deletes ALL of its instances (assets) from the system.

A good example for a basic asset type might be Location, ContactInformation, etc… It’s very unlikely that a contact’s “Address” or “Telephone Number” is named differently for the next ten years.

Clearly, if a developer is worried and concerned about the retrieval time of a flex asset, it is always a good idea to cache the resultset. In doing so, using a flex family instead of a basic asset type would not be as costly in terms of processing time.

Differences between Flex and Basic are not just structural, they’re also visible in the JSP tags used to manipulate the assets. For instance, the number one task that every newbie developer learns to implement is loading an asset. That task is accomplished in two different ways:

Load a Flex asset:

<assetset:setasset name=”myAsset” type=”F1Product_C” id=”123456789”/>

Load a Basic asset:

<asset:load name=”myBasicAsset” type=”Location” objectid=”987654321”/>

You’ve guessed it right. All tags starting with <assetset:….> are flex assets tags. The ones starting with <asset:…> are basic tags.

Creating a content as a basic asset or flex asset will depend on a number of requirement set by content contributors as well as developers. The latter must be able to deliver on the needs of Business. For developers the challenge is to understand and be able to explain the limitations of a basic asset type and the gains of aflex asset type combined with an appropriate caching strategy. A successful implementation might depend on your choices.

  1. avatar
    October 26, 2012

    This is a very company summary of how both models work, and that’s great! This summer I ran some performance tests at a large client. It turned out that there was indeed a significant performance difference between loading basic and flex data – about 300% different!

    However, it’s very important to understand the scale we’re taking about here. On modern hardware, running Oracle 11g database, that 300% was really measured in microseconds, not milliseconds, and none of the queries took over 2 ms to run – even search state queries.

    So yes, there’s a difference, but it’s important to assess the practical impact of this difference given your resources.

    Also, changing basic asset schemas is certainly more work than doing so for a flex asset, and importantly, it cannot be done at runtime. But during the development cycle it’s not that big a deal to update the ADF and alter the database schema.

    Look at the features of each as the primary driver for which type you choose. These days I usually prefer flex assets for most purposes, but always fall back on basic assets when I need to store any binary content, since binary content can be stored in the database with basic assets, and cannot be when using flex assets.

  2. avatar
    November 23, 2012

    This article is much much batter than Oracle docs. Kindly keep posting articles related to WebCenter Sites. I am new in Webcenter Sites.

    Regards,
    Shaheer Badar

  3. avatar
    May 24, 2013

    I agree with Shaher. Kindly post more covering the basics

Comments

Write a comment:

*

Your email address will not be published.

󰁓
󰀰 󰀩 󰀭 󰀎