What is the order of operations in JQL?

Rob Horan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 30, 2020

I have been looking through the documentation, but I haven't found an actual reference defining the order of operations.

I am studying for ACP-120

Is there a reference that clearly lays this out?

1 answer

1 accepted

2 votes
Answer accepted
Florian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 30, 2020

I hope I understand you question correctly and you want to know the operator precedence. If so then the answer is quiet easy. It’s the same as in almost every other language. The AND operator has a stronger binding as the OR operator. So as in normal algebra where a * b + c is (a * b) + c and a * (b * c) is (a * b) + (a * c) you can translate these rules into Boolean algebra. This mean a and b or c is (a and b) or c whilst a and (b or c) is actually (a and b) or (a and c). For the variables a, b and c you can use any kind of comparison like project = myproject. 

if you want to know more about it see https://en.m.wikipedia.org/wiki/Boolean_algebra

I hope this what you wanted to know. 

Rob Horan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 30, 2020

Hello, and thank you, and apologies for the long reply,

I am looking first and foremost for something that is explicitly defined for JQL.  Why?  Because I'm set to take the ACP-120 soon and I feel like I'm about to be out some money and a few hours of my life for a big fat F.  Having taken 100 (unsuccessfully) and 600 (successfully) I can tell you that the JQL questions are the toughest and most unnecessarily tricky of all.

To the point about any other language - I'm not a coder.  While I can have a robust conversation with a developer around (some) blocks of code, that's not something I can lean on, nor should it be a requirement for Jira Administration or ACP-120.  I understand how it can help, but, IMHO, if there's a stated "order of operations" that's important enough to be explicitly called out in the prep material:

  • It should be in the Jira documentation and searchable as "order of operations"
  • It should be fully fleshed out in the prep material

The CLOSEST I could find was the excerpt below, which is not an exact match:

Setting the precedence of operators

You can use parentheses in complex JQL statements to enforce the precedence of operators.

For example, if you want to find all resolved issues in the 'SysAdmin' project, as well as all issues (any status, any project) currently assigned to the system administrator (bobsmith), you can use parentheses to enforce the precedence of the boolean operators in your query, i.e.

(status=resolved AND project=SysAdmin) OR assignee=bobsmith

Note that if you do not use parentheses, the statement will be evaluated left-to-right.

You can also use parentheses to group clauses, so that you can apply the NOT operator to the group.

Am I to take this to mean that there are only three operations and that they take place in this order?

  • parentheses
  • AND
  • OR

If so, was it that difficult to state it like that?  

That last part was directed towards TPTB at Atlassian's documentation team, especially because I don't know if I'm actually correct there, or if there is more to this.

Florian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 31, 2020

Hi,

actually there are more. 

1. comparison (=, >=, is, in, not in. ~, ...)

2. Negation (not)

3. AND

4. OR

maybe this helps

Parentheses are (that is my opinion) not actually operators but grouping elements. If you consider parentheses as operators then place it above all others. 

https://confluence.atlassian.com/jiracoreserver084/advanced-searching-979408017.html

https://support.atlassian.com/jira-software-cloud/docs/advanced-search-reference-jql-operators/

But as I said before basically Atlassian sticks to the “common sense”. The reason why AND binds stronger then OR is that this allows us to apply the rules of an Abelian Group. 

https://en.m.wikipedia.org/wiki/Abelian_group

and Propositional calculus https://en.wikipedia.org/wiki/Propositional_calculus

where the distributive property https://en.wikipedia.org/wiki/Distributive_property can be applied.

When you have these fundamentals go in your flesh and blood it feels natural to have an operator precedence as described above. That’s what I meant with “common sense”.

 

 

Like # people like this
Rob Horan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 31, 2020

EXTREMELY helpful, thank you!!  If by chance we ever meet I owe you a pint!

Like Dawn Janacek likes this
Florian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 31, 2020

Cheers.

Like Rob Horan likes this
Rob Horan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 10, 2022

Also, did not get an F! (Just renewed that cert last week)

Like Artur Licks likes this

Suggest an answer

Log in or Sign up to answer