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?
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
Comments
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.
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
Donald Nong
Oct 01 '15, 2:31 a.m.James Waslo
Oct 01 '15, 9:16 a.m.