It's all about the answers!

Ask a question

Nested conditions in where clause of OSLC


Ragul S (1729) | asked Jan 13 '17, 3:45 a.m.
edited Jan 15 '17, 3:18 p.m.
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 ?? :(

Accepted answer


permanent link
Donald Nong (14.5k614) | answered Jan 15 '17, 7:28 p.m.
edited Jan 15 '17, 7:29 p.m.

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

Comments
Ragul S commented Jan 15 '17, 10:54 p.m. | edited Jan 15 '17, 10:55 p.m.

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


Donald Nong commented Jan 16 '17, 12:44 a.m.

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.


Ragul S commented Jan 16 '17, 12:47 a.m. | edited Jan 16 '17, 12:49 a.m.

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


Donald Nong commented Jan 16 '17, 7:17 p.m.

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?


Ragul S commented Jan 17 '17, 1:48 a.m.

 @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. 


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

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
Jim Amsden (29347) | answered Jan 13 '17, 8:51 a.m.

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


Comments
Ragul S commented Jan 14 '17, 3:20 a.m. | edited Jan 14 '17, 3:37 a.m.

@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
Jim Ruehlin (79114) | answered Jan 16 '17, 7:55 p.m.
JAZZ DEVELOPER

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



Comments
Donald Nong commented Jan 16 '17, 8:08 p.m.

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.


Ragul S commented Jan 17 '17, 1:42 a.m. | edited Jan 17 '17, 1:51 a.m.

 @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
Jim Ruehlin (79114) | answered Jan 17 '17, 8:26 p.m.
JAZZ DEVELOPER

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.


Comments
Ragul S commented Jan 18 '17, 12:52 a.m. | edited Jan 18 '17, 12:52 a.m.

@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 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.