DNG 6.0 : Retrieving Requirements from a folder in DNG using OSLC
Naveen Tyagi (197●78●152)
| asked Sep 02 '15, 9:44 a.m.
edited Sep 12 '15, 12:01 a.m. by Geoffrey Clemm (30.1k●3●30●35)
I am new to OSLC. i have written code to pull out all the requirement list from a project in DNG. I want to retrieve requirements folder by folder instead of all once. Like, List of all the requirements inside a folder by providing its name. also List of all the folders and requirements inside folders.
I found that there is a folder query capability for this (https://jazz.net/library/article/1197). I am not able to understand how to use that in My code.
Here is the code i am using to retrieve all the requirement in DNG project but i need folder by folder.
try{
String serviceProviderUrl = client.lookupServiceProviderUrl(Authentication_Impl.catalogUrl, projectArea);
queryCapability = client.lookupQueryCapability(serviceProviderUrl, OSLCConstants.OSLC_RM_V2,OSLCConstants.RM_REQUIREMENT_TYPE);
requirements = new ArrayList<MyRequirement>();
ClientResponse response = null;
OslcQueryParameters queryParams = new OslcQueryParameters();
queryParams.setPrefix("rdf=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>");
queryParams.setWhere("rdf:type=<http://open-services.net/ns/rm#Requirement>");
OslcQuery query = new OslcQuery(client, queryCapability, 20, queryParams);
OslcQueryResult result = query.submit();
for (String resultsUrl : result.getMembersUrls()) {
response = client.getResource(resultsUrl, OSLCConstants.CT_RDF);
MyRequirement requiremnt = new MyRequirement();
Requirement req = response.getEntity(Requirement.class);
requiremnt.setId(Integer.parseInt(req.getIdentifier() ));
requiremnt.setSummary(req.getTitle());
requirements.add(requiremnt);
System.out.println("Title: " + req.getTitle() + "Identifire :" + req.getIdentifier() ) ;
System.out.println("");
}
Your help would greatly appreciated. :)
|
Accepted answer
Hi,
The oslc.where param must specify something like : " oslc.where=nav:parent=<https://grarrc.ibm.com:9443/rm/folders/_RHCJYN5jEeGb6IIbvOh9Dw> " Naveen Tyagi selected this answer as the correct answer
Comments
Naveen Tyagi
commented Sep 03 '15, 7:26 a.m.
i am not able to open this link (https://rhnaranjo.wordpress.com/2012/06/25/folder-support-added-to-rrc-4-0-oslc-rm-api-implementation/) since i have limited access but I will look into this article at home and let you know for any Issue. Thanks for reply. :) :)
Naveen Tyagi
commented Oct 05 '15, 8:22 a.m.
Thanks Garbiel!!!
Naveen Tyagi
commented Oct 05 '15, 8:22 a.m.
<http://www.w3.org/1999/02/22-rdf-syntax-ns#>");
Sudipto Sarkar
commented Aug 25 '16, 2:26 a.m.
Hi naveen,
Sudipto Sarkar
commented Aug 25 '16, 2:29 a.m.
Hi naveen,
Naveen Tyagi
commented Aug 25 '16, 5:39 a.m.
Hi Suditp,
OslcQueryParameters queryParams = new OslcQueryParameters();
if(folderUri==null)
{
queryParams.setPrefix("rdf=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>");
queryParams.setWhere("rdf:type=<http://open-services.net/ns/rm#Requirement>");
}
else
{
queryParams.setPrefix("nav=<http://com.ibm.rdm/navigation#>,rdf=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>");
queryParams.setWhere("nav:parent=<"+ folderUri +">, rdf:type=<http://open-services.net/ns/rm#Requirement>");
}
if you want to get all the requirements from root folder then pass null and if will execute otherwise else part contains query to get the requirements from any particular folder.
showing 5 of 7
show 2 more comments
|
One other answer
HI Naveen looks like you have got the Stuff , i am trying to get the same i mean to get the Artifact details inside the Folders but couldn't succeed tried whatever posted in Jazz forums, I am trying out in RESTCLIENT in firefox, let me post my query
https://<Servername>/rm/views?oslc.query=true&projectURL=https%3A%2F%2F<Servername>%2Frm%2Fprocess%2Fproject-areas%2F__xM4IkAnEeWqwKVfQayNVQ&oslc.prefix=oslc=nav=<http://com.ibm.rdm/navigation#23>,rdf=<http://www.w3.org/1999/02/22-rdf-syntax-ns#23>,dcterms=<http://purl.org/dc/terms/>&oslc.select=dcterms:title,dcterms:description,oslc:instanceShape&oslc.where=nav:parent=<https://<Servername>/rm/folders/_CyDuAVVFEeWyLqmwS3I1jg>,rdf:type=<http://open-services.net/ns/rm#23Requirement>
i dont know whats the problem in query, i am gettin Internal Error Status code 500
Can you please help
Thanks & Regards
Prasanna kUmar
Comments
Donald Nong
commented Sep 18 '16, 8:47 p.m.
You should check rm.log file on the server side for further information. Since the URL is all messed up in the post, I cannot see whether any typos or incorrect syntax there, but you need to at least make sure all the namespaces used in "oslc.select" and "oslc.where" are specified in "oslc.prefix".
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.