It's all about the answers!

Ask a question

Why is OSLC Query in Rational Team Concert not returning the expected result when I pass in specific parameters?


W Diu (58026) | asked Jan 04 '13, 3:16 p.m.
I have this query which works as expected: https://oslcqueryurl/?oslc.prefix=oslc_cm=<http://open-services.net/ns/cm%23>&oslc.where=oslc_cm:tracksChangeSet=<https://myserver/changesetId>

However, when I pass in additional parameters, it does not work as expected.

1) If I append &oslc.select=* or &oslc.select=dcterms:title to it, I do not get back any additional properties.  From what I understood, &oslc.select=* is supposed to give back all the properties and &oslc.select=dcterms:title is supposed to give back the title of the work item.  What did I do wrong with oslc.select?

2) Suppose I don't know the type of link, so I replaced oslc_cm:tracksChangeSet with *.  It doesn't work and gives the error: Unknown attribute id [*].  What is the correct syntax?

3) In the OSLC query spec at http://open-services.net/bin/view/Main/OSLCCoreSpecQuery, I am supposed to be able to add or oslc_cm:tracksChangeSet=<https://myserver/changesetId2> to the above.  But that gives an error.  What is the correct way to use or?

Accepted answer


permanent link
Jan Wloka (4161) | answered Jan 14 '13, 11:48 a.m.
JAZZ DEVELOPER
 You're almost there, just a couple of syntax problems. In general, for some good examples you could go to https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20. In particular the section Query Capabilities should help you in this case.

1) Querying for all or selected properties
Use no oslc.select for complete resources 
https://oslcqueryurl/workitems
Append &oslc.select, the property AND the prefix URL for selecting individual properties
https://oslcqueryurl/workitems?oslc.select=dcterms:title&oslc.prefix=dcterms=%3Chttp%3A//purl.org/dc/terms/%3E
	
2) Discover what's supported
For some examples on how to discover the provider's capabilities go to Discovery Mechanism

3) OR operator in queries
The OR works with brackets, e.g., &oslc.where=cm:severity in ["high","medium"].

https://oslcqueryurl/workitems?oslc.where=cm:severity in ["high","medium"]&oslc.select=oslc_cm:severity
	
A common mistake im most query attempts is to forget to escape all URL components. The actual URL would look like https://localhost:9443/jazz/oslc/contexts/_f_vywF5XEeK9rd6rj1tVjA/workitems?oslc.where%3Dcm%3Aseverity%20in%20%5B%22high%22%2C%22medium%22%5D&oslc.select=oslc_cm:severity

HTH,
Jan.

W Diu selected this answer as the correct answer

Comments
Buzz Moschetti commented Jan 14 '13, 12:42 p.m.

If operating in the OSLC v2 space, shouldn't we be asked for the query base resource and using that, e.g. (example taken from RM but same idea):

/rm/views?oslc.query=true&projectURL=https%3A%2F%2Frtc.jpmchase.net%3A9443%2Fjts%2Fprocess%2Fproject-areas%2F_Z__esDcNEeGHKNXfHpevWg&oslc.prefix=dc=<http://purl.org/dc/terms/>&oslc.where=dc:title="ABC"'



Buzz Moschetti commented Jan 14 '13, 3:06 p.m.

Whoops.   If you oslcqueryurl means the URL at the queryBase then I get it.   CCM and QM and RM have some web service inconsistencies and I incorrectly assumed oslcqueryurl was yet another means to get at the data (like the Requirements Reporting API)


W Diu commented Jan 14 '13, 3:36 p.m.

Thanks for your reply, Jan, and especially for that link to the examples.  It gives me a much better understanding of the expected syntax!

A question about the discovery mechanism: I tried
https://servername:port/ccm/oslc/contexts/_projectId/workitems/services.xml and it gives me back an XML document -- how do I tell if * operator is supported?

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.