ontology {struct} | R Documentation

## Ontology for an object

### Description

All `struct` objects have an "ontology" slot, which is a list of ontology items for the object. The `ontology` method gathers ontology items from an object and all `struct` objects that it inherits to generate a complete list.

A base class in the struct package. Stores ontology information e.g. term, description, id etc for struct objects and provides methods for populating these fields using the 'rols' package.

A base class in the struct package. Stores multiple 'ontology_term' objects.

### Usage

    ontology(obj, cache = NULL)

    ontology_term(
      id,
      ontology = character(),
      label = character(),
      description = character(),
      iri = character(),
      rols = TRUE
    )

    ontology_list(terms = list())

    ## S4 method for signature 'ontology_list,ANY,ANY,ANY'
    x[i]

    ## S4 replacement method for signature 'ontology_list,ANY,ANY,ANY'
    x[i] <- value

    ## S4 method for signature 'ontology_list'
    length(x)

    ## S4 method for signature 'struct_class'
    ontology(obj, cache = NULL)

### Arguments

`obj` | a struct object
`cache` | a named list of ontology_terms for offline use. Terms from the cache are search based on the name of the list items matching the ontology id. If cache=NULL then the OLS API is used to lookup terms.
`id` | (character) The ontology term id e.g. 'STATO:0000555'
`ontology` | (character) The ontology the term is a member of e.g. 'stato'
`label` | (character) The label for the ontology term
`description` | (character) The description of the term
`iri` | (character) The Internationalized Resource Identifier for the term
`rols` | (logical) TRUE or FALSE to query the Ontology Lookup Service for missing label, description or iri if not provided as input. Default rols = TRUE
`terms` | A list of ontology_term objects.
`x` | the list
`i` | The list item index
`value` | an ontology_term() object

### Value

model at the given index in the sequence

model sequence with the model at index i replaced

the number of models in the sequence

### Examples

    M = example_model()
    ontology(M,cache=NULL)
    ## Not run:
    OT = ontology_term(id='STATO:0000555')

    ## End(Not run)
    ## Not run:
    OT = ontology_list(terms=list(
        ontology_term(ontology='obi',id =  'OBI:0200051'),
        ontology_term(ontology='stato',id ='STATO:0000555')
    )

    ## End(Not run)
    ## Not run:
    OL = ontology_list('STATO:0000555')
    OL[1]

    ## End(Not run)

    ## Not run:
    OL = ontology_list('STATO:0000555')
    OL[1] = ontology_term('STATO:0000302')

    ## End(Not run)
    ## Not run:
    OL = ontology_list()
    length(OL) # 0

    ## End(Not run)

[Package struct version 1.6.0 Index]