The examples in this topic illustrate how to construct dimension value paths using EQL syntax rules.
The examples use the Genre dimension, which has this hierarchy:
Genre Fiction Classic Literature Science-fiction Non-fiction
The Fiction dimension value has two descendants (Classic and Science-fiction), while the Non-fiction dimension value has no descendants (that is, it is a leaf dimension value).
The first example query is made against the dimension named Genre (the
dimName
argument). It uses one step specifier for the
root dimension value (also named Genre). The query returns all records that are
tagged with the Genre dimension value, including all its descendants (such as
the Classic dimension value).
collection()/record [ Genre = collection("dimensions")/dval[name="Genre"]//id ]
The next example query uses two step specifiers in the predicate. The dimension value path begins with the dimension name (Genre), followed by the root dimension value name (also Genre), and finally the Fiction child dimension value. The query returns all records that are tagged with the Fiction dimension value, including its three descendants (Classic, Literature, and Science-fiction). Records tagged only with the Non-fiction dimension value are not returned because it is not a descendant of Fiction.
collection()/record [ Genre = collection("dimensions")/dval[name="Genre"] /dval[name="Fiction"]//id ]
The next example query uses three step specifiers to drill down to the Classic dimension value, which is a descendant of Fiction. The query returns all records that are tagged with the Classic dimension value or its Literature descendant. The example also shows the use of * (instead of dval) in the step specifier.
collection()/record [ Genre =collection("dimensions")/*[name="Genre"] /*[name="Fiction"]/*[name="Classic"]//id ]
The final example shows how you can use the
or
operator to specify two dimension value paths. The
query returns records tagged with either the Science-fiction or Non-fiction
dimension values. Using the
and
operator in place of the
or
operator here would return records tagged with both
the Science-fiction and Non-fiction dimension values.
collection()/record [ Genre = collection("dimensions")/dval[name="Genre"] /dval[name="Fiction"]/dval[name="Science-fiction"]//id or Genre = collection("dimensions")/dval[name="Genre"] /dval[name="Non-fiction"]//id ]