Smart Taxonomy Constructor taxonomy is an S4 class to create a taxonomy object for use with smart.data.

Value

An object of class "taxonomy"

Slots

term

A symbol indicating the term to be accessed with smart.data method $use(): must be of class 'language'

desc

A text description of the term

fields

One or more strings indicating the fields in smart.data$data that map to the taxonomy term

law

Passively set: used by smart.data method $enforce.rules()

state

A string indicating whether the taxonomy term has been processed by smart.data method $enforce.rules()

Examples

library(smart.data)
new("taxonomy", term = "identifier", desc = "Identifies unique instances of a type of reference")
#> An object of class "taxonomy"
#> Slot "term":
#> [1] "identifier"
#> 
#> Slot "desc":
#> [1] "Identifies unique instances of a type of reference"
#> 
#> Slot "fields":
#> character(0)
#> 
#> Slot "law":
#> {
#>     cur_fields <- self$smart.rules$for_usage[["identifier"]]@fields
#>     new_fields <- if (rlang::is_empty(cur_fields) || identical(cur_fields, 
#>         "")) {
#>         NULL
#>     }
#>     else {
#>         names(purrr::keep(attr(self$smart.rules$for_naming, "history"), 
#>             function(i) any(i %in% self$smart.rules$for_usage[["identifier"]]@fields)))
#>     }
#>     if (!rlang::is_empty(new_fields)) {
#>         self$smart.rules$for_usage[["identifier"]]@fields <- new_fields
#>     }
#>     invisible(self)
#> }
#> 
#> Slot "state":
#> [1] "pending"
#>