DNG 6.0 : Retrieving Requirements from a folder in DNG using OSLC
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.
Accepted answer
The oslc.where param must specify something like :
" oslc.where=nav:parent=<https://grarrc.ibm.com:9443/rm/folders/_RHCJYN5jEeGb6IIbvOh9Dw> "
now, in order to get the URI's of the folders ( AKA transverse the folder structure ) you can use
the capabilities described in : https://rhnaranjo.wordpress.com/2012/06/25/folder-support-added-to-rrc-4-0-oslc-rm-api-implementation/
Comments
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. :) :)
Thanks Garbiel!!!
Finally able to do that, Posting complete query may be help someone looking for same answer:
String serviceProviderUrl = client.lookupServiceProviderUrl(Authentication_Impl.catalogUrl, projectname);
queryCapability = client.lookupQueryCapability(serviceProviderUrl, OSLCConstants.OSLC_RM_V2, OSLCConstants.RM_REQUIREMENT_TYPE);
requirements = new ArrayList<MyRequirement>();
collectionsURI = new ArrayList<String>();
OslcQueryParameters queryParams = new OslcQueryParameters();
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>");
OslcQuery query =new OslcQuery(client, queryCapability, 1500, queryParams);
OslcQueryResult result = query.submit();
Hi naveen,
I tried using the same query to fetch the requirements of a folder. But I am getting following exception:
java.lang.RuntimeException: Undefined namespace prefix: nav (More info found at entry [724e36eb342202a8] in the RM application server log)</err:detailedMessage>
<err:errorMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>Bad Request</err:errorMessage>
<err:errorStatus rdf:datatype="http://www.w3.org/2001/XMLSchema#long"
>400</err:errorStatus>
</rdf:Description>
</rdf:RDF>
My folder uri is: https://example.com:9443/rm/folders/_pCsHIeuBEeW8KYg-oqs26A.
Am i missing something?
regards,
Sud
Hi naveen,
I tried using the same query to fetch the requirements of a folder. But I am getting following exception:
java.lang.RuntimeException: Undefined namespace prefix: nav (More info found at entry [724e36eb342202a8] in the RM application server log)</err:detailedMessage>
<err:errorMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>Bad Request</err:errorMessage>
<err:errorStatus rdf:datatype="http://www.w3.org/2001/XMLSchema#long"
>400</err:errorStatus>
</rdf:Description>
</rdf:RDF>
My folder uri is: https://example.com:9443/rm/folders/_pCsHIeuBEeW8KYg-oqs26A.
Am i missing something?
regards,
Sud
Hi Suditp,
It seems like your query is not correct. let me give you the right query. Hope it will help.
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.
One other answer
Can you please help
Comments
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".