OCL implementation of UML operation “Classifier::directlyUsedInterfaces()”

On page 177 of the UML 2.5.1 specification under section 9.9.47 “Operations” for Classifier, we have the following operation definitions:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>directlyRealizedInterfaces() : Interface [0..*]
The Interfaces directly realized by this Classifier
body: (clientDependency->select(
oclIsKindOf(Realization)
and supplier->forAll(oclIsKindOf(Interface))))->
collect(supplier.oclAsType(Interface))->asSet()
</code>
<code>directlyRealizedInterfaces() : Interface [0..*] The Interfaces directly realized by this Classifier body: (clientDependency->select( oclIsKindOf(Realization) and supplier->forAll(oclIsKindOf(Interface))))-> collect(supplier.oclAsType(Interface))->asSet() </code>
directlyRealizedInterfaces() : Interface [0..*]
The Interfaces directly realized by this Classifier

body: (clientDependency->select(
           oclIsKindOf(Realization) 
       and supplier->forAll(oclIsKindOf(Interface))))->
           collect(supplier.oclAsType(Interface))->asSet()

This is fairly straightforward to implement, for example in C++, since there is a property clentDependency defined for NamedElement which is one of the base classes for Classifier.

However, the next operation is problematic:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>directlyUsedInterfaces() : Interface [0..*]
The Interfaces directly used by this Classifier
body: (supplierDependency->select(
oclIsKindOf(Usage)
and client->forAll(oclIsKindOf(Interface))))->
collect(client.oclAsType(Interface))->asSet()
</code>
<code>directlyUsedInterfaces() : Interface [0..*] The Interfaces directly used by this Classifier body: (supplierDependency->select( oclIsKindOf(Usage) and client->forAll(oclIsKindOf(Interface))))-> collect(client.oclAsType(Interface))->asSet() </code>
directlyUsedInterfaces() : Interface [0..*]
The Interfaces directly used by this Classifier

body: (supplierDependency->select(
           oclIsKindOf(Usage) 
       and client->forAll(oclIsKindOf(Interface))))->
           collect(client.oclAsType(Interface))->asSet()

The problem is that there is no property supplierDependency in NamedElement. Perhaps there used to be one and it was removed? I came across this reference WRT supplierDependency: https://www.site.uottawa.ca/~tcl/gradtheses/mnojoumian/ThesisFiles/FinalSpec/UML/7.3.33.html

I suppose this could be implemented similar to the NamedElement::clientDependency() body:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>body: Dependency.allInstances()->select(d | d.client->includes(self))
</code>
<code>body: Dependency.allInstances()->select(d | d.client->includes(self)) </code>
body: Dependency.allInstances()->select(d | d.client->includes(self))

using supplier instead of client?

supplierDependency is the opposite Dependency::supplier.

OCL applies at both analysis and at run-time.

At analysis time there is no fundamental problem in traversing all relationships in all directions. For relationships for which the author neglected to define an explicit opposite name there is a policy that allows the opposite class name to be used as the opposite and if that is ambiguous a fallback on a qualified navigation is available.

At run-time, the OCL implementation must provide a mechanism to navigate in the ‘wrong’ direction. Naively this may be done by a total model search for both ends of the ‘right’ direction. A smarter approach caches the first model search to avoid the cost on every navigation. An even smarter approach pre-analyses the suite of OCL expressions to identify which opposites (and allInstances) are actually used and populates caches during model loading, updating if necessary during model mutation.

There actually is a property supplierDependency defined on NamedElement as you can see in the UML specification

This is also present in the xmi file for version 2.5. This is an image of the resulting model in EA after importing the xmi file.

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật