我有两节课。 class1 的一个属性连接到 class2 的另一个属性。 这是在一个类附近的连接器的上下文菜单的帮助下完成的,它被称为“链接到元素功能”。在连接器的另一侧执行相同的操作以选择其他类的其他属性。 因此连接器直接连接两个属性而不是类本身。 我还没有找到存储此信息的表,因此我找不到适当的 SQL 来查找连接(或未连接)的属性。
Link to..
做笔记的方法PDATA1 = '属性'
SELECT PDATA2 FROM t_object WHERE Object_Type='Note' AND PDATA1 = 'Attribute'
会给你ID。只需将其放入另一个 SQL 中即可:
SELECT * FROM t_attribute WHERE ID = (above SQL)
并且您拥有属性详细信息。或者,如果您想找到未映射的 ID,只需将第一个找到的 ID 与现有属性 ID 进行剖析即可。
对于使用
Link to...
的关联来说,有点棘手。首先,任何此类连接器都将相关信息存储在
t_connector.StyleEx
中,例如LFEP={69A30E17-23AB-4641-9573-9BDBAA988D52}L;
LF<dir>P=<guid><pos>;
连接器附加到属性/操作
= S 或 E 表示开始(源)或结束(目标)<dir>
=<guid>
或t_attribute
t_operation
的 ea_guid<pos>
是创建链接时连接器所连接的边缘(L 或 R)。这是多余的信息,因为渲染器会将链接附加到任何相关的位置。
一个 StyleEx 属性中可以存在一个 LFSP、一个 LFEP 或两者都存在(摘自我的《Inside》书)
现在您可以使用 SQL 或(我更喜欢)一个小脚本来过滤该信息,因为执行复杂的 SQL 字符串操作不是我的专长。
[在查询顶部附近,您将看到一个文字包名称“Workday ETL Mapping”。 该包定义了查询的范围;它包含几个定义了 ETL 源/目标映射的图表。]
The Sparx view definition script follows...
USE [SparxProjects]
GO
/****** Object: View [dbo].[vSparx_Workday_ETL_Source_Target_Object_Element_Mapping] Script Date: 11/13/2024 2:26:02 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create view [dbo].[vSparx_Workday_ETL_Source_Target_Object_Element_Mapping]
as
With cte_workday_etl_package_diagram as
(select distinct
p.Package_ID
,p.Name Package_Name
,d.Diagram_ID
,d.Name Diagram_Name
from t_diagram d
inner join t_package p on (d.Package_ID = p.Package_ID )
where p.Name = 'Workday ETL Mapping'
)
, cte_workday_etl_package_diagram_object as
(select distinct
pd.Package_ID
,do.Diagram_ID
,do.Object_ID
,o.Name Object_Name
,o.Object_Type
,o.Stereotype Object_Stereotype
,pd.Package_Name
,pd.Diagram_Name
from t_diagramobjects do
inner join cte_workday_etl_package_diagram pd
on (pd.Diagram_ID = do.Diagram_ID)
inner join t_object o
on (o.Object_ID = do.Object_ID)
where
(o.Object_Type = 'Class'
and o.Stereotype in ('XSDComplexType', 'Table')
)
)
, cte_workday_etl_diagram_object_element as
(select distinct
pdo.Object_ID ETL_Object_ID
,pdo.Object_Name ETL_Object_Name
,attr.Name ETL_Element_Name
,attr.ea_guid ETL_Element_guid --will be used to join connector end info
from cte_workday_etl_package_diagram_object pdo
inner join t_attribute attr on (attr.Object_ID = pdo.Object_ID)
)
, cte_conn_end_guids as
(select conn.connector_id
,conn.StyleEx
,SUBSTRING(conn.StyleEx
,CHARINDEX('{' ,SUBSTRING(conn.StyleEx,1,100)) --start
,(CHARINDEX('}', SUBSTRING(conn.StyleEx,1,100)) --right_curly_bracket
- CHARINDEX('{',SUBSTRING(conn.StyleEx,1,100)) --first left_curly_bracket
+ 1 ) --length
) "first_guid_value"
,SUBSTRING(
conn.StyleEx --expression
,CHARINDEX(';' , SUBSTRING(conn.StyleEx,1,100)) + 6 --start of guid substring
,len(conn.StyleEx) - CHARINDEX(';' , SUBSTRING(conn.StyleEx,1,100)) - 7 --length of substring
) "second_guid_value"
,case
when (SUBSTRING(conn.StyleEx , 1, 2 ) = 'LF'
and SUBSTRING(conn.StyleEx , 3, 1 ) = 'S')
then 'START_CONN_GUID'
when (SUBSTRING(conn.StyleEx , 1, 2 ) = 'LF'
and SUBSTRING(conn.StyleEx , 3, 1 ) = 'E')
then 'END_CONN_GUID'
else null
end "FirstConnEndDirection"
,case
when (SUBSTRING(conn.StyleEx
,CHARINDEX(';' ,conn.StyleEx,1 ) + 1
, 2
) = 'LF'
and
(SUBSTRING(conn.StyleEx
,CHARINDEX(';' ,conn.StyleEx,1) + 3
, 1
) = 'E'
)
)
then 'END_CONN_GUID'
when (SUBSTRING(conn.StyleEx
,CHARINDEX(';' ,conn.StyleEx,1 ) + 1
, 2
) = 'LF'
and
(SUBSTRING(conn.StyleEx
,CHARINDEX(';' ,conn.StyleEx,1) + 3
, 1
) = 'S'
)
)
then 'START_CONN_GUID'
else null
end "SecondConnEndDirection"
from dbo.t_connector conn
where conn.StyleEx is not null
and conn.Connector_Type = 'InformationFlow'
and conn.Stereotype = 'ETLMapping'
and conn.Start_Object_ID in (select pdo.object_id
from cte_workday_etl_package_diagram_object pdo)
and conn.End_Object_ID in (select pdo.object_id
from cte_workday_etl_package_diagram_object pdo)
)
, cte_start_conn_elements as
( select conn.connector_id
,sattr.Name Start_Element_Name
,sattr.Type Start_Element_Type
,sattr.Stereotype Start_Element_Stereotype
,sattr.ea_guid Start_Element_guid
,sattr.ID Start_Element_ID
,sattr.Object_ID Start_Element_Object_ID
,sattr.Notes Start_Element_Notes
from cte_conn_end_guids conn
inner join t_attribute sattr on (sattr.ea_guid = conn.first_guid_value
and conn.FirstConnEndDirection = 'START_CONN_GUID'
)
UNION
select conn2.connector_id
,eattr.Name Start_Element_Name
,eattr.Type Start_Element_Type
,eattr.Stereotype Start_Element_Stereotype
,eattr.ea_guid Start_Element_guid
,eattr.ID Start_Element_ID
,eattr.Object_ID Start_Element_Object_ID
,eattr.Notes Start_Element_Notes
from cte_conn_end_guids conn2
inner join t_attribute eattr on (eattr.ea_guid = conn2.second_guid_value
and conn2.SecondConnEndDirection = 'START_CONN_GUID'
)
)
, cte_end_conn_elements as
( select conn.connector_id
,eattr.Name End_Element_Name
,eattr.Type End_Element_Type
,eattr.Stereotype End_Element_Stereotype
,eattr.ea_guid End_Element_guid
,eattr.ID End_Element_ID
,eattr.Object_ID End_Element_Object_ID
,eattr.Notes End_Element_Notes
from cte_conn_end_guids conn
inner join t_attribute eattr on (eattr.ea_guid = conn.first_guid_value
and conn.FirstConnEndDirection = 'END_CONN_GUID'
)
UNION
select conn2.connector_id
,eattr.Name End_Element_Name
,eattr.Type End_Element_Type
,eattr.Stereotype End_Element_Stereotype
,eattr.ea_guid End_Element_guid
,eattr.ID End_Element_ID
,eattr.Object_ID End_Element_Object_ID
,eattr.Notes End_Element_Notes
from cte_conn_end_guids conn2
inner join t_attribute eattr on (eattr.ea_guid = conn2.second_guid_value
and conn2.SecondConnEndDirection = 'END_CONN_GUID'
)
)
, cte_workday_etl_connector_objects_elements as
(select
spdo.Diagram_ID
,spdo.Diagram_Name
,spdo.Package_ID
,spdo.Package_Name
,seconn.Connector_ID
,spdo.Object_Name Start_Object_Name
,spdo.Object_Type Start_Object_Type
,spdo.Object_Stereotype Start_Object_Stereotype
,seconn.Start_Element_Name
,seconn.Start_Element_Object_ID
,seconn.Start_Element_Type
,seconn.Start_Element_Stereotype
,seconn.Start_Element_guid
,seconn.Start_Element_ID
,seconn.Start_Element_Notes
,epdo.Object_Name End_Object_Name
,epdo.Object_Type End_Object_Type
,epdo.Object_Stereotype End_Object_Stereotype
,eeconn.End_Element_Name
,eeconn.End_Element_Object_ID
,eeconn.End_Element_Type
,eeconn.End_Element_Stereotype
,eeconn.End_Element_guid
,eeconn.End_Element_ID
,eeconn.End_Element_Notes
from cte_start_conn_elements seconn
inner join cte_end_conn_elements eeconn
on (seconn.Connector_ID = eeconn.Connector_ID)
inner join cte_workday_etl_package_diagram_object spdo
on (spdo.Object_ID = seconn.Start_Element_Object_ID)
inner join cte_workday_etl_package_diagram_object epdo
on (epdo.Object_ID = eeconn.End_Element_Object_ID)
)
select distinct
s_t_element_mapping.Diagram_ID
,s_t_element_mapping.Diagram_Name
,s_t_element_mapping.Package_ID
,s_t_element_mapping.Package_Name
,s_t_element_mapping.Connector_ID
,s_t_element_mapping.Start_Object_Name
,s_t_element_mapping.Start_Object_Type
,s_t_element_mapping.Start_Object_Stereotype
,s_t_element_mapping.Start_Element_Name
,s_t_element_mapping.Start_Element_Object_ID
,s_t_element_mapping.Start_Element_Type
,s_t_element_mapping.Start_Element_Stereotype
,s_t_element_mapping.Start_Element_guid
,s_t_element_mapping.Start_Element_ID
,s_t_element_mapping.Start_Element_Notes
,s_t_element_mapping.End_Object_Name
,s_t_element_mapping.End_Object_Type
,s_t_element_mapping.End_Object_Stereotype
,s_t_element_mapping.End_Element_Name
,s_t_element_mapping.End_Element_Object_ID
,s_t_element_mapping.End_Element_Type
,s_t_element_mapping.End_Element_Stereotype
,s_t_element_mapping.End_Element_guid
,s_t_element_mapping.End_Element_ID
,s_t_element_mapping.End_Element_Notes
from cte_workday_etl_connector_objects_elements s_t_element_mapping
去感谢
https://sparxsystems.com/forums 和 https://stackoverflow.com/users/3379653/qwerty-so 的 Geert Bellekens 提供的有益评论和建议。 如有任何改进建议或发现错误,请在此回复。 对格式感到抱歉,它在 SQL 中解析得很好。
最好的, 逆时针