It's all about the answers!

Ask a question

How to write OSLC RM query for artifacts where Status is in a set?


Robert Huet (23112684) | asked Feb 13 '17, 3:09 p.m.
edited Feb 13 '17, 3:10 p.m.

 I have a working OSLC query against JKE Banking in DNG 6.0.2 which returns all modules of type "Use Case Specification" and Status of "Approved".  However, I would like to match on a set of potential Status values.  I've tried the " in " notation described in the OSLC standard, and I've also tried doing an " or", but no luck either way.  Is this supported in DNG 6.0.2?


I've included section of my query that tests for a single Status value:

Thanks,
Robert

Accepted answer


permanent link
Donald Nong (14.5k414) | answered Feb 14 '17, 1:21 a.m.

You will need to use the attribute rdf:type to specify RequirementCollection (collections and modules), and oslc:instanceShape to specify the artifact type (you need to first identify the resource URI of the type). So the extra OSLC filters look like this (I add extra spaces in between to avoid the messed-up format):

& oslc.prefix=rdf=< http://www.w3.org/1999/02/22-rdf-syntax-ns % 23 >& oslc.where=rdf:type=< http://open-services.net/ns/rm % 23RequirementCollection >& oslc.prefix=oslc=< http://open-services.net/ns/core % 23>& oslc.where=oslc:instanceShape=< https://clm602.example.com:9443/rm/types/_s40G4X57EeagE4RXfi8TMg >

More information can be found in this article.
https://jazz.net/library/article/1197

Robert Huet selected this answer as the correct answer

Comments
Robert Huet commented Feb 14 '17, 5:58 p.m.

Thanks, Donald, I have added the rdf:type and oslc:instanceShape as shown above, and I can query successfully on "Status" of "Approved".  The problem is how to query on "Status" of "Approved" OR "Draft".  It appears that the "oslc.where" clauses act as implicit "AND" operators.  How do you do an "Or" or an "In"?  I'm not finding any examples of this in the link that you reference above.

The OSLC Spec shows a syntax for "IN", but I could not get that to work.
Thanks,
Robert


Donald Nong commented Feb 14 '17, 7:18 p.m.

It been discussed many time on this forum - OSLC does not support OR operator. The best you can get when testing the same filter for the OR condition is the IN operator (you're out of luck if testing different filters). It should not be difficult to construct such query URLs but it's tricky to escape or not escape certain characters in the URL. The filter for Status that I use in my own environment is shown below (this time as an image)

Note that I escape the two pound signs and comma in the URL, and you can tell them by the leading percentage sign (%). I'm using RESTClient within Firefox if that matters.


Donald Nong commented Feb 14 '17, 7:23 p.m.

I re-read your comment and realized that you may have missed something. The article does include the sample for IN with this description:

'For queries that are based on a link type that uses the “in” modifier, select everything by using the wildcard character (*). This example uses the implementedBy link type'


Robert Huet commented Feb 15 '17, 10:32 a.m.

 That was it!  Once I escaped the comma, it worked perfectly!  Thanks, Donald!

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.