我正在尝试选择链接到对象的所有“应用程序功能”。因此,我阅读了以下查询:
select
other.ea_guid as CLASSGUID, other.object_type as CLASSTYPE,
obj.name,
other.*
from t_object as obj
join (
select t_connector.start_object_id as Object2_id, t_object.* from t_object
join t_connector on t_connector.end_object_id=t_object.Object_id
where t_object.object_type = 'Application Function'
union
select t_connector.end_object_id as Object2_id, t_object.* from t_object
join t_connector on t_connector.start_object_id=t_object.Object_id
where t_object.object_type = 'Application Function'
) as other on obj.Object_id=other.Object2_id
where obj.object_id = 143299
它是空的。
但是,如果我通过other.*
之类的命名列来选择other.object_type, object_name
,则obj.name
列将为空,而other.object_type
则为另一个值:
我认为这种差异解释了为什么我的选择不起作用。但是如何解释和解决这个问题?
答案 0 :(得分:2)
EA对某些字段执行特殊的魔术。
它基于返回的字段的确切名称(例如Object_Type
或Note
)来执行此操作
为避免这种情况,请确保为这些字段指定其他别名。例如Object_Type as theRealType
在这种情况下,我将假设您正在寻找ArchiMate应用程序功能。实际上这是一个应用程序功能,实际上存储在 Stereotype 中,而不是在 Object_Type
中存储这样的查询应返回链接到ID为143299的对象的所有ArchiMate应用程序功能
select o2.Object_ID AS CLASSGUID, o2.Object_Type AS CLASSTYPE, o2.Object_Type as theRealObjectType,
o2.*
from t_object o
inner join t_connector c on c.Connector_ID in (c.Start_Object_ID, c.End_Object_ID)
inner join t_object o2 on o2.Object_ID in (c.Start_Object_ID, c.End_Object_ID)
and o2.Object_ID <> o.Object_ID
where o.Stereotype = 'ArchiMate_ApplicationFunction'
and o2.Object_ID = 143299
此查询已在SQL Server存储库中编写和测试。如果要在.eap文件上使用它(MS Access SQL语法),可能需要进行调整