slreq.Link class

Package: slreq
Superclasses:

Work with link objects

Description

When you establish a traceable association between artifacts, Simulink® Requirements™ creates an slreq.Link object to store source and destination data of the link.

Construction

link = slreq.createLink(src, dest) creates an slreq.Link object link with source and destination artifacts specified by src and dest respectively. The slreq.Link object is stored in the Link set file that belongs to src.

outLinks = slreq.outLinks(src) returns an array of slreq.Link objects outLinks that contains the outgoing links from the source artifact src.

inLinks = slreq.inLinks(dest) returns an array of slreq.Link objects inLinks that contains the incoming links to the destination artifact dest.

Input Arguments

expand all

Link source artifact, specified as a MATLAB® structure.

Link destination artifact, specified as a MATLAB structure.

Output Arguments

expand all

Handle to a link, returned as an slreq.Link object.

Array of outgoing links.

Array of incoming links.

Properties

expand all

The date on which the link was created, specified as a datetime value. The software populates this property.

The name of the individual or organization who created the link.

The date on which the link was last modified, specified as a datetime value. The software populates this property.

The name of the individual or organization who last modified the link.

The comments that are attached with the link, returned as a structure.

The relationship between the source and the destination artifacts. For more information, see Link Types.

Link descriptive text, specified as a multi-line character vector.

Link keywords, specified as character array.

Link rationale text, specified as a multiline character vector.

The Session Independent Identifier corresponding to the link.

Methods

destination Get link destination artifact
getAttributeGet link custom attributes
isResolved Check if the link is resolved
isResolvedDestination Check if the link destination is resolved
isResolvedSource Check if the link source is resolved
linkSetReturn parent link set
removeDelete links
setAttributeSet link custom attributes
setDestination Set requirement link destination
setSource Set requirement link source
source Get link source artifact

Examples

Create Links

% Create a link between the current Simulink Object and a requirement
link1 = slreq.createLink(gcb, REQ)

link1 = 

  Link with properties:

           Type: 'Implement'
    Description: 'Plant Specs'
       Keywords: [0×0 char]
      Rationale: ''
      CreatedOn: 02-Sep-2017 15:49:28
      CreatedBy: 'Jane Doe'
     ModifiedOn: 21-Oct-2017 11:34:12
     ModifiedBy: 'John Doe'
       Comments: [0×0 struct]

% Create a link between a requirement and the current Stateflow object
link2 = slreq.createLink(REQ, sfgco);

Get Incoming Links

% Get the handle to a requirements set
myReqSet = slreq.find('Type', 'ReqSet', 'Name', 'Design_Spec');

% Get the handle to a requirement in myReqSet
myReq = find(myReqSet, 'Type', 'Requirement', 'Id', 'R1.1');

% Query incoming links to myReq
inLinks = slreq.inLinks(myReq);

Get Outgoing Links

% Load a link set and get link sources
myLinkSet = slreq.load('c5.slx');
allSrcs = myLinkSet.sources();

% Get outgoing links
myLink = slreq.outLinks(allSrcs(1));
Introduced in R2018a