getLinks
Get locally stored traceability links from OSLC requirement resource object
Since R2021a
Description
returns the resource URLs associated with the URLs
= getLinks(reqResource
)rdf:resource
attribute of
the RDF/XML element j.0:Link
for the requirement or requirement
collection resource specified by reqResource
. For more information
about RDF/XML elements, see An XML Syntax for
RDF on the World Wide Web Consortium website and QM Resource Definitions on the Open Services for Lifecycle Collaboration (OSLC)
website.
Examples
Add and Remove Links from OSLC Resources to Requirement
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.
myQueryCapability = getQueryService(myClient,'Requirement');
reqs = queryRequirements(myQueryCapability)
reqs = 1×30 Requirement array with properties: ResourceUrl Dirty IsFetched Title Identifier
Assign one of the requirements to a variable called myReq
and one to
linkReq
. Fetch the full resource properties for the
requirements.
myReq = reqs(1); linkReq = reqs(5); fetch(myReq,myClient); fetch(linkReq,myClient);
Add a link from linkReq
to myReq
. Confirm the link creation by getting the links for myReq
.
addLink(myReq,linkReq) links = getLinks(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
.
URL = 'https://localhost:9443/qm/_ibz6tGWYEeuAF8ZpKyQQtg';
addLink(myReq,URL)
links = getLinks(myReq)
links = 1×2 cell array {'https://localhost:9443/rm...'} {'https://localhost:9443/qm...'}
Commit the changes to the service provider.
status = commit(myReq,myClient)
status = StatusCode enumeration OK
Fetch the full resource properties for the updated requirement myReq
.
status = fetch(myReq,myClient)
status = StatusCode enumeration OK
Get the resource URLs linked to myReq
.
links = getLinks(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 = links{1}
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.
req = oslc.rm.Requirement; setResourceUrl(req,URL); status = fetch(req,myClient)
status = StatusCode enumeration OK
req
ans = 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.
removeLink(myReq,URL) status = commit(myReq,myClient)
status = StatusCode enumeration OK
Fetch the full resource properties for the updated requirement myReq
.
status = fetch(myReq,myClient)
status = StatusCode enumeration OK
Verify the link removal by getting the URLs for the resources linked to myReq
.
links = getLinks(myReq)
links = 1×1 cell array {'https://localhost:9443/qm/_ibz6tGWYEeuAF8ZpKyQQtg'}
Input Arguments
reqResource
— OSLC requirement resource
oslc.rm.Requirement
object | oslc.rm.RequirementCollection
object
OSLC requirement or requirement collection resource object, specified as an oslc.rm.Requirement
or oslc.rm.RequirementCollection
object.
Output Arguments
URLs
— OSLC resource URLs for linked resources
cell array
OSLC resource URLs for resources linked to the requirement or requirement collection resource, returned as a cell array.
Version History
Introduced in R2021a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)