It's all about the answers!

Ask a question

How to use RM API/OSLC where clause using not equal / null conditions

Daniel Senko (171311) | asked Sep 01 '16, 2:33 p.m.
We've come a ways with our application that is using the RM API.  When we use the following to query against 5 custom attributes, we are able to retrieve a list of artifacts.





We have an attribute that may or may not have a value assigned.   From the following reference:

The parent!="*" query is semantically equivalent to the parent="NULL" query.

we are trying to query for artifacts where the last attribute does not have a value assigned; i.e. is null.  This is needed since we need to exclude the artifacts where a value is assigned.  We are unsuccessful with the following.  Is there anything wrong with the use of !=%22*%22


We initially tried and were unsuccessful with "" or " " such as


Any other ideas would be appreciated. 

Daniel Senko commented Sep 22 '16, 3:15 p.m.

Some more info:

we are working on a development project and are integrating with RDNG through the REST web service API.  We have run into a roadblock that we have not been able to overcome on our own but are hopeful you can help.

In brief we are trying to query the web service for artifacts where the event attribute is set to one of a list of values, or is null. 

Daniel Senko commented Sep 22 '16, 3:18 p.m.

• We can get attributes where the event attribute value is in the list of values by querying where event = value A, then querying where event = value B, etc, etc, and concatenating the result sets. 
• We cannot get a list of attributes by running a single query for “event in [value A, value B, etc, etc]. 
• We also cannot get a list of attributes where event is not set.

Daniel Senko commented Sep 22 '16, 3:18 p.m.

As a workaround for not being able to query where event is null, we have tried querying where event is not valid value A and event is not valid value B and event is not valid value C, etc, etc, for the entire list of valid values.  We were able to get this to run as a POST through the REST client in Firefox, after logging into the application directly.  We were not able to get this to work in our application where the login was processed through the web service; we receive a 403 forbidden error.

Daniel Senko commented Sep 22 '16, 3:19 p.m.

If possible, we would prefer to find a query for “where event is null”, rather than specifically excluding the entire list of valid values for the event attribute, as that is a very large list.


We have reviewed the OSLC standards for processing this type of query and believe what we are attempting to do should be possible. 

3 answers

permanent link
Lukas Steiger (3131628) | answered Jan 16 '19, 2:59 p.m.

 I had the same issue while is using the ClearQuest OSLC 2.0 API.

My use case:
check if an attribute has a value

My solution:

Will find all records where the 'myField' attribute is NOT:
- null
- empty ("")
AND the first character is NOT
-  space (" ")
- control character (see ASCII table)

permanent link
Donald Nong (14.5k614) | answered Sep 23 '16, 2:03 a.m.
edited Sep 23 '16, 2:04 a.m.
With my limited experience with OSLC API in CLM applications (RTC, QM and RM) and previously ClearQuest, I have never come across any implementation that can test for null, or empty value, or "not exists". The specification is one thing, and the implementation is another. Unless the OSLC specification says something is a MUST or SHOULD, it is up to the application to decide how to implement. The particular sample that you quoted may be just a smart way to achieve this, but I haven't seen it in CLM.

BTW, these are the specifications that RDNG would adhere to.

P.S. In the tutorial, not even the "!=" operator is mentioned.

permanent link
Jim Amsden (29337) | answered Dec 11 '17, 1:56 p.m.

 From Andri Berezovskyi:

 OSLC Query allows wildcards only on the left hand side of the operator, to filter properties. See the BNF over here, take a look at the following fragment:
term          ::= identifier_wc comparison_op value | identifier_wc space in_op space? in_val

scoped_term ::= identifier_wc "{" compound_term "}"

identifier_wc ::= identifier | wildcard

The problem you have is surfacing because RDF does not allow modelling a NULL value – it is "modelled" by a nonexistence of the triple, but the OSCL Query does not allow you to test for the presence of a property alone.
BUT, all OSLC Query implementations MUST respect semantics. So what you can do is the following:

oslc.where=rm_property:_j4WPQfawEeWWmYXMBVuVVw>="test" or rm_property:_j4WPQfawEeWWmYXMBVuVVw<="test" 

If IBM's OSLC Query implementation is compliant, it MUST retain the same semantics of the binary comparison operator.

Could you please help me post this answer?

Donald Nong commented Dec 12 '17, 12:21 a.m.

By the look of it, the sample oslc.where clause is testing "exists", right? The OP wants to test "not exists", or null.

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.