Multiple Local Attributes

You can manage local attributes with the same name defined on multiple interfaces on the same object/relationship instance. The objects/relationships can also have a global or local attribute with the same attribute name.

This page discusses:

Interfaces for Attributes

You can add an interface to a business object if the business object hierarchy has a local attribute with the same name as one of the interface attributes as shown in the following MQL session. The naming convention for the local attributes, I1.a1, denotes the local attribute a1 belonging to interface I1.

MQL<35>add type T1;
MQL<36>add attribute a1 type string default a1-def-value;
MQL<37>mod type T1 add attribute a1;
MQL<38>add interface I1 type T1;
MQL<39>add attribute a1 type string owner interface I1 default I1-a1-def-value;
MQL<40>add bus T1 test 0 vault unit1 policy simple-u;
MQL<41>mod bus T1 test 0 add interface I1;
MQL<42>print bus T1 test 0 select attribute;
business object T1 test 0
		attribute = a1
		attribute = I1.a1
MQL<43>print bus T1 test 0 select attribute.value;
business object T1 test 0
		attribute[a1].value = a1-def-value
		attribute[a1].value = I1-a1-def-value
MQL<44>print bus T1 test 0 select attribute[a1];
business object T1 test 0 
		attribute[a1] = I1-a1-def-value 
		attribute[a1] = a1-def-value 
MQL<45>print bus T1 test 0 select attribute[*a1];
business object T1 test 0  
		attribute[a1] = I1-a1-def-value
		attribute[a1] = a1-def-value
MQL<46>print bus T1 test 0 select attribute[I1.a1];
business object T1 test 0
		attribute[a1] = I1-a1-def-value

You can add two interfaces on a business object if both interfaces owned a local attribute with the same name, as shown in the following MQL trace:

MQL<28>add type T1;
MQL<29>add interface I1 type T1;
MQL<30>add interface I2 type T1;
MQL<31>add attribute a1 type string owner interface I1 default I1-a1-def-value;
MQL<32>add attribute a1 type string owner interface I2 default I2-a1-def-value; 
MQL<33>add bus T1 test 0 policy simple-u vault unit1;
MQL<34>mod bus T1 test 0 add interface I1;
MQL<35>mod bus T1 test 0 add interface I2;
MQL<36>print bus T1 test 0 select attribute;
business object T1 test 0 
		attribute = I1.a1 
		attribute = I2.a1 
MQL<37>print bus T1 test 0 select attribute.value; 
business object T1 test 0 
		attribute[a1].value = I1-a1-def-value 
		attribute[a1].value = I2-a1-def-value 
MQL<38>print bus T1 test 0 select attribute[a1]; 
business object T1 test 0 
		attribute[a1] = I2-a1-def-value 
		attribute[a1] = I1-a1-def-value 
MQL<39>print bus T1 test 0 select attribute[*a1]; 
business object T1 test 0 
		attribute[a1] = I2-a1-def-value 
		attribute[a1] = I1-a1-def-value 
MQL<40>print bus T1 test 0 select attribute[I1.a1]; 
business object T1 test 0 
		attribute[a1] = I1-a1-def-value 
MQL<41>print bus T1 test 0 select attribute[I2.a1]; 
business object T1 test 0 
		attribute[a1] = I2-a1-def-value

Attribute Names

A fully qualified name includes both the object name and the attribute name, using the format ADMIN.ATTRIBUTE. An unqualified name includes the attribute name only. The only time the fully qualified name of an attribute is used is when select attribute is specified. Otherwise, the display name is always the unqualified attribute name. This enables multiple attributes to have the same name, because when the names are displayed fully qualified (such as T1.a1), they do not appear to have the same name.

No matter how the selectable is written (attribute[X] where x = I1.a1 , I2.a1 , a1 ,and so on), the returned attribute is always the simple/common attribute name. The correct value is always returned if you select using the fully qualified local attribute name (ADMIN.ATTRIBUTE, for example, T1.a1 ). For example:

MQL<219>print bus tp1 test2 1 select attribute[i1.*];
business object tp1 test2 1
		attribute[i1.a1] = 3DPLM 
MQL<220>print bus tp1 test2 1 select attribute[].value;
business object tp1 test 2 1
		attribute[tp1.a1].value = 3DPLM
 	attribute[a1].value = geo
		attribute[i1.a1].value = 3DPLM
MQL<221>print bus tp1 test2 1 select attribute[a1];
business object tp1 test2 1 
attribute[tp1.a1] = 3DPLM 
attribute[i1.a1] = 3DPLM 
attribute[a1] = geo 

You cannot select only local attributes. For example, specifying attribute[*.a1] returns an error:

MQL<55>print bus T1 test 0 select attribute[*.a1]; 
Error: #1900068: print business object failed 
Error: #1500063: Unknown field name attribute[*.a1]

You can use * to match all global and local attributes matching a pattern, for example:

MQL<4>add type k1;
MQL<5>add interface k1 type k1;
MQL<6>add attribute ak1 type string owner interface k1;
MQL<7>add interface k2 type k1;
MQL<8>add attribute ak1 type string owner interface k2;
MQL<9>add attribute ak1 type string;
MQL<10>mod type k1 add attribute ak1;
MQL<11>add bus k1 test 0 vault unit1 policy simple-u;
MQL<12>mod bus k1 test 0 add interface k1 add interface k1 add interface k2; 
MQL<13>print bus k1 test 0 select attribute [*k1];
business object k1 test 0
		attribute[k2.ak1] = 
		attribute[ak1] = 
		attribute[k1.ak1] = 

Patterns for Attribute Names in Temp Query Bus Where Clause

When a pattern is provided for an attribute name in a temp query bus where clause, the pattern is resolved against all attributes, not just attributes available for specific objects. This can result in unsupported criteria when using local attributes. For example, in a database with attributes of different derivations of names beginning with 't', the following occurs:

MQL<43>add attr t3 type integer;
MQL<44>add attr t4 type string;
MQL<45>list attr t*;
t3
t4 
MQL<46>add type typ1 attr t4;
MQL<47>add policy pol1 type typ1 state s1;
MQL<48>add bus typ1 aaa 1 policy pol1 vault v1 t4 abc;
MQL<49>temp query bus typ1 * * where 'attribute[t*] ~~ "*b*"'; 
Warning: #1500802: Different attribute types are found in expanded attribute list