In two other threads, I discussed displaying morphology and syntax trees with Cascading Stylesheets. In the SBL 2014 talk that Micheal Palmer and I are doing, we will also show how to query syntax trees using XQuery, displaying the results with Cascading Stylesheets.
To query, we need data, so let's take a look at the way we represent syntax trees in XML again. Here is how we represent the sentence βλέπετε οὖν πῶς ἀκούετε in our syntax trees, which are derived from the Global Bible Initiative's syntax trees, but simplify the markup in order to make them easier to use for generic queries and to display with stylesheets:
XQuery is optimized for querying XML like this. The following query returns all sentences in the input:
Code: Select all
//sentence
Code: Select all
//wg
Code: Select all
//wg[@class='cl']
Code: Select all
//w[ @class = "verb" and @mood="indicative"]
Code: Select all
for $wg in //wg
where $wg/@class="cl"
and $wg/w[ @class = "verb" and @mood="indicative"]
return $wg