GNQuery expression can use all standard XPath 1.0 operators (see http://www.w3schools.com/xpath/xpath_operators.asp), so for example
gn4:image[@pixWidth*@pixHeight > 10000]
returns all images with an area greater than 10,000 square pixels, whereas:
gn4:image[@pixWidth > 0 and @pixWidth div @pixHeight > 1]
returns all images with an aspect ratio (height divided by width) greater than 1.
As per XPath standard the divisions are always non-integer – i.e. they return fractional (floating-point) values even when dividing integer quantities. For integer divisions there is an operator ‘idiv’ (as in XPath 2.0), so:
gn4:image[@pixWidth > 0 and @pixWidth idiv @pixHeight > 1]
returns all images with an aspect ratio of at least 2 – because idiv returns 1 for any aspect ratio less than that.
As in standard XPaths the evaluation of relational operators (‘=’, ‘!=’, ‘<’, ‘>’, ‘>=’ and ‘<=’) uses special rules when using node-sets, e.g.:
gn4:keywords/gn4:item
is a node-set containing all the ‘gn4:item’ sub-elements of the ‘gn4:keywords’ element, the expression:
gn4:keywords/gn4:item='bridges'
is true if ANY of the nodes in the node-set matches the condition – so if there is at least one keyword ‘bridges’; similarly the comparison of two node sets like:
gn4:objs/gn4:ref/gn4:title=gn4:objs/gn4:ref/gn4:caption
is true if any of the nodes in the first set matches any of the nodes in the second set – i.e. if there is any of the titles equal to any of the captions.
The arithmetic operators on the other hand simply use the first value in any node set. The logical operators (‘and’ and ‘or’) convert the node-sets to booleans first (non-empty = true, empty = false) and then combine the results.