It's all about the answers!

Ask a question

How can I use OSLC to query for work Items whose title contains a particular string?

selin köykiran (2823) | asked Jul 09 '12, 8:39 a.m.
edited Jul 09 '12, 2:54 p.m. by Geoffrey Clemm (30.1k23035)
Hello everybody,

I wonder if I can query work items whose title contains some specific word. Here is my code line:
 "&oslc.where=" + URLEncoder.encode("dcterms:title="+"\"SLN\"", "UTF8");
 For example ,I want to search work items whose title includes "SLN" word in it. But above in my code line ,I just can get the work items whose title is directly ="SLN". So I want to get the work items whose title is SLN and contains also "SLN" word group in it. How can I change my code line ? I hope I could explain what I want and what I get.
thank you.

Accepted answer

permanent link
Gabriel Ruelas (1.1k13) | answered Jul 09 '12, 2:16 p.m.
  The requested query is currently not defined/supported by OSLC V2 spec. Client code can not use wild cards on aftifacts fields.
selin köykiran selected this answer as the correct answer

selin köykiran commented Jul 09 '12, 4:45 p.m. | edited Jul 09 '12, 5:23 p.m.

Good to know.Thank you for that answer. 

selin köykiran commented Jul 10 '12, 3:18 a.m.

I also want to ask that again in the same line can I query by artifact type?

For example:

"&oslc.where=" + URLEncoder.encode("dcterms:type=" + "ABC", "UTF8")

here is ABC, my own type which created by me in Jazz Team Server.I want to get work items whose artifact type is ABC in Jazz team server. This type of usage is possible or not in OSLC V2?Because I did lots of researches about it but I couldn't find anything. Thanks.

6 other answers

permanent link
Gabriel Ruelas (1.1k13) | answered Jul 10 '12, 10:05 a.m.

To query for an specific type the URL of the desired type must be used. For instance, in my environment the FEAT type is represented by : "", then to request all requirement of type FEAT following query must be used:


The service document of the Project Area exposes all the artifacts types ( Check the Creation factories )

selin köykiran commented Jul 11 '12, 3:12 a.m. | edited Jul 11 '12, 3:40 a.m.

Thank you for that answer.I want to ask that how can I know my environment? I mean ,how can I know the ABC type's link ,in between the other types? Because I check the creation factory and I saw lots of types but how can I resolve something like yours :PDQfocSMEeGA8-GkKWmlAA. How can I define my type's name?Thanks again.

permanent link
Gabriel Ruelas (1.1k13) | answered Jul 11 '12, 9:25 a.m.
The type URL must be enclosed by <> chars. like :
    &oslc:where=rm:ofType=<Your type URL>
Where "Your Type URL" could be something like :
           "      "

NOTE : Char " must NOT be included ( I just added here to try to avoid the automatic format ).

Regarding your above question: you can do a GET to the URL type as follows :

Headers :

Action :   GET
URL :      " "
Note: Do not include " chars
It will give information about the artifact type.

PLS let me know if more questions

permanent link
Gabriel Ruelas (1.1k13) | answered Jul 11 '12, 6:40 p.m.
1) rm:ofType should work, problem should be in other part of the query
2) rm is the default name in the URLs for RRC, but in can be changed, in my env it is named rdm. You should be using the one in your env,

If following is a valid resource type in your environment:
" "

Then you can test using following oslc.where line :

Note: I removed the encoding because it seems to be needed in this specific case.

Are you using an HTTP requester or Poster to test ? It will be easier to test there and then move the query to the code.

selin köykiran commented Jul 12 '12, 9:51 a.m.

I use Restful Client Api in Mozilla web browser.I checked my creation factory and the other things from there. I used your query in my code exactly same.But I again couldn't make the code work correctly. Can my prefix be wrong? Here: ","+ URLEncoder.encode("rm=<http:"" xmlns="" rdm="" rdf=""/>", "UTF8") this prefix is true for rm:ofType ? Sorry I asked too much ,but It's really important for me to run this code and get my result correctly. Thanks again for your answers.

permanent link
Gabriel Ruelas (1.1k13) | answered Jul 12 '12, 10:15 a.m.
That means that the query works fine on the REstFull Client?  If so, could you pls paste it here ?

It should looks like :<>,rm=<>&oslc:where=rdf:type=<>

selin köykiran commented Jul 12 '12, 10:24 a.m.

Thanks for everything , but after my last question I tried last time and it worked:)) I'm too happy thank you so much :) It really worked,finally. Thanks again Gabriel Ruelas:)

permanent link
selin köykiran (2823) | answered Jul 11 '12, 7:11 a.m.
edited Jul 11 '12, 7:33 a.m.
Gabriel Ruelas, I have one more question about subject:

 By the way I think I found my environment and  tried your solution for my answer for example this is my environment: .

I wrote something like that in java for that environment : 

         [1]       String type = "";
 [2] String type2="_ 4dvf0LoNEeG8aNjNIIRtMQ ";
 [3] String oslcSearchByIdentifierQuery = queryCapabilityURI + "&oslc.prefix="+        URLEncoder.encode("dcterms=<>", "UTF8") +
 [4] ","+ URLEncoder.encode("rm=<>", "UTF8") +
 [5] "," + URLEncoder.encode("rdf= <>", "UTF8")+
 [6] "," + URLEncoder.encode("rdfs= <>", "UTF8")+
 [7] "&" + URLEncoder.encode("dcterms:title", "UTF8") +            
 [8] "&oslc.where=" + URLEncoder.encode("rm:ofType="+type,"UTF8")+"/rm/"+                  [9]URLEncoder.encode("types="+type2,"UTF8");

But I think somethings are wrong. Because I got error all the time with this code lines. I tried your solution in this way in my project but I couldn't make run it,yet. Can you see any wrong thing in my code?I think there is a problem with my syntax of environment or query.And what is rm:ofType? Is there any usage of rm like that?Thanks for sharing your answer with me. 

permanent link
selin köykiran (2823) | answered Jul 11 '12, 5:51 p.m.
Thanks . I  have one more question. Now this is my new code lines:

String oslcSearchByIdentifierQuery = queryCapabilityURI + "&oslc.prefix="+ URLEncoder.encode("dcterms=<>", "UTF8") +
","+ URLEncoder.encode("rm=<>", "UTF8") +
"," + URLEncoder.encode("rdf= <>", "UTF8")+
"&" + URLEncoder.encode("dcterms:title", "UTF8") +            
"&oslc.where=" + URLEncoder.encode("rdf:type=<https://abcd>","UTF8");

But here I used rdf:type not rm:ofType! With this code I can run my program but I could't get anything,any work-items. So something again is wrong.Now I have two questions: 1-) I couldn't find anything about rm:ofType .Is it working or not? Because in my code it didn't work. 2-) In my creation factory I can find my environment and type link but in my link  there is ... /rm/types /... not  .../rdm/types/..., like yours. Is it a problem or Is it normal? I have to ask all the things ,even little one .Because I've  tried everyway but still I can't get the work-items by artifact -type.

Thanks again for the answers.

Your answer

Register or to post your answer.