Attribute Relationships: Settings and Properties

Thursday Jan 22nd 2009 by William Pearson
Share:

Bill Pearson continues his overview of Attribute Relationships within his extended examination of the dimensional model within the integrated Microsoft Business Intelligence solution. In this article, we begin a hands-on overview of the properties underlying attribute relationships, along with a review of the respective settings associated with each property.

This article continues the overview of Attribute Relationships in Analysis Services begun in Introduction to Attribute Relationships in MSSQL Server Analysis Services. Both this article and its predecessor extend the examination of the dimensional model that we began in Dimensional Model Components: Dimensions Parts I and II. After taking up various additional components of the dimensional model in subsequent articles, we performed hands-on exploration of the general characteristics and purposes of attributes in Dimensional Attributes: Introduction and Overview Parts I through V. We then fixed our focus upon the properties underlying attributes, based upon the examination of a representative attribute within our sample cube., extending our overview into attribute member Keys, Names and Values. This article continues the focus upon attribute relationships, which define the possible associations between attributes, including a discussion surrounding why these relationships are important, and how they define the properties of association that a given attribute has with other attributes. Our concentration here will be the performance of a detailed examination of the properties underlying attribute relationships, along with a review of the respective settings associated with each property, based upon a representative dimension attribute within our sample UDM.

Note: For more information about my Introduction to MSSQL Server Analysis Services column in general, see the section entitled “About the MSSQL Server Analysis Services Series” that follows the conclusion of this article.

Introduction

In Introduction to Attribute Relationships in MSSQL Server Analysis Services, I summarized the articles preceding it within the current subseries surrounding a general introduction to the dimensional model. I noted the wide acceptance of the dimensional model as the preferred structure for presenting quantitative and other organizational data to information consumers. The articles of the series then undertook an examination of dimensions, the analytical “perspectives” upon which the dimensional model relies in meeting the primary objectives of business intelligence, including its capacity to support:

  • the presentation of relevant and accurate information representing business operations and events;
  • the rapid and accurate return of query results;
  • “slice and dice” query creation and modification;
  • an environment wherein information consumers can pose questions quickly and easily, and achieve rapid results datasets.

We extended our examination of dimensions into several detailed articles. These articles are comprised of Dimensional Model Components: Dimensions Parts I and II, wherein we emphasized that dimensions, which represent the perspectives of a business or other operation, and reflect the intuitive ways that information consumers need to query and view data, form the foundation of the dimensional model. We noted that each dimension within our model contains one or more hierarchies. (As we learn in other articles of this series, two types of hierarchies exist within Analysis Services: attribute hierarchies and user - sometimes called “multi-level” - hierarchies.)

We next introduced dimension attributes within the subseries, and conducted an extensive overview of their nature, properties, and detailed settings in Dimensional Attributes: Introduction and Overview Parts I through V. We noted that attributes help us to define with specificity what dimensions cannot define by themselves. Moreover, we learned that attributes are collected within a database dimension, where we can access them to help us to specify the coordinates required to define cube space.

Throughout the current subseries, I have emphasized that dimensions and dimension attributes should support the way that management and information consumers of a given organization describe the events and results of the business operations of the entity. Because we maintain dimension and related attribute information within the database underlying our Analysis Services implementation, we can support business intelligence for our clients and employers even when these details are not captured within the system where transaction processing takes place. Within the analysis and reporting capabilities we supply in this manner, dimensions and attributes are useful for aggregation, filtering, labeling, and other purposes.

Having covered the general characteristics and purposes of attributes in Dimensional Attributes: Introduction and Overview Parts I through V, we fixed our focus upon the properties underlying them, based upon the examination of representative attributes within our sample cube. We then continued our extended examination of attributes to yet another important component we had touched upon earlier, the attribute member Key, with which we gained some hands-on exposure in practice sessions that followed our coverage of the concepts. In Attribute Member Keys – Pt I: Introduction and Simple Keys and Attribute Member Keys – Pt II: Composite Keys, we introduced attribute member Keys in detail, continuing our recent group of articles focusing upon dimensional model components, with an objective of discussing the associated concepts, and of providing hands-on exposure to the properties supporting them. We first discussed the three attribute usage types that we can define within a containing dimension. We then narrowed our focus to the Key attribute usage type (a focus that we developed, as we have noted, throughout Attribute Member Keys – Pt I: Introduction and Simple Keys and Attribute Member Keys – Pt II: Composite Keys), discussing its role in meeting our business intelligence needs. We next undertook a discussion of the nature and uses of the attribute Key from a technical perspective, including its purpose within a containing dimension in Analysis Services.

In Attribute Member Keys – Pt I: Introduction and Simple Keys and Attribute Member Keys – Pt II: Composite Keys, we explored the concepts of simple and composite keys, narrowing our examination in Part I to the former, where we reviewed the Properties associated with a simple key, based upon the examination of a representative dimension attribute within our sample UDM. In Part II, we revisited the differences between simple and composite keys, and explained in more detail why composite keys are sometimes required to uniquely identify attribute members. We then reviewed the properties associated with a composite key, based upon the examination of a representative dimension attribute within our sample UDM.

In Attribute Member Names, we examined the attribute member Name property, which we had briefly introduced in Dimensional Attributes: Introduction and Overview Part V. We examined the details of the attribute member Name property, and shed some light on how attribute member Name might most appropriately be used without degrading system performance or creating other unexpected or undesirable results. Finally, we examined the “sister” attribute member Value property (which we introduced along with attribute member Name in Dimensional Attributes: Introduction and Overview Part V) in Attribute Member Values in Analysis Services. As we did in our overview of attribute member Name, we examined the details of Value. Our concentration was also similarly upon its appropriate use in providing support for the selection and delivery of enterprise data in a more focused and consumer-friendly manner, without the unwanted effects of system performance degradation, and other unexpected or undesirable results, that can accompany the uninformed use of the property.

Finally, in our last article, Introduction to Attribute Relationships in MSSQL Server Analysis Services, we introduced another part of the conceptual model, Attribute Relationships. In this overview, we discussed several best practices and design, among other, considerations involved in the use of attribute relationships. Our focus was upon the general exploitation of attribute relationships in providing support for the selection and delivery of enterprise data.

We will continue our exploration of attribute relationships in this article, where we will examine attribute relationships in a more detailed manner, similar to the way we treated the subject matter in previous articles within this subseries. We will concentrate in detail upon the properties and settings that underlie them.

Our examination will include:

  • A review of the nature of the attribute relationship, and its possible roles in helping to meet the primary objectives of business intelligence, based upon and extending the discussion we initiated in Introduction to Attribute Relationships in MSSQL Server Analysis Services;
  • A detailed examination of the properties underlying attribute relationships, along with a review of the respective settings associated with each property, based upon the attributes of a representative dimension within our sample UDM;
  • Hands-on practice in creating, modifying and deleting attribute relationships for several attributes within a representative dimension of our sample UDM;
  • A look forward to the article that follows within our series, where we will continue our detailed examination of the properties underlying attribute relationships, along with a review of the respective settings associated with each property, based upon the attributes of additional representative dimensions within our sample UDM.

Attribute Relationships

As we have learned, attributes serve as the foundation for our dimensions and cubes. Moreover, in Analysis Services 2005, attributes within a dimension are always related either directly or indirectly to the key attribute. Assuming the definition of a dimension based upon a star schema, where all dimension attributes are derived from the same relational table, an attribute relationship is automatically defined between the key attribute and each non-key attribute of the dimension. Alternatively, if we assume the definition of a dimension based upon a snowflake schema, where dimension attributes are derived from multiple related tables, Analysis Services automatically defines an attribute relationship in the following manner:

  • Between the key attribute and each non-key attribute associated with columns in the main dimension table;
  • Between the key attribute and the attribute associated with the foreign key in the secondary table that links the underlying dimension tables;
  • Between the attribute associated with the foreign key in the secondary table and each non-key attribute associated with columns from the secondary table.

As we noted in Introduction to Attribute Relationships in MSSQL Server Analysis Services, there are a number of reasons to change the assigned default attribute relationships. For example, we might want to define a natural hierarchy, a custom sort order, or dimension granularity based on a non-key attribute (we focus upon these activities in other articles of this series). We might also want to performance tune the default relationships to optimize processing in general.

Relationships representing natural hierarchies are enforced by creating an attribute relationship between the attribute for a level and the attribute for the level below it. For Analysis Services, this specifies a natural relationship and potential aggregation. In the Customer dimension of the sample Adventure Works UDM, a natural hierarchy exists for the Country, State-Province, City, Postal Code, and Customer attributes. The natural hierarchy for {Country, State-Province, City, Postal Code, Customer} has been established through the addition of the following attribute relationships:

  • The Country attribute as an attribute relationship to the State-Province attribute;
  • The State-Province attribute as an attribute relationship to the City attribute;
  • The City attribute as an attribute relationship to the Postal Code attribute.

We will see construct relationships within the UDM as part of the practice session that follows.

As we have noted in other articles of this series, we can also create a user-defined hierarchy that does not represent a natural hierarchy in the data (this is called an ad hoc or reporting hierarchy), for purposes of navigating data in the cube. For example, we could create a user-defined hierarchy based on Customer {Education, Gender}. Information consumers of the data would see no difference in how the two hierarchies behave, although the natural hierarchy benefits from aggregating and indexing structures — invisible to the consumer — that account for the natural relationships in the source data.

The attribute relationship, as we have learned, defines the possible associations that exist between attributes within a given dimension. In doing so, the attribute relationship affects virtually all functions of Analysis Services. The attribute relationship defines the properties of association that exist (including whether another attribute can be accessed via the given attribute) between a given attribute and another attribute. (A given attribute is treated as a member property of the “current” attribute when it can be accessed via the “current” attribute – hence the relatively common reference to a related attribute as a “member property” in much of the documentation and other literature.)

We will gain hands - on exposure to attribute relationship properties and settings in the practice session that follows. Before we get started working within a sample cube clone, we will need to prepare the local environment for the practice session. We will take steps to accomplish this within the section that follows.

Preparation: Locate and Open the Sample Basic UDM Created Earlier

In Dimensional Model Components: Dimensions Part I, we created a sample basic Analysis Services database within which to perform the steps of the practice sessions we set out to undertake in the various articles of this subseries. Once we had ascertained that the new practice database appeared to be in place, and once we had renamed it to ANSYS065_Basic AS DB, we began our examination of dimension properties. We continued with our examination of attributes within the same practice environment, which we will now access (as we did within the earlier articles of this subseries)) by taking the following steps within the SQL Server Business Intelligence Development Studio.

NOTE: Please access the Analysis Services database which we prepared in Dimensional Model Components: Dimensions Part I (and have used in subsequent articles) before proceeding with this article. If you have not completed the preparation to which I refer, or if you cannot locate / access the Analysis Services database with which we worked in the referenced previous articles, please consider taking the preparation steps provided in Dimensional Model Components: Dimensions Part I before continuing, and prospectively saving the objects with which you work, so as to avoid the need to repeat the preparation process we have already undertaken for subsequent related articles within this subseries.

1.  Click Start.

2.  Navigate to, and click, the SQL Server Business Intelligence Development Studio, as appropriate.

We briefly see a splash page that lists the components installed on the PC, and then Visual Studio .NET 2005 opens at the Start page.

3.  Close the Start page, if desired.

4.  Select File -> Open from the main menu.

5.  Click Analysis Services Database ... from the cascading menu, as shown in Illustration 1.

Opening the Analysis Services Database
Illustration 1: Opening the Analysis Services Database ...

The Connect to Database dialog appears.

6.  Ensuring that the Connect to existing database radio button atop the dialog is selected, type the Analysis Server name into the Server input box (also near the top of the dialog).

7.  Using the selector just beneath, labeled Database, select ANSYS065_Basic AS DB, as depicted in Illustration 2.

Selecting the Basic Analysis Services Database ...
Illustration 2: Selecting the Basic Analysis Services Database ...

8.  Leaving other settings on the dialog at default, click OK.

SQL Server Business Intelligence Development Studio briefly reads the database from the Analysis Server, and then we see the Solution Explorer populated with the database objects. Having overviewed the properties of dimension attributes in previous articles, we will now get some hands-on exposure to attribute relationships for attributes of a representative dimension within our practice UDM.

Procedure: Define Attribute Relationships and Examine Attribute Relationship Property Settings in Analysis Services 2005

In the practice procedures that follow, we will select and examine a representative dimension within the sample cube, and then focus upon the attribute relationship property settings that reference select dimension attributes. We will perform our practice sessions within the SQL Server Business Intelligence Development Studio, from which we will examine the attribute relationship property settings within our Analysis Services database, ANSYS065_Basic AS DB.

In Dimensional Model Components: Dimensions Part I and II, and Dimensional Attributes: Introduction and Overview Parts I through V, respectively, we overviewed the properties underpinning Database and Cube dimensions, and then examined the properties supporting dimension attributes. In Attribute Member Keys – Pt I: Introduction and Simple Keys, and in Attribute Member Keys – Pt II: Composite Keys we focused upon those properties for a simple attribute key and a composite attribute key, respectively. Just as we did for the respective subject matter objects in those articles, we will examine the detailed settings for representative attribute relationships here.

As I noted earlier, we can organize attribute hierarchies into levels within user hierarchies to provide navigation paths for users in a cube. A user hierarchy can represent a natural hierarchy, such as city, state, and country, (as we shall see in our practice session) or can simply represent a navigation path that fits a local business scenario, such as employee name, title, and department name. Moreover, as we also mentioned earlier, to the information consumer navigating a hierarchy, these two types of user hierarchies are identical.

As a part of my discussion in Introduction to Attribute Relationships in MSSQL Server Analysis Services, I stated that, with a natural hierarchy, if we define attribute relationships between the attributes that make up the levels, Analysis Services can use an aggregation from one attribute to obtain the results from a related attribute. If there are no defined relationships between attributes, Analysis Services will aggregate all non-key attributes from the key attribute.

Let’s get some hands-on exposure with defining attribute relationships for the attributes in a natural user hierarchy that exists within our basic UDM. Within our practice session we will work within the Customer Geography (natural) hierarchy of the Customer dimension.

Define Attribute Relationships for Attributes in the Customer Geography Hierarchy

We will begin our practice with attribute relationships within the Customer Geography hierarchy of the Customer dimension.

1.  Within the Solution Explorer, right-click the Customer dimension (expand the Dimensions folder as necessary).

2.  Click Open on the context menu that appears, as shown in Illustration 3.

Opening the Dimension via the Dimension Designer ...
Illustration 3: Opening the Dimension via the Dimension Designer ...

The tabs of the Dimension Designer open.

3.  Click the Dimension Structure tab, if we have not already arrived there by default.

The attributes belonging to the Customer dimension appear as depicted in Illustration 4.

The Member Attributes, Customer Dimension
Illustration 4: The Member Attributes, Customer Dimension

We note that twenty attributes appear within the Attributes pane. We will get some exposure to attribute relationships, by adding / examining representative relationships among the attributes we see here.

We can also see, within the Hierarchies and Levels pane, four levels in the Customer Geography user hierarchy. This hierarchy currently exists simply as a drill down path for information consumers, and appears as shown in Illustration 5.

Hierarchies and Levels Pane, Customer Dimension
Illustration 5: Hierarchies and Levels Pane, Customer Dimension

4.  In the Attributes pane, expand the Geography attribute by clicking the “+” sign to its immediate left.

We note that four member properties link the non-key attributes from the Geography table to the key attribute from the Geography table, as depicted in Illustration 6.

Member Properties Linking Non-Key Attributes to Key Attribute
Illustration 6: Member Properties Linking Non-Key Attributes to Key Attribute

5.  In the Attributes pane, expand the Full Name attribute.

We see that the Geography attribute is related to the Full Name attribute. We also note that the Postal Code attribute is indirectly related to the Full Name attribute through the Geography attribute, because Postal Code is linked to the Geography attribute and the Geography attribute is linked to the Full Name attribute. These relationships are circled in Illustration 7.

Initial Indirect Relationship between the Geography and Full Name Attributes
Illustration 7: Initial Indirect Relationship between the Geography and Full Name Attributes

6.  Drag the Postal Code attribute from the Geography attribute to the <new attribute relationship> placeholder for the Full Name attribute, as shown in Illustration 8.

Making the Postal Code Attribute Directly Related to the Full Name Attribute
Illustration 8: Making the Postal Code Attribute Directly Related to the Full Name Attribute

The Postal Code attribute is now directly related to the Full Name attribute.

In the Properties window (which appears for the highlighted Postal Code attribute, by default in the right bottom corner of the design environment), we can observe that the RelationshipType property for this attribute is set to Flexible. This is appropriate because the relationship between a customer and a postal code may change over time.

The RelationshipType property defines rules for the modification of the key value of the members of the related, dependent attribute (in our example, the Full Name attribute is the current attribute, whereas the Postal Code attribute is the related attribute). When we define an attribute relationship, we use the RelationshipType property to specify that the relationship is one of the following types:

  • Rigid: The key values of the related attribute and the current attribute have a fixed association, and cannot change without a full reprocessing of the dimension.
  • Flexible: The key of the related, dependent attribute, and therefore the entire member of the dependent attribute, can be changed anytime. In our example above, the Postal Code attribute is dependent upon the Full Name (Customer) attribute with a Flexible relationship, since the postal code can change anytime a customer moves to another location.

If we define a relationship as Rigid, Analysis Services retains aggregations when the dimension is updated. If a relationship that is defined as Rigid actually changes, Analysis Services generates an error during processing unless the dimension is fully processed. Specifying the appropriate relationships and relationship properties increases query and processing performance, as we noted in Introduction to Attribute Relationships in MSSQL Server Analysis Services.

We noted that the RelationshipType property in our example is set to Flexible: The key of the related, dependent attribute, and therefore the entire member of the dependent attribute, can be changed anytime. In our example above, the Postal Code attribute is dependent upon the Full Name (Customer) attribute with a Flexible relationship, since the postal code can change anytime a customer moves.

While we will not make modifications here, we also see that the Cardinality setting for the Postal Code attribute relationship is set to Many. Cardinality defines the nature of the relationship of the key of related attributes (and their members) when those members are used as member properties of the current attribute (and its members). The Cardinality setting can have one of two possible values:

  • One (One – to – One): One, and only one, member of the current attribute is associated with each member of the related attribute. For example, if we were associating the full names of customers with a social security, or other “unique” identifying code (this attribute does not exist in the example UDM – I am only using it as an illustration here), we would have a one – to – one relationship.
  • Many (One – to – Many): A given member of a related attribute can be associated with multiple members of the current attribute. Needless to say, one – to – many relationships occur far more often in Analysis Services than one – to – one relationships.

Finally, we can see that the Visible setting for the Postal Code attribute relationship is set to True. The Visible setting specifies whether the related attribute is accessible, as a member property of the current member, to the information consumer. The Visible setting can have either of two possible values:

  • False: The related attribute is not visible to the information consumer, and therefore cannot be used as a member property of the current member.
  • True: The related attribute is visible to, and can be accessed by, the information consumer as a member property of the current member.

For purposes of our immediate example, we will leave the Visible property as its current setting of True. The Properties window for the Postal Code attribute relationship appears as depicted in Illustration 9.

Properties Window for the Postal Code Attribute Relationship
Illustration 9: Properties Window for the Postal Code Attribute Relationship

7.  In the Attributes pane, expand the Postal Code attribute.

The City attribute is currently related to the Postal Code attribute through the Geography attribute, rather than being directly related. We will next directly relate the City attribute to the Postal Code attribute.

8.  Drag the City attribute relationship from the Geography attribute to the <new attribute relationship> placeholder for the Postal Code attribute.

The City attribute is now directly related to the Postal Code attribute. In the Properties window, we note, as we did for the Postal Code attribute earlier, that the RelationshipType property for this attribute is set to Flexible. This is appropriate because the relationship between a city and a postal code may change over time.

9.  In the Attributes pane, expand City.

The State-Province attribute is currently (indirectly) related to the City attribute through the Full Name and Geography attributes, hence we do not presently see the State-Province attribute under City.

10.  Drag the State-Province Name attribute relationship from the Geography attribute to the <new attribute relationship> placeholder for the City attribute.

The value of the RelationshipType property for the State-Province attribute relationship should be set to Rigid because the relationship between a city and a state does not change over time.

11.  With the newly placed State Province Name attribute highlighted, change the value of the RelationshipType property for State-Province attribute relationship, from its default setting of “Flexible,” to “Rigid,” in the Properties window, as shown in Illustration 10.

Modify the RelationshipType Property to “Rigid”
Illustration 10: Modify the RelationshipType Property to “Rigid”

12.  In the Attributes pane, expand the State-Province attribute.

13.  Drag the Country-Region attribute relationship from the Geography attribute to the <new attribute relationship> placeholder for the State-Province attribute.

The value of the RelationshipType property of the Country Region attribute relationship should be set to Rigid because the relationship between a state-province and a country-region does not change over time.

14.  With the newly placed Country Region attribute highlighted, change the value of the RelationshipType property for Country Region attribute relationship, from its default setting of “Flexible” to “Rigid” in the Properties window.

Because we have, in the foregoing steps, moved all the attribute relationships from the Geography attribute to other attributes, instead of creating new attribute relationships for each of those attributes, there is no reason for retaining the now-empty Geography attribute.

NOTE: As we discussed in Introduction to Attribute Relationships in MSSQL Server Analysis Services, we generally assist in aggregation design and improve query performance by defining the most direct relationships within our models.

15.  In the Attributes pane, right-click the Geography attribute.

16.  Select Delete from the context menu that appears, as depicted in Illustration 11.

Delete the Now-empty Geography Attribute
Illustration 11: Delete the Now-empty Geography Attribute

This will conclude the first half of our work with attribute relationships. We will continue our practice with these important relationships within the next article of this series.

NOTE: Please consider saving the project we have created to this point for use in subsequent related articles of this subseries, so as to avoid the need to repeat the preparation process we have undertaken initially, to provide a practice environment.

1.  Select File -> Save All to save our work, up to this point, within the originally chosen location, where it can be easily accessed for our activities within other articles of this subseries.

2.  Click Yes when prompted, via the Visual Studio message box that appears next, to reprocess the affected cube objects.

3.  Click Run on the Process Object(s) dialog box that appears next, as shown in Illustration 12.

Click Run to Process Affected Objects ...
Illustration 12: Click Run to Process Affected Objects ...

Processing begins, and we see completion of the various steps via the Process Progress viewer. We see a “Process Succeeded” message in the Status bar at the bottom of the viewer, once processing is complete, as depicted in Illustration 13.

“Process Succeeded”
Illustration 13: “Process Succeeded”

4.  Click Close to dismiss the Process Progress viewer.

5.  Click Close to dismiss the Process Object(s) dialog box.

6.  Select File -> Exit to leave the design environment, when ready, and to close the Business Intelligence Development Studio.

Conclusion

In this article, we continued our exploration of attribute relationships, stating that our objective would be to complement the introduction we undertook in Introduction to Attribute Relationships in MSSQL Server Analysis Services, through a more detailed examination of attribute relationships. Our concentration upon these details was enhanced by a hands-on practice session, where we gained exposure to the properties and settings that underlie attribute relationships.

Our examination included a review of the nature of the attribute relationship in Analysis Services, and its possible roles in helping to meet the primary objectives of business intelligence, based upon and extending the discussion we initiated in Introduction to Attribute Relationships in MSSQL Server Analysis Services. We performed a detailed examination of the properties underlying attribute relationships, along with a review of the respective settings associated with each property, based upon a representative dimension attribute within our sample UDM, as a part of our practice session. (We stated that we would gain further hands-on practice, working with attribute relationships within additional dimensions, in the article that follows this one.) Throughout our practice procedures we obtained hands-on exposure to creating, modifying and deleting attribute relationships within a select dimension attribute within our sample UDM.

About the MSSQL Server Analysis Services Series

This article is a member of the series Introduction to MSSQL Server Analysis Services. The series is designed to provide hands-on application of the fundamentals of MS SQL Server Analysis Services (“Analysis Services”), with each installment progressively presenting features and techniques designed to meet specific real-world needs. For more information on the series, please see my initial article, Creating Our First Cube. For the software components, samples and tools needed to complete the hands-on portions of this article, see Usage-Based Optimization in Analysis Services 2005, another article within this series.

» See All Articles by Columnist William E. Pearson, III

Discuss this article in the MSSQL Server 2000 Analysis Services and MDX Topics Forum.

Share:
Home
Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved