Adding Locators to Clarify RAQL Row Detection
If you need to override the default XML or JSON objects in a dataset that RAQL treats as rows, you can add a specific path to the elements you need to the variable in the From clause. For this example:
select firstname, lastname, state
from congress/response/legislators/legislator
The variable is congress and /response/legislators/legislator is the path to the element for rows.
The path uses XPath syntax, starting with a slash (/) and separating each level of elements within the hierarchy with a slash. See
Load Data with <invoke> for an example of a From clause using paths.
For overriding the default JSON locators, you can add a specific locator expression to the From clause. For this example:
select firstname, lastname, state
from congress/"?response?legislators?*"
The variable is congress and "?response?legislators?*" is the locator of the row objects. The locator uses XQuery map- and array-lookup syntax. A slash (/) indicates the presence of a locator expression, and the expression itself uses unary and postfix lookup operators (?). See https://www.w3.org/TR/xquery-31/#id-lookup for details.