Generating duplicate IDs when creating requirements tracking links

2 vues (au cours des 30 derniers jours)
JinWook Park
JinWook Park le 18 Déc 2024
Commenté : Kanishk le 20 Déc 2024
I created a tracking link for the SwRS ID and SwAD ID.
Then I created a tracking link with the same IDs again.
In my opinion, tracking links should not be created with the same ID.
However, the links are created.
Note: “ Warning: Link to DCBC_SWAD_ID_Req.slreqx:36 already exists”
Is there any way to prevent this?

Réponse acceptée

Kanishk
Kanishk le 18 Déc 2024
The link created by 'slreq.createLink' is for a requirement having a description. Multiple requirements can be satisfied by a single destination file for a given source file, Hence 'slreq.createLink' creates a link but with a new SID.
You want to prevent multiple links between same source and destination files.
To prevent this behaviour you can check for if a link already exists between a source and destination file and create a link if it is not present. Here is a simple MATLAB function for the same.
function linkExist = checkIfLinkExists(src, dest)
inwardLinks = slreq.inLinks(dest);
linkExist = 0;
for i=1:size(inwardLinks,2)
if strcmp(source(inwardLinks(i)).artifact, which(src))
linkExist = 1;
return
end
end
end
Please go through this official MATLAB documentation of 'slreq.inLinks' to learn more.
doc slreq.inLinks
You can also access the workdlow of creating and link requirements from this documention.
web(fullfile(docroot, 'slrequirements/gs/author-requirements-for-a-matlab-function.html'))
  3 commentaires
JinWook Park
JinWook Park le 20 Déc 2024
Thanks, I solved it well with your help.
function linkExist = checkIfLinkExists(srcReq, dest, srcid, destid)
inwardLinks = slreq.inLinks(dest);
linkExist = 0;
for i=1:size(inwardLinks,2)
if strcmp(destination(inwardLinks(i)).id,destid)
GetSrcReq = find(srcReq,'Type','Requirement','SID',source(inwardLinks(i)).id)
if strcmp(GetSrcReq.Id,srcid)
linkExist = 1;
return
end
end
end
end
Kanishk
Kanishk le 20 Déc 2024
Glad it helped!!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by