How to fetch artifacts from RRC server?
I have a requirement in which I have to fetch artifacts of type "Use case" from "Use case diagram". I am using the below query to acheive this:
String oslcSearchForUseCaseDiagramQuery = queryCapabilityURI + "&oslc.prefix="
+ URLEncoder.encode("dcterms=<http://purl.org/dc/terms/>", "UTF8") + "," +
"&oslc.select=" + URLEncoder.encode("dcterms:title", "UTF8")+
"&oslc.where=" + URLEncoder.encode("dcterms:type=\"*\"", "UTF8");
But I think I have missed out something in the above query as am not able to get any artifacts by using "dcterms:type=use case".
Please provide your valuable inputs on the above issue.
Thanks in advance.
Regards,
Ankit
5 answers
Try by using following query :
oslc.prefix=rm=<http://www.ibm.com/xmlns/rdm/rdf/>
&oslc.where=rm:ofType=<YOUR_TYPE_URL>
where YOUR_TYPE_URL is the URL of the Use Case type.
This value can be obtained from:
- The services document of the project in the Requirement Creation factory section
- The "oslc:instanceShape" entry of a returned RDF requirement representation.
Request the server's services:
GET : https://grarrc.ibm.com:9443/rm/rootservices
From Response, get the Catalog entry: <oslc_rm:rmServiceProviders rdf:resource="https://grarrc.ibm.com:9443/rm/discovery/RMCatalog" />
GET : https://grarrc.ibm.com:9443/rm/discovery/RMCatalog
The Catalog exposes the server project areas as an oslc:serviceProvider:
<oslc:ServiceProvider rdf:about="https://grarrc.ibm.com:9443/rm/discovery/_zpWqELrZEeG3OKR6fZ1svQ/services.xml">
<dcterms:title rdf:parseType="Literal">CML_Project (Requirements)</dcterms:title>
<jp:consumerRegistry rdf:resource="https://grarrc.ibm.com:9443/jts/process/project-areas/_zpWqELrZEeG3OKR6fZ1svQ/links"/>
<oslc:details rdf:resource="https://grarrc.ibm.com:9443/jts/process/project-areas/_zpWqELrZEeG3OKR6fZ1svQ"/>
</oslc:ServiceProvider>
From the response, get the services offered for a specific project area:
GET https://grarrc.ibm.com:9443/rm/discovery/_zpWqELrZEeG3OKR6fZ1svQ/services.xml
The response contains information about the project. This document describes the usage of:
- Requirements Creation Factory and Requirements Collections Creation Factory
<oslc:CreationFactory>
<dcterms:title rdf:parseType="Literal">Requirement Creation Factory</dcterms:title>
<oslc:creation rdf:resource="https://grarrc.ibm.com:9443/rm/requirementFactory?projectURL=https://grarrc.ibm.com:9443/jts/process/project-areas/_zpWqELrZEeG3OKR6fZ1svQ" />
<oslc:resourceType rdf:resource="http://open-services.net/ns/rm#Requirement" />
<oslc:resourceShape rdf:resource="https://grarrc.ibm.com:9443/rm/types/_0Z8ZgrrZEeG3OKR6fZ1svQ" />
<oslc:resourceShape rdf:resource="https://grarrc.ibm.com:9443/rm/types/_0aWpMrrZEeG3OKR6fZ1svQ" />
<oslc:resourceShape rdf:resource="https://grarrc.ibm.com:9443/rm/types/_0cxEALrZEeG3OKR6fZ1svQ" />
<oslc:usage rdf:resource="http://open-services.net/ns/core#default" />
</oslc:CreationFactory>
Comments
Hi Gabriel,
I am getting the specific project area as:
Project Area [JKE Banking (Requirements)]: https://vblrqtools-22:9443/rm/discovery/_-HElgsdjEeG8IPPrR9AlEQ/services.xml
Service Providers Catalog: https://vblrqtools-22:9443/rm/discovery/RMCatalog
Root services: https://vblrqtools-22:9443/rm/rootservices
The information on these are available as some samples present in "net.jazz.oslc.consumer.examples"
Now I am getting the specific project area, am still not able to find how to get the services offered for a specific project area.
Please provide me your suggestion.
Thanks in advance.
u have to add
Accept: application/rdf+xml
OSLC-Core-Version: 2.0
these two headers then it works
Did you check the code samples provided at the OSLC Workshop :
https://jazz.net/library/article/635
sample 4 and sample 5 shows hot to get data from the Services document of a project.
Comments
Hi Gabriel,
I am using the below query:
String oslcSearchForUseCaseDiagramQuery = "oslc.prefix=rm=<http://www.ibm.com=\"\"" +
" xmlns=\"\" rdm=\"\" rdf=\"\"/>" +"&oslc.where=rm:ofType=<https://vblrqtools-22:9443=\"\" rdm=\"\" types=_LGIc9sdkEeG8IPPrR9AlEQ=>";
Am getting error with the above query. Please suggest me if there is something wrong that I am trying?
Is "rdm" is the name of your application ? or is it "rm" ?
It is "rm" type.
is your query using rdm or RM ( based on your post above it looks like rdm is being used )
Thanks for pointing out the mistake. But now I have changed my query to "rm". I have attached the error log from RM server in the below post. Please suggest me where I need to correct my query?
Hi Gabriel,
Below is the snippet of the log from the RM Server:
oslc.prefix=rm=<http://www.ibm.com="" xmlns="" rm="" rdf=""/>&
oslc.where=rm:ofType=<https://vblrqtools-22:9443="" rm="" types=_LGIc9sdkEeG8IPPrR9AlEQ=>
com.ibm.oslc.query.parser.select.ParseException: Invalid prefix definition: rm=<http://www.ibm.com="" xmlns="" rm="" rdf=""/>
Please advise me where I need to correct my query?
Hi Gabriel,
Am getting the below error:
java.lang.Exception: Error occured while posting
HTTP/1.1 500 Internal Server Error
at net.jazz.oslc.utils.HttpUtils.sendPostForSecureDocument(HttpUtils.java:313)
at net.jazz.oslc.consumer.examples.Example07.performQuery(Example07.java:113)
Please suggest me if there is something wrong that I am trying?
Comments
Can not determine from current information which could be the problem, I suggest to check the RM Server log for more information about the problem.
Error when converting:
oslc.prefix=rm=<http://www.ibm.com="" xmlns="" rm="" rdf=""/>&
oslc.where=rm:ofType=<https://vblrqtools-22:9443="" rm="" types=_LGIc9sdkEeG8IPPrR9AlEQ=>
com.ibm.oslc.query.parser.select.ParseException: Invalid prefix definition: rm=<http://www.ibm.com="" xmlns="" rm="" rdf=""/>
Please tell me where I have to make correction in my query? Is it "quotes" that I have not used properly?
Hi,
Sorry I was out on vacations, Any look with the query?
Hi Gabriel,
I am getting the error while running the query. Not sure where i went wrong.
The error log from the RM server is:
Error when converting:
oslc.prefix=rm=<http://www.ibm.com="" xmlns="" rm="" rdf=""/>&
oslc.where=rm:ofType=<https://vblrqtools-22:9443="" rm="" types=_LGIc9sdkEeG8IPPrR9AlEQ=>
com.ibm.oslc.query.parser.select.ParseException: Invalid prefix definition: rm=<http://www.ibm.com="" xmlns="" rm="" rdf=""/>
I am getting the error while running the query. Not sure where i went wrong.
The error log from the RM server is:
Error when converting:
oslc.prefix=rm=<http://www.ibm.com="" xmlns="" rm="" rdf=""/>&
oslc.where=rm:ofType=<https://vblrqtools-22:9443="" rm="" types=_LGIc9sdkEeG8IPPrR9AlEQ=>
com.ibm.oslc.query.parser.select.ParseException: Invalid prefix definition: rm=<http://www.ibm.com="" xmlns="" rm="" rdf=""/>
--------------------------------------------------------------------------------
Please advise me where I need to correct my query?