Main Content

slreq.find

Find requirement, reference, and link set artifacts

Description

myReqTbxObjects = slreq.find("Type",ObjectType) returns the loaded Requirements Toolbox™ objects of the type specified by ObjectType.

example

myReqTbxObjects = slreq.find("Type",ObjectType,Name,Value) returns the loaded Requirements Toolbox objects with the requirement type or link type specified by Name and Value.

example

myReqTbxObjects = slreq.find("Type",ObjectType,PropertyName,PropertyValue) returns the loaded Requirements Toolbox objects with the property value equal to PropertyValue for the property specified by PropertyName. The property can be a built-in property, custom attribute, or stereotype property.

example

myReqTbxObjects = slreq.find("Type",ObjectType,PropertyOperator,PropertyValue) returns the loaded Requirements Toolbox objects whose property value, PropertyValue, meets the relational criteria for the property specified by PropertyOperator.

example

myReqTbxObjects = slreq.find("Type",ObjectType,___,"-or",___) returns the loaded Requirements Toolbox objects that match at least one of the criteria.

example

Examples

collapse all

This example shows how to find requirements.

Load the requirement set myAddRequirements.

rs = slreq.load("myAddRequirements");

Find the loaded requirements.

reqs = slreq.find("Type","Requirement")
reqs=1×4 Requirement array with properties:
    Type
    Id
    Summary
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedBy
    IndexEnabled
    IndexNumber
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments
    Index

This example shows how to find functional requirements.

Load the requirement set myAddRequirements.

rs = slreq.load("myAddRequirements");

Find the loaded functional requirements.

reqs = slreq.find("Type","Requirement","ReqType","Functional")
reqs=1×4 Requirement array with properties:
    Type
    Id
    Summary
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedBy
    IndexEnabled
    IndexNumber
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments
    Index

This example shows how to find requirements by property value.

Load the requirement set myAddRequirements.

rs = slreq.load("myAddRequirements");

Find the loaded requirement with Index set to 2.

req = slreq.find("Type","Requirement","Index",2);

This example shows how to use relational operators to find requirements by property value.

Load the requirement set myAddRequirements.

rs = slreq.load("myAddRequirements");

Find the loaded requirements with Index greater than 2.

reqs = slreq.find("Type","Requirement","Index:>",2)
reqs=1×2 Requirement array with properties:
    Type
    Id
    Summary
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedBy
    IndexEnabled
    IndexNumber
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments
    Index

This example shows how to use multiple criteria find requirements by property value.

Load the requirement set myAddRequirements.

rs = slreq.load("myAddRequirements");

Find the loaded requirement with Index set to 2 or 4.

req = slreq.find("Type","Requirement","Index",2,"-or","Index",4)
req=1×2 Requirement array with properties:
    Type
    Id
    Summary
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedBy
    IndexEnabled
    IndexNumber
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments
    Index

This example shows how to find links that match the specified destination attribute.

Load the myAddRequirements requirement set, which also loads the myAdd link set. Then, find the myAdd link set.

slreq.load("myAddRequirements");
myLinkSet = slreq.find("Type","LinkSet","Name","myAdd");

Use the slreq.find function to find the links whose destination artifact is myAddRequirements.slreqx.

fp = which("myAddRequirements.slreqx");
myLinks = slreq.find("Type","Link","destination.artifact",fp);

Use the find method to find the links in the link set whose summary is Input u.

myLinks = find(myLinkSet,"destination.summary","Input u");

Input Arguments

collapse all

Requirements Toolbox object type, specified as:

  • "ReqSet"

  • "Requirement"

  • "Reference"

  • "Justification"

  • "LinkSet"

  • "Link"

Requirements Toolbox object property name, specified as a string scalar or character vector. The string must be the name of a custom attribute, stereotype property, or built-in property of one of these classes:

If ObjectType is specified as "Link", PropertyName can be a link destination attribute, specified as one of these strings:

  • "destination.domain"

  • "desintation.artifact"

  • "destination.id"

  • "destination.summary"

The link destination attributes correspond to the structure fields of the output of the destination method.

Requirements Toolbox object property value, specified as one of these data types:

  • String scalar

  • Character array

  • boolean

  • datetime

  • single

  • double

  • int8

  • int16

  • int32

  • int64

  • uint8

  • uint16

  • uint32

  • uint64

  • enumeration

The data type depends on the type of the built-in property, custom attribute, or stereotype property.

To search for a regular expression, use the syntax slreq.find("Type",ObjectType,PropertyOperator,PropertyValue) and include regexp in the PropertyOperator input. Specify PropertyValue as a string scalar or a character vector that includes a regular expression. For more information, see Regular Expressions.

Requirements Toolbox object property name and relational operator or regular expression, specified as a string scalar or a character vector. This argument combines the property name and a relational operator, separated by a colon, in a single string or character vector. For example, to specify a property called Index and the operator >, the string is "Index:>".

The property name must be the name of a custom attribute, stereotype property, or a built-in property of one of these classes:

The operator must be one of these options:

  • regexp

  • ==

  • ~=

  • >

  • >=

  • <

  • <=

For more information about relational operators, see MATLAB Operators and Special Characters.

Use the regexp operator to search for a regular expression. For more information, see Regular Expressions.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: "ReqType","Functional"

Requirement type, specified as "Functional", "Container", or "Informational".

Example: "ReqType","Functional"

Data Types: char | string

Link type, specified as one of these types:

  • "Relate"

  • "Implement"

  • "Verify"

  • "Derive"

  • "Refine"

  • "Confirm"

Example: "LinkType","Relate"

Data Types: char | string

Output Arguments

collapse all

Requirements Toolbox objects, returned as an array of one of these objects:

Tips

  • To search the children of a requirement, use the find method of slreq.Requirement

  • To search the children of a requirements set, use the find method of slreq.ReqSet.

  • To search the children of a link set, use the find method of slreq.LinkSet.

  • To search the children of a reference, use the find method of slreq.Reference.

  • To search the children of a justification, use the find method of slreq.Justification.

  • To search links by destination attributes, specify ObjectType as "Link" and PropertyName as a link destination attribute, specified as one of these strings:

    • "destination.domain"

    • "destination.artifact"

    • "destination.id"

    • "destination.summary"

    For example, to find the links whose destination artifact is a requirement set called myAdd.slreqx, enter:

    fp = which("myAdd.slreqx");
    myLinks = slreq.find("Type","Link","desintation.artifact",fp);
    

Version History

Introduced in R2018a

expand all