[udm-dev] Problems with GetAdjacentObjects()

Attila Vizhanyo viza at isis.vanderbilt.edu
Tue Sep 6 14:57:31 CDT 2005


Hello Endre,

We plan to add a new feature to GReAT, to support the specification of
association patterns with no role names, the semantics of which are
defined as follows:
- if pattern objects of TypeA and of TypeB are connected with an
association with no role names, then find all associations between the
matched host objects
- if pattern objects of TypeA and of TypeB are connected with a
three-legged association with no role names,  then find all associations
between the matched host objects that are connected through the
specified Association Class.

I found the GetAdjacentObjects() family of functions in the Udm TOMI
interface, and they are intended to perform these tasks.
However they seem to work incorrectly for some specific association
scenarios, for which I prepared a test in the udm_ns tests folder
(called testGetAdjacentObjects).
The most obvious problem with these functions is their return type.
Every GetAdjacentObjects() function returns with a *set* of objects,
meaning that the objects of the set must be unique.
But how about when there are multiple associations between two objects?
Two examples when having multiple (different) associations between two
objects is considered legal:
- TypeA is associated with TypeB via a simple association when TypeA is
on the 'source side' of the association, and, TypeA is associated with
TypeB via a different simple association when TypeA is on the
'destination side' of the association. E.g. TypeA a; TypeB b; a.src()+=
b; b.src()+= a; set< Object> bs= a.GetAdjacentObjects(); // should
return {b, b}, but will return only {b}
- TypeA is associated with TypeB via association class AssocBase, which
is further specialized into Assoc1 and Assoc2 through inheritance. E.g.
TypeA a; TypeB b; Assoc1 asc1; Assoc2 asc2; asc1.src_end()= a;
asc1.dst_end()= b; asc2.src_end()= a; asc2.dst_end()= b; set< Object>
bs= a.GetAdjacentObjects(); // should return {b,b} but will return only
{b}

For this reason I'd recommend having GetAdjacentObjects() return a list
instead of a set. Once we have testGetAdjacentObjects running OK, we can
add this support to GReAT as well.

Thanks,
Attila


More information about the udm-dev mailing list