You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

关于UML中ParameterSet所有者约束及参数类型的技术问询

UML ParameterSet 约束一致性问题

核心矛盾点

  • UML规范第9.9.16节第190页的ParameterSet描述及关联图显示,ParameterSet的所有者可以是BehavioralFeature或Behavior;但9.9.16.5节的约束仅针对BehavioralFeature编写,完全忽略了Behavior作为所有者的场景。
  • 原约束示例(针对input规则):

• input
If a parameterized entity has input Parameters that are in a ParameterSet, then any inputs that are not in a ParameterSet must be streaming. Same for output Parameters.

inv: ((parameter->exists(direction = ParameterDirectionKind::_'in')) implies
behavioralFeature.ownedParameter->select(p | p.direction = ParameterDirectionKind::_'in'
and p.parameterSet->isEmpty())->forAll(isStream))
and
((parameter->exists(direction = ParameterDirectionKind::out)) implies
behavioralFeature.ownedParameter->select(p | p.direction = ParameterDirectionKind::out
and p.parameterSet->isEmpty())->forAll(isStream))
  • 原约束还遗漏了inout和return类型参数:目前没有明确规则禁止这类参数加入ParameterSet,但具体使用方式不明确。

适配双所有者的OCL实现尝试

基于Axel的评论,我尝试修改约束以同时支持BehavioralFeature和Behavior作为所有者,实现代码如下:

inv: if behavioralFeature <> null then
       ((parameter->exists(direction = ParameterDirectionKind::_'in')) implies
       behavioralFeature.ownedParameter->select(p | p.direction = ParameterDirectionKind::_'in'
       and p.parameterSet->isEmpty())->forAll(isStream))
       and
       ((parameter->exists(direction = ParameterDirectionKind::out)) implies
       behavioralFeature.ownedParameter->select(p | p.direction = ParameterDirectionKind::out
       and p.parameterSet->isEmpty())->forAll(isStream))
     else
       ((parameter->exists(direction = ParameterDirectionKind::_'in')) implies
       behavior.ownedParameter->select(p | p.direction = ParameterDirectionKind::_'in'
       and p.parameterSet->isEmpty())->forAll(isStream))
       and
       ((parameter->exists(direction = ParameterDirectionKind::out)) implies
       behavior.ownedParameter->select(p | p.direction = ParameterDirectionKind::out
       and p.parameterSet->isEmpty())->forAll(isStream))
     endif

请问这个实现是否符合UML的设计意图?

另外,我认为inout和return参数不应属于ParameterSet,理想情况下需要新增约束来限制允许加入ParameterSet的参数方向。


内容的提问来源于stack exchange,提问作者Robert Hairgrove

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 12:43:23