It's all about the answers!

Ask a question

How to fetch artifacts from RRC server?


1
1
Ankit Jain (21137) | asked Oct 16 '12, 2:45 a.m.
retagged May 25 '13, 4:19 p.m. by Scott Rich (57136)

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



permanent link
Gabriel Ruelas (1.1k13) | answered Oct 16 '12, 10:59 a.m.
Hi,
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.



Comments
Ankit Jain commented Oct 23 '12, 4:55 a.m.

Hi Gabriel,

I am not aware of how to get service document in the Requirement Creation factory section. Please provide me your suggestion.

Thanks in advance.


permanent link
Gabriel Ruelas (1.1k13) | answered Oct 23 '12, 9:00 a.m.
Hi, the steps to get the creation Factory information :

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
Ankit Jain commented Oct 23 '12, 10:20 a.m.

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.


abhishek gour commented Mar 22 '13, 4:12 a.m.

u have to add 
Accept: application/rdf+xml
OSLC-Core-Version: 2.0

these two headers then it works


permanent link
Gabriel Ruelas (1.1k13) | answered Oct 23 '12, 12:47 p.m.
Hi,
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
Ankit Jain commented Oct 29 '12, 1:42 a.m.

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?


Gabriel Ruelas commented Oct 29 '12, 10:59 a.m.

Is "rdm" is the name of your application ? or is it "rm" ?


Ankit Jain commented Oct 30 '12, 9:50 a.m.

It is "rm" type.


Gabriel Ruelas commented Oct 30 '12, 11:02 a.m.

is your query using rdm or RM ( based on your post above it looks like rdm is being used )


Ankit Jain commented Oct 31 '12, 12:45 a.m.

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?


Ankit Jain commented Nov 02 '12, 1:25 a.m.

Hi Gabriel,

Below is the snippet of the log from the RM Server:

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?

showing 5 of 6 show 1 more comments

permanent link
Ankit Jain (21137) | answered Oct 29 '12, 1:42 a.m.

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
Gabriel Ruelas commented Oct 29 '12, 11:01 a.m.

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.


Ankit Jain commented Oct 30 '12, 9:54 a.m.

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=""/>


Ankit Jain commented Oct 30 '12, 10:02 a.m.

Please tell me where I have to make correction in my query? Is it "quotes" that I have not used properly?


Gabriel Ruelas commented Nov 06 '12, 5:02 p.m.

Hi,
Sorry I was out on vacations, Any look with the query?


Ankit Jain commented Nov 08 '12, 7:13 a.m.

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=""/>


permanent link
Ankit Jain (21137) | answered Nov 12 '12, 4:09 a.m.
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=""/>


--------------------------------------------------------------------------------
Please advise me where I need to correct my query?

Your answer


Register or to post 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.