Can we fetch only artifacts of system requirement type using OSLC?
Accepted answer
Hi
Yes - using OSLC Query you can retrieve resources of a particular artifact type, or do more complex queries.
For the full OSLC Query specification see https://docs.oasis-open-projects.org/oslc-op/query/v3.0/oslc-query.html
This article https://jazz.net/library/article/1197 gives a useful overview of how to use the OSLC APIs of DOORS Next, and has some search examples under the heading Using the query capabilities
So you'd specify (appropriately encoded):
- oslc.where=oslc:instanceShape=<URI of Stakeholder Requirement shape>
For example:
- oslc.where=oslc:instanceShape=<https://jazz.ibm.com:9443/rm/types/_k4KCi9cKEeqXpuBdEolY7w>
Which is encoded in the URL (along with other OSLC query parameters like oslc.select, oslc.prefix) as:
- &oslc.where=oslc%3AinstanceShape%3D%3Chttps%3A%2F%2Fjazz.ibm.com%3A9443%2Frm%2Ftypes%2F_k4KCi9cKEeqXpuBdEolY7w%3E
You can discover the shape URI from the component+configuration services.xml, which is part of the discovery sequence where you also find the query capability for oslc_rm:Requirement.
If you want a working example of using OSLC Query, which you can also modify/adapt/extend if you want to, and you're able to use Python then there is an open source example of command-line OSLC Query (among other things) here https://github.com/IBM/ELM-Python-Client also installable using pip install elmclient - full disclosure, I'm the author :-) Using the oslcquery command from this package means you don't have to worry about assembling the complex URL of the query, and you can specify your query on the command line using the name of the type like -q "oslc:instanceShape='Stakeholder Requirement'"
HTH
Ian