Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Nested conditions in where clause of OSLC

I wanted to query Clearquest records using OSLC.

Is nested conditions possible in where clause of oslc ?


Ex : 
oslc.where=(name="James" and age>25 and (operatingStatus=null or operatingStatus="Active") )

If not, what is the way to extract using such nested where condition ?
Am new to OSLC. Any help will be extremely useful.

Any update on this ?? :(

0 votes


Accepted answer

Permanent link

The main problem with this, with ClearQuest or not, is that OSLC does not allow the "OR" operator. Take a look at the "boolean_op" section, and it clearly states that

The only boolean operation allowed is " and " which represents conjunction. The boolean operator " or " for disjunction is not allowed in the interests of keeping the syntax simple.
In other words, what you want to achieve is impossible with the current implementation.

Ragul S selected this answer as the correct answer

1 vote

Comments

 @DonaldNong  Thanks for the reply.. Any idea if clearquest support querying records using SPARQL ??

I'm not in development so I cannot give you the answer. Since ClearQuest supports OSLC now, not SPARQL, I would say it will never happen.

@Donald Nong
 Could you please tell me Why is it so ?  are OSLC & SPARQL mutually exclusive ?

No, they're not mutually exclusive. RDNG provides both functionalities. Adding support for a particular technology, in this case SPARQL, may require an architect change of the product, which is costly and risky. Is there a compelling reason you have to use SPARQL in ClearQuest?

 @Donald Nong

 Thanks for explanation. No.. Actually my queries will have "Nested Where conditions", regex pattern matching and null checking, and these are not supported by OSLC. So, I was searching about other ways and i ended up in SPARQL.

If you know any other simpler and easier way to achieve these things, please let me know. It'll be extremely helpful. 

In ClearQuest, you can customize the SQL query, but that's another can of worms. What I would suggest is to learn how the product works and work with what is available. You just can't think of a great idea and expect the product to implement it straightaway.

showing 5 of 6 show 1 more comments

3 other answers

Permanent link

The OSLC query where clause does include support for nested property queries. See http://open-services.net/bin/view/Main/OSLCCoreSpecQuery#oslc_where.

0 votes

Comments

@Jim , Thanks for the reply.. I want to apply where condition like "A=1 & B=2 & (C=3 || D=4)" where A,B,C,D are properties of a record in Clearquest..   Am able to do "X.Y.Z>19"..  All I need to know is nested conditions in where clause, not nested property in where clause..


Permanent link

The in_op query operator was made to address this sitation. It returns TRUE for any value that matches what's in a list. So something like:

See the description of this in the OSLC Query Spec.

Good luck,
Jim Ruehlin


0 votes

Comments

There is something in the original request that cannot be handled by OSLC - testing for null. It's a big ask without knowing the limitation of OSLC.

 @Jim Ruehlin  Thanks for the reply. But my question is not about
Ex:1
Status="Passed" or 
Status="Ok",

it is about
Ex:2
 
Status="Passed" or OverrideStatus="Override".  

I don't want OR for different values of same field, I want to use it to check two different fields.. The in_op won't help in this case right ??


Permanent link

The only other thing I can think of is to try and factor out the OR:


Status="Passed" or OverrideStatus="Override" is the same as NOT(Status != "passed" AND OverrideStatus != "Override)
The stuff inside the parens is doable in OSLC, but there's no NOT operator in OSLC and I'm not clear about nesting statements in OSLC queries. I spent 5 mins and can't think of a way, but maybe there's something out there that'll work.

0 votes

Comments

@Jim Ruehlin Thanks for spending time :) . Exactly, the same problem I also faced.. As they said OSLC is meant to be used for very very simple queries only it seems. :(

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,023
× 516
× 62

Question asked: Jan 13 '17, 3:45 a.m.

Question was seen: 5,835 times

Last updated: Jan 24 '17, 12:21 a.m.

Confirmation Cancel Confirm