Personal tools
You are here: Home Documentation Analysing annotations JAST NXT sample queries

JAST NXT sample queries

Examples of using the FunctionQuery tool to query JAST NXT data

FunctionQuery

FunctionQuery is provided as part of the NXT analysis toolkit for analysis and export of NXT data in tab-delimited format. The sample queries detailed below will work with FunctionQuery, and those that do not use the FunctionQuery extensions (denoted by the @function() attribute) are standard NXT queries that can be used in any query within NXT, including the search box within JastCoder. Queries of the form "For each result give me these attributes" are NXT complex queries.

Complex queries are given to FunctionQuery like this:

FunctionQuery -c corpus -o observation -q for_each_query -atts list of attributes

Be sure to set up the classpath before using FunctionQuery, as explained in the FunctionQuery usage page.

Sample Queries

All the queries below should be appended to a FunctionQuery command line like:

java FunctionQuery -c corpus -o observation -q (query goes here)

To fully understand how queries are constructed, it is also useful to look at the JAST NXT data structure.

Simple extraction

For each trial, give me: Break count and score

($t trial) -atts $t@breaks $t@score

From WIKI/NXTAnalyses

These were used to generate the per phase information.

When do participants speak?

This example was used in the JCTe1 / JCTe2 analysis, to ask, "For each phase, give me: (item in "Column header").

A table is to be generated in CSV format with one row per phase and with the following columns: Using FunctionQuery as the generator, with a query of '($p phase)', the final column describes the attribute that returns the desired information.

NOTE: The atts in the final column need to be enclosed in single quotes ' ' since the $ character used in them has special meaning at the command prompt.

Column header Contents Query in English FunctionQuery -atts
Experiment/diad e.g. jcte1_01 the experiment of the current phase experiment
Trial e.g. Trial1 the nite:id of the trial that is in the same experiment as this phase ($p) and overlaps it ( # ) '@extract(($t trial):$p@experiment==$t@experiment && $p#$t, nite:id)'
Roles Assigned true or false the roles_assigned attribute of the experiment of the current phase '@extract(($e experiment):$e@experiment == $p@experiment, roles_assigned)'
Speech Allowed true or false the speech attribute of the first trial that is in the same experiment as the current phase and overlaps it '@extract(($t trial):$p@experiment==$t@experiment && $p#$t, speech)'
Show Gaze true or false the showgaze attribute of the first trial that is in the same experiment as the current phase and overlaps it '@extract(($t trial):$p@experiment==$t@experiment && $p#$t, showgaze)'
Speech Order first or second the speechorder attribute of the experiment of the current phase '@extract(($e experiment):$e@experiment == $p@experiment, speechorder)'
Start Start time of phase (seconds from experiment start) the starttime of the current phase starttime
End End time of phase (seconds from experiment start) the endtime of the current phase endtime
Duration Duration of phase (seconds) the duration of the current phase duration
Phase Plan or Process or Dock or Break or Final the type of the current phase type
# words A number of words spoken by A (words can be counted twice if their enclosing segment overlaps a phase boundary) the count of all the words (  w ) that are descendants of ( ^ ) a segment that is in the same experiment as the current phase and overlaps it, where that word is spoken by agent "a" and is not ( ! ) punctuation ( punc ) '@count(($w w)($s segment):$p@experiment==$s@experiment && $p#$s && $s^$w && $w@agent=="a" && !$w@punc)'
# words B number of words spoken by B (words can be counted twice if their enclosing segment overlaps a phase boundary) the count of all the words (  w ) that are descendants of ( ^ ) a segment that is in the same experiment as the current phase and overlaps it, where that word is spoken by agent "b" and is not ( ! ) punctuation ( punc ) '@count(($w w)($s segment):$p@experiment==$s@experiment && $p#$s && $s^$w && $w@agent=="b" && !$w@punc)'
duration words A total time A was speaking in this phase (seconds) - by segment the total overlapduration of all the segments in that are in the same experiment as the current phase and overlap it, where that segment is spoken by agent "a" '@overlapduration(($s segment):$p@experiment==$s@experiment && $p#$s && $s@agent=="a")'
duration words B total time B was speaking in this phase (seconds) - by segment the total overlapduration of all the segments in that are in the same experiment as the current phase and overlap it, where that segment is spoken by agent "b" '@overlapduration(($s segment):$p@experiment==$s@experiment && $p#$s && $s@agent=="b")'
who speaks first A or B or - the agent attribute of the first segment (in order of starttime) that is in the same experiment as the current phase and overlaps it '@extract(($s segment):$p@experiment==$s@experiment && $s#$p, agent)'
continuation from previous phase 0 (no continuation), 1 or 2 (both continued) the count of all segments that are in the same experiment as the current phase and overlap it and also overlap the phase preceding the current one. '@count(($s segment)($q phase):$s@experiment == $p@experiment && $s#$p && $s#$q && $q precedes $p)'
dock grabbed first A or B or - the agent attribute of the first mouse action (in order of starttime) that is in the same experiment as the current phase and overlaps it. (In a dock the only mouse actions are move actions by definition) '@extract(($a action):$p@experiment==$a@experiment && $a#$p, agent)'
words spoken by A in all segments that overlap current phase extract all (from 0 to end) segments (and the words that are their children) that are in the same experiment as the current phase and overlap it '@extract(($s segment):$s@experiment==$p@experiment && $p # $s && $s@agent=="a", $s, 0, 0)'
words spoken by B in all segments that overlap current phase extract all (from 0 to end) segments (and the words that are their children) that are in the same experiment as the current phase and overlap it '@extract(($s segment):$s@experiment==$p@experiment && $p # $s && $s@agent=="b", $s, 0, 0)'
Document Actions