This example shows how to add and remove links from OSLC resources to an OSLC requirement.
After you have created and configured the OSLC client myClient as described
in Create and Configure an OSLC Client for the Requirements Management Domain, create a query capability for the requirement resource type. Submit a query request to
the service provider for the available requirement
resources.
reqs =
1×30 Requirement array with properties:
ResourceUrl
Dirty
IsFetched
Title
IdentifierAssign one of the requirements to a variable called myReq and one to
linkReq. Fetch the full resource properties for the
requirements.
Add a link from linkReq to myReq. Confirm the link creation by getting the links for myReq.
links =
1×1 cell array
{'https://localhost:9443/rm/CA_3d5ba3752e2c489b965a3ecceffb664a'}In the service provider, identify a test case to link to the requirement. Identify the
resource URL of the test case and assign it to a variable called URL. Add
a link from URL to myReq. Confirm the link creation by
getting the links for myReq.
links =
1×2 cell array
{'https://localhost:9443/rm...'} {'https://localhost:9443/qm...'}Commit the changes to the service provider.
status =
StatusCode enumeration
OKFetch the full resource properties for the updated requirement myReq.
status =
StatusCode enumeration
OKGet the resource URLs linked to myReq.
links =
1×2 cell array
{'https://localhost:9443/rm...'} {'https://localhost:9443/qm...'}Get the URL for the first linked resource and assign it to
URL.
URL =
'https://localhost:9443/rm/CA_3d5ba3752e2c489b965a3ecceffb664a'Before removing the link from myReq, confirm that the resource URL
points to the requirement that you want to remove. Create a requirement resource object and
set the resource URL. Fetch the full resource properties for the requirement and inspect the
requirement.
status =
StatusCode enumeration
OKans =
Requirement with properties:
ResourceUrl: 'https://localhost:9443/rm/CA_3d5ba3752e2c489b965a...'
Dirty: 0
IsFetched: 1
Title: '[SAFe] Lifecycle Scenario Template'
Identifier: '1165'Remove the link from myReq and commit the changes to the service provider.
status =
StatusCode enumeration
OKFetch the full resource properties for the updated requirement myReq.
status =
StatusCode enumeration
OKVerify the link removal by getting the URLs for the resources linked to myReq.
links =
1×1 cell array
{'https://localhost:9443/qm/_ibz6tGWYEeuAF8ZpKyQQtg'}