cancel
Showing results for 
Search instead for 
Did you mean: 

What is Cardinality?

Former Member
0 Kudos

Hi,

Can i know the difference in Cardinality and Selection.

There are altogether four different Combinations:

0..1,0..n,1..1 and 1..n.

So ,if anyone could explain me clearly about all these four Combinations it would be appreciated.

Also if i could know more about these properties it would be easier for me to work on different applications.

Thanks and regards,

Chandrashekar.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Chandrashekar,

The cardinality property is composed of a pair of values that control the maximum and minimum number of elements may contain at runtime. The cardinality property may have four possible values: • 0..1 Zero or one • 0..n Zero or more • 1..1 One and only one • 1..n One or more The first part of the cardinality describes the minimum number of element ’s element collection may contain. This value is either zero or one, and is stored as a Boolean value. This value can be obtained at runtime by calling the method node.getNodeInfo().isMandatory(). The second part of the cardinality describes the maximum number of elements ’s element collection may contain. This value is either a 1 or an n (meaning many) and is stored as a Boolean value (false = 1, true = n). This value can be obtained at runtime by calling method node.getNodeInfo().isMultiple(). If has a cardinality of 1..<something>, then it can be assumed that after the context has been initialised, there will be at least one element present in the node collection. This element is known as the default element and cannot be deleted!

If you attempt to perform some action on a node that would violate the constraints of the cardinality, then you will get a runtime exception in the context. E.G., trying to add a second element to a node of cardinality 0..1, or trying to delete the last element from a node of cardinality 1..n.

All nodes that have the context root node as their immediate parent are singleton nodes.

This is because the context root node has one and only one element.

regards

Sumit

Former Member
0 Kudos

Hi,

Context

The data used in the Web Dynpro component or in the view are stored in the context. Read-write access to this data is available using the controllers as a starting point.

Structure

The data from the contexts is managed in a hierarchical structure. Each context has a root node, underneath which the individual data fields (attributes) are stored in a tree structure. You create this tree structure according to the structure of your application.

Each node contains data fields that represent one of the following:

An individual instance of an object type

A table of instances.

This property of a node is known as its cardinality. The following table summarizes the possible cardinalities for a node:

Cardinality

Description

1:1

The node contains only one element instance, which is instantiated automatically.

0:1

The node contains only one element instance, which must not be instantiated.

1:n

The node can contain multiple element instances, of which at least one must always be instantiated (and is instantiated automatically).

0:n

The node can contain multiple element instances, of which none have to be instantiated.

Recursion Nodes

Dynamic node nesting is possible within a context, creating what is called a recursion node. The node that is used for recursion is always a predecessor of the new node. The newly created recursion node is a reference to a predecessor node and therefore cannot be processed separately. Instead it takes on the structure of the node to be repeated.

Regards

Ayyapparaj