Issues with constructing an oslc.where URL and valid XML results
Hello,
I'm currently working on a set of C# services and applications that require a certain degree of integration with our Rational Team Concert implementation. Specifically, I've been asked to present a list of Change Requests to which the currently logged in user subscribes so that they may add the URLs for these Change Requests with certain items in another application. I am attempting to obtain this list via a query in the style of https://<rtchost>:9443/ccm/oslc/contexts/_Tf1GwI4UEeGDLvoSNiZKIA/workitems?oslc.where=dc:identifier="5535" or something similar. However, no matter how I build the URL, I get a list in XML of ALL Change Requests in the system. In addition, the XML in the result set contains no information about the namespaces, which makes parsing the results more difficult. The XML just starts with a <oslc_cm:Collection> tag and proceeds from there. I'm sure the list is long, but what am I doing wrong here? |
Accepted answer
Hi James,
It looks like you need to say dcterms:identifier="5535". RTC is probably returning all change requests because it doesn't recognize what a dc:identifier is. See http://open-services.net/bin/view/Main/OSLCCoreSpecAppendixA.
For the XML result set, I think the oslc:usage information is returned as part of the QueryCapability resource, not the query itself. If you check the XML returned when you ask for http://open-services.net/ns/core#QueryCapability you might see it there.
- Jim
James Waslo selected this answer as the correct answer
Comments
James Waslo
commented Sep 30 '15, 3:15 p.m.
Hi Jim,
|
2 other answers
Hard to say without seeing the code, but I still suspect there's a problem with your parameters. The "dc:" or "dcterms:" is just a shortcut for "http://purl.org/dc/terms/". If you're not sure if you're actually getting the purl.org URI then you might want to check by typing the query manually.
If you've verified that, then you should check the OSLC CM Resource Definitions and the OSLC Core appendix A definitions. They have the official OSLC definitions (attributes) used in queries. Note that dcterms:identifier is defined in Core and CM as an internal ID not intended for display. So this might not be the simple numeric ID you're used to seeing in RTC (I'm not sure what they use for this). You might want to try oslc:shortId or oslc:shortTitle.
Comments
James Waslo
commented Oct 01 '15, 8:49 a.m.
Jim,
|
Seeing the response body (oslc_cm:Collection), I suspect that you are using
Accept Header equals to application/xml. With this value of the Accept Header and without OSLC-Core-Version: 2.0, the oslc.where did not worked for me. You must change Accept Header to application/rdf+xml or include OSLC-Core-Version: 2.0. And you have to use the identifier as dcterms:identifier or use the oslc.prefix parameter (only dc is not recognized). Ex.: ?oslc.where=dcterms:identifier=2
Comments
Fernando Silva
commented Oct 01 '15, 11:48 a.m.
I think that oslc_cm:Collection is from OSLC 1.0 and in that version you need to use oslc_cm.query=dc:identifier=... to filter results. See http://open-services.net/bin/view/Main/CmQuerySyntaxV1#Query_Syntax
James Waslo
commented Oct 01 '15, 2:13 p.m.
Fernando,
Fernando Silva
commented Oct 01 '15, 2:21 p.m.
Normally, I only got the 406 error when I forget to include the accept header. Could you share the code that create the url and execute the GET request? |
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.
Comments
Which version of RTC are you using? In my test, if the OSLC property is incorrectly defined, RTC will complain about it. I have never seen that RTC will ignore the oslc.where filter (well except for the partial representation).
Donald,
The server under target is running RTC 5.0.2, from what I understand. I'm not actually part of the RTC Development Team, just trying to consume some of its data. I'm equally puzzled by this behavior myself, but remain convinced I'm doing something wrong rather than RTC.
Thanks!