We are using the Universal connector to create Services, CIs, and the BinaryRelationships between them. If we remove a Service or CI, we try to first remove the BinaryRelationship. However, we fear that these haven't always been removed.
Does SOI have any mechanism to locate and remove incomplete relationships? If the source or target has been removed, then the incomplete relationship becomes pointless and should be removed. If stale BinaryRelationships are not automatically removed, is there a good way to do this manually?
If these incomplete relationships are not automatically deleted, we wonder if BinaryRelationships are re-used. If we have two services linked via BinaryRelationship, and we delete the target service, then add a BinaryRelationship (of the same Semantic type) to a new target service, will SOI re-use an existing BinaryRelationship?
SOI manager always deletes the relationship when you remove a CI from a service. I am not sure how did you determined the relationships are left behind but here is a method you can use to find out if there are any stale relationship, in this example I am using a computer system CI
- When you add a CI to a service there are multiple entries created in ca_ssa_binaryrelationship and CIRelationship tables.
- The following SQL query will show you how many projections you have for one CI. Note down the c_mdrelementid for each of the projection. Normally you'll get two projection (CA:00030 and a projection from the connector, such as CA:00005), if the CI is added to a service than a new projection CA:00047 is created
select * from ca_ssa_computersystem where c_label='<label of the CI>'
- Running the following SQL query will show you the relationship entries in the ca_ssa_binaryrelationship
select * from ca_ssa_binaryrelationship where c_mdrlementid LIKE '%<mdrelementid you have written down from above query>%'
- Running the following SQL query will show you the relationship in the CIRelationship table
select * from CIRelationship where BNodeCIID='<the CIID if the CI>'
- if you run the following SQL query it'll show you any CI having relationship to a service
select * from CIRelationship where ServiceCIID='<service CIID>'
Note: Service and CI CIID can be found on the SOI Properties tab on the console. You can also find it in CI table.
Still waiting on the follow-up questions regarding ca_ssa_binaryrelationship table VS CIRelationship table