Saturday 16 February 2013

Cardinalities in Cognos framework

Hi Guys,

Below is note on cardinalities .I have taken the content from IBM cognos helpguide .You can find the same in cognos framework userguide .Just noting down point for my reference .

taken from IBM

IBM helpguide Link

Cardinality in Generated Queries

IBM Cognos 8 supports both minimum-maximum cardinality and optional cardinality.
In 0:10 is the minimum cardinality, 1 is the maximum cardinality.
In 1:n , 1 is the minimum cardinality, n is the maximum cardinality.
A relationship with cardinality specified as 1:1 to 1:n is commonly referred to as 1 to n when focusing on the maximum cardinalities.

Note --- so 0:1 to 1:n is also read as 1 to n

A minimum cardinality of 0 indicates that the relationship is optional. You specify a minimum cardinality of 0 if you want the query to retain the information on the other side of the relationship in the absence of a match. For example, a relationship between customer and actual sales may be specified as1:1 to 0:n. This indicates that reports will show the requested customer information even though there may not be any sales data present.
Therefore a 1 to n relationship can also be specified as:
  • 0:1 to 0:n
  • 0:1 to 1:n
  • 1:1 to 0:n
  • 1:1 to 1:n
Use the Relationship impact statement in the Relationship Definition dialog box to help you understand cardinality. For example, Sales Staff (1:1) is joined to Orders (0:n).

It is important to ensure that the cardinality is correctly captured in the model because it determines the detection of fact query subjects and it is used to avoid double-counting factual data.
When generating queries, IBM Cognos 8 follows these basic rules to apply cardinality:
  • Cardinality is applied in the context of a query.
  • 1 to cardinality implies fact data on the n side and implies dimension data on the 1 side.
  • A query subject may behave as a fact query subject or as a dimensional query subject, depending on the relationships that are required to answer a particular query.


    Possible end labels are
    • 0..1 (zero or one match)
    • 1..1 (exactly one match)
    • 0..n (zero or more matches)
    • 1..n (one or more matches)
    The first part of the notation specifies the type of join for this relationship:
    • an inner join (1)
      An inner join shows all matching rows from both objects.
    • an outer join (0)
      An outer join shows everything from both objects, including the items that do not match. An outer join can be qualified as full, left, or right. Left and right outer joins take everything from the left or right side of the relationship respectively and only what matches from the other side.

      Example

      Cardinalities are set according to reporting needs and are not necessarily based on data .Consider below example .Which will require a full outer join.

      Consider example of sold date and product .there might be dates when no product were sold and there can be product which were never sold .so the cardinality shoud be 0:n :0:n (Full outer join)

      but in actual case we want to see only products that were sold so we have 1:1 to 1:n we can also model it to outer join 0:n to 1:n base on requirement 

No comments:

Post a Comment