Learn R Programming

emuR (version 1.0.0)

query: Query emuDB

Description

Function to query an emuDB

Usage

query(emuDBhandle, query, sessionPattern = ".*", bundlePattern = ".*",
  queryLang = "EQL2", timeRefSegmentLevel = NULL, resultType = NULL,
  calcTimes = TRUE, verbose = FALSE)

Arguments

emuDBhandle

emuDB handle object (see load_emuDB)

query

string (see vignette EQL)

sessionPattern

A regular expression pattern matching session names to be searched from the database

bundlePattern

A regular expression pattern matching bundle names to be searched from the database

queryLang

query language used for evaluating the query string

timeRefSegmentLevel

set time segment level from which to derive time information. It is only necessary to set this parameter if more than one child level contains time information and the queried parent level is of type ITEM.

resultType

type (class name) of result

calcTimes

calculate times for resulting segments (results in NA values for start and end times in emuseg/emuRsegs). As it can be very computationally expensive to calculate the times for large nested hierarchies, it can be turned off via this boolean parameter.

verbose

be verbose. Set this to TRUE if you wish to choose which path to traverse on intersecting hierarchies. If set to FALSE (the default) all paths will be traversed (= legacy EMU bahaviour).

Value

result set object of class resultType (default: emuRsegs, compatible to legacy type emusegs)

Details

Evaluates a query string of query language queryLang on an emuDB referenced by dbName and returns a segment list of desired type resultType. For details of the query language please refer to the EQL vignette (type: vignette('EQL') ). Returns a list of segments which meet the conditions given by the query string. A segment can consist of one (e.g. 's') or more (e.g. 's->t') items from the specified emuDB level. Segment objects (type 'SEGMENT') contain the label string and the start and end time information of the segment (in msec). emuRsegs objects additionally contain sample position of start and end item. Time information of symbolic elements (type 'ITEM') are derived from linked SEGMENT levels if available. If multiple linked SEGMENT levels exist, you can specify the level by argument timeRefSegmentLevel. If time and sample values cannot be derived they will be set to NA. emuRsegs result lists will be ordered by the hidden columns UUID, session, bundle and sample start position. Legacy emusegs lists are ordered by the columns utts and start. The query may be limited to session and/or bundle names specified by regular expression pattern strings (see regex) in parameters sessionPattern respectively bundlePattern.

See Also

load_emuDB

Examples

Run this code
# NOT RUN {
##################################
# prerequisite: loaded ae emuDB 
# (see ?load_emuDB for more information)

## Query database ae with EQL query "[Phonetic=t -> Phonetic=s]":
## 'Find all sequences /ts/ in level Phonetics'.
## and store result seglist in variable segListTs

seglistTs=query(ae, "[Phonetic == t -> Phonetic == s]")

## Query database ae with EQL query "[Syllable == S ^ Phoneme == t]":
## 'Find all items 't' in level Phoneme that are dominated by items 'S' in level Syllable.'
## Return legacy Emu result type 'emusegs'

query(ae, "[Syllable == S ^ Phoneme == t]", resultType="emusegs")

## Query 'p' items of level Phoneme from bundles whose bundle names start with 'msajc07' 
## and whose session names start with '00'
## (Note that here the query uses the operator '=' (meaning '==') which is kept for 
##  backwards compatibilty to EQL1.)  

query(ae, "Phoneme = p", bundlePattern = "msajc05.*", sessionPattern = "00.*")

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab