% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/generics.R, R/ontology_term_class.R,
%   R/struct_class.R, R/model_list_class.R
\name{ontology}
\alias{ontology}
\alias{ontology_term}
\alias{ontology_list}
\alias{[,ontology_list,ANY,ANY,ANY-method}
\alias{[[,ontology_list,ANY,ANY-method}
\alias{[<-,ontology_list,ANY,ANY,ANY-method}
\alias{length,ontology_list-method}
\alias{ontology,struct_class-method}
\alias{ontology,model_seq-method}
\title{Ontology for an object}
\usage{
ontology(obj, ...)

ontology_term(id)

ontology_list(...)

\S4method{[}{ontology_list,ANY,ANY,ANY}(x, i)

\S4method{[[}{ontology_list,ANY,ANY}(x, i)

\S4method{[}{ontology_list,ANY,ANY,ANY}(x, i) <- value

\S4method{length}{ontology_list}(x)

\S4method{ontology}{struct_class}(obj, ...)

\S4method{ontology}{model_seq}(obj, ...)
}
\arguments{
\item{obj}{a struct object}

\item{...}{character ontology IDs (e.g. STATO:0000046) or NULL for an empty list}

\item{id}{(character) The ontology term id e.g. 'STATO:0000046'}

\item{x}{the list}

\item{i}{The list item index}

\item{value}{an ontology_term() object}
}
\value{
\code{x[i]} returns a subset of list \code{x}

\code{x[[i]]} returns the ontology_term at index \code{i}.

\code{x[i] <-} replaces the list item at index \code{i}

\code{length(x)} returns the number of items in the list.
}
\description{
All \code{struct} objects have an "ontology" slot, which is a list of
ontology items for the object. The \code{ontology} method gathers
ontology items from an object and all \code{struct} objects that it inherits
to generate a complete list.

A base class in the \pkg{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 \pkg{struct} package. Stores
multiple `ontology_term` objects.
}
\examples{
M = example_model()
ontology(M)
\dontrun{
OT = ontology_term(id='STATO:0000046')
}
\dontrun{
OT = ontology_list(terms=list(
    ontology_term(id =  'OBI:0200051'),
    ontology_term(id ='STATO:0000046')
)
}
\dontrun{
OL = ontology_list('STATO:0000046')
OL[1] # an ontology list
}

\dontrun{
OL = ontology_list('STATO:0000046')
OL[[1]] # an ontology_item
}

\dontrun{
OL = ontology_list('STATO:0000046')
OL[1] = ontology_term('STATO:0000302')
}
\dontrun{
OL = ontology_list()
length(OL) # 0
}
}
