Learn R Programming

emuR (version 2.5.0)

AddListRenameRemoveAttributeDefinitions: Add / List / Rename / Remove attribute definition to / of / from emuDB

Description

Add / List / Rename / Remove database operation functions for attribute definition to / of / from an existing level definition of an emuDB. Attribute definitions can be viewed as definitions of parallel labels for the annotational units (ITEMs) of the emuDB. Each level definition is required to have at least one default attribute definition that has the same name as the level definition (automatically created by add_levelDefinition). For more information on the structural elements of an emuDB see vignette(emuDB). Note that as with level definitions, an attribute definition to a level cannot be removed, if it contains labels in the emuDB.

As the only one of these operations, rename_attributeDefinition can also be used to manipulate (i.e. rename) a level definition. It is therefore not necessary to specify the name of the level that the attribute definition belongs to. While renaming a level or attribute definition, emuR will (1) rewrite the levelDefinitions in DBconfig, (2) rewrite the linkDefinitions in DBconfig, (3) rewrite the perspectives in DBconfig, (4) rewrite the anagestConfig in DBconfig, and (5) rewrite all _annot.json files. (5) May take quite a while, depending on the number of bundles in the database.

Usage

add_attributeDefinition(
  emuDBhandle,
  levelName,
  name,
  type = "STRING",
  rewriteAllAnnots = TRUE,
  verbose = TRUE
)

list_attributeDefinitions(emuDBhandle, levelName)

rename_attributeDefinition( emuDBhandle, origAttrDef, newAttrDef, verbose = TRUE )

remove_attributeDefinition( emuDBhandle, levelName, name, force = FALSE, rewriteAllAnnots = TRUE, verbose = TRUE )

Arguments

emuDBhandle

emuDB handle as returned by load_emuDB

levelName

name of level

name

name of attributeDefinition

type

type of attributeDefinition (currently only "STRING")

rewriteAllAnnots

should changes be written to file system (_annot.json files) (intended for expert use only)

verbose

if set to TRUE, more status messages are printed

origAttrDef

name of level/attribute definition in emuDB that is to be changed

newAttrDef

new name that shall be assigned to the level/attribute definition

force

delete all attribute definitions in annotations (== label entries)

Examples

Run this code
if (FALSE) {

##################################
# prerequisite: loaded ae emuDB 
# (see ?load_emuDB for more information)

# add additional attribute definition to the "Phonetic" level
# of the ae emuDB that will contain the UTF8 IPA
# symbols of the phonetic transcriptions
add_attributeDefinition(emuDBhandle = ae,
                        levelName = "Phonetic",
                        name = "IPA-UTF8")
                        
# list attribute definitions for level "Word"
# of the ae emuDB
list_attributeDefinitions(emuDBhandle = ae, 
                          levelName = "Word")

# remove newly added attributeDefinition
remove_attributeDefinition(emuDBhandle = ae,
                           levelName = "Phonetic",
                           name = "IPA-UTF8")
}

Run the code above in your browser using DataLab