| BiodbEntryField | R Documentation |
A class for describing an entry field.
A class for describing an entry field.
This class is used by BiodbEntryFields for storing field
characteristics, and returning them through the get() method. The
constructor is not meant to be used, but for development purposes the
constructor's parameters are nevertheless described in the Fields section.
The constructor accepts the following arguments:
name: The name of the field.
alias: A character vector containing zero or more aliases for the field.
type: A type describing the field. One of: "mass", "name" or "id". Optional.
class: The class of the field. One of: "character", "integer", "double", "logical", "object", "data.frame".
card: The cardinality of the field: either "1" or "*".
forbids.duplicates: If set to TRUE, the field forbids duplicated values.
description: A description of the field.
allowed.values: The values authorized for the field.
lower.case: Set to TRUE if you want all values set to the field to be forced to lower case.
case.insensitive: Set to TRUE of you want the field to ignore case when checking a value.
computable.from: The Biodb ID of a database, from which this field can be computed.
virtual: If set to TRUE, the field is computed from other fields, and
thus cannot be modified.
virtual.group.by.type: For a virtual field of class data.frame, this indicates to gather all fields of the specified type to build a data frame.
new()New instance initializer. This class must not be instantiated directly. Instead, you access the instances of this class through the BiodbEntryFields instance that you get from the BiodbMain instance.
BiodbEntryField$new(
parent,
name,
alias = NA_character_,
type = NA_character_,
class = c("character", "integer", "double", "logical", "object", "data.frame"),
card = c("one", "many"),
forbids.duplicates = FALSE,
description = NA_character_,
allowed.values = NULL,
lower.case = FALSE,
case.insensitive = FALSE,
computable.from = NULL,
virtual = FALSE,
virtual.group.by.type = NULL,
dataFrameGroup = NA_character_
)parentThe BiodbEntryFields parent instance.
nameThe field name.
aliasThe field aliases as a character vector.
typeThe field type.
classThe field class.
cardThe field cardinality.
forbids.duplicatesSet to TRUE to forbid duplicated values.
descriptionThe field description.
allowed.valuesRestrict possible values to a set of allowed values.
lower.caseAll values will be converted to lower case.
case.insensitiveComparison will be made case insensitive for this field.
computable.fromA list of databases from which to compute automatically the value of this field.
virtualSet to TRUE if this field is virtual.
virtual.group.by.typeIn case of a virtual field, set the type of fields to group together into a data frame.
dataFrameGroupThe data frame group.
Nothing.
getName()Gets the name.
BiodbEntryField$getName()
The name of this field.
getType()Gets field's type.
BiodbEntryField$getType()
The type of this field.
isOfType()Tests if this field is of the specified type.
BiodbEntryField$isOfType(type)
typeThe type.
TRUE if this field is of the specified type, FALSE otherwise.
getDescription()Get field's description.
BiodbEntryField$getDescription()
The description of this field.
hasAliases()Tests if this field has aliases.
BiodbEntryField$hasAliases()
TRUE if this entry field defines aliases, FALSE otherwise.
getAliases()Get aliases.
BiodbEntryField$getAliases()
The list of aliases if some are defined, otherwise returns NULL."
addAlias()Adds an alias to the list of aliases.
BiodbEntryField$addAlias(alias)
aliasThe name of a valid alias.
Nothing.
removeAlias()Removes an alias from the list of aliases.
BiodbEntryField$removeAlias(alias)
aliasThe name of a valid alias.
Nothing.
getAllNames()Gets all names.
BiodbEntryField$getAllNames()
The list of all names (main name and aliases).
isComputable()Tests if this field is computable from another field or another database.
BiodbEntryField$isComputable()
TRUE if the field is computable, FALSE otherwise.
getComputableFrom()Get the list of connectors that can be used to compute this field.
BiodbEntryField$getComputableFrom()
A list of list objects. Each list object contains the name of the database from which the field is computable.
getDataFrameGroup()Gets the defined data frame group, if any.
BiodbEntryField$getDataFrameGroup()
The data frame group, as a character value.
isComputableFrom()Gets the ID of the database from which this field can be computed.
BiodbEntryField$isComputableFrom()
The list of databases where to find this field's value.
addComputableFrom()Adds a directive from the list of computableFrom.
BiodbEntryField$addComputableFrom(directive)
directiveA valid \"computable from\" directive.
Nothing.
removeComputableFrom()Removes a directive from the list of computableFrom.
BiodbEntryField$removeComputableFrom(directive)
directiveA valid \"computable from\" directive.
Nothing.
correctValue()Corrects a value so it is compatible with this field.
BiodbEntryField$correctValue(value)
valueA value.
The corrected value.
isEnumerate()Tests if this field is an enumerate type (i.e.: it defines allowed values).
BiodbEntryField$isEnumerate()
TRUE if this field defines some allowed values, FALSE otherwise.
isVirtual()Tests if this field is a virtual field.
BiodbEntryField$isVirtual()
TRUE if this field is virtual, FALSE otherwise.
getVirtualGroupByType()Gets type for grouping field values when building a virtual data frame.
BiodbEntryField$getVirtualGroupByType()
The type, as a character value.
getAllowedValues()Gets allowed values.
BiodbEntryField$getAllowedValues(value = NULL)
valueIf this parameter is set to particular allowed values, then the method returns a list of synonyms for this value (if any).
A character vector containing all allowed values.
addAllowedValue()Adds an allowed value, as a synonym to already an existing value. Note that not all enumerate fields accept synonyms.
BiodbEntryField$addAllowedValue(key, value)
keyThe key associated with the value (i.e.: the key is the main name of an allowed value).
valueThe new value to add.
Nothing.
checkValue()Checks if a value is correct. Fails if value is incorrect.
BiodbEntryField$checkValue(value)
valueThe value to check.
Nothing.
hasCardOne()Tests if this field has a cardinality of one.
BiodbEntryField$hasCardOne()
TRUE if the cardinality of this field is one, FALSE otherwise.
hasCardMany()Tests if this field has a cardinality greater than one.
BiodbEntryField$hasCardMany()
TRUE if the cardinality of this field is many, FALSE otherwise.
forbidsDuplicates()Tests if this field forbids duplicates.
BiodbEntryField$forbidsDuplicates()
TRUE if this field forbids duplicated values, FALSE otherwise.
isCaseInsensitive()Tests if this field is case sensitive.
BiodbEntryField$isCaseInsensitive()
TRUE if this field is case insensitive, FALSE otherwise.
getClass()Gets the class of this field's value.
BiodbEntryField$getClass()
class) of this field.
isObject()Tests if this field's type is a class.
BiodbEntryField$isObject()
TRUE if field's type is a class, FALSE otherwise.
isDataFrame()Tests if this field's type is data.frame.
BiodbEntryField$isDataFrame()
TRUE if field's type is data frame, FALSE otherwise."
isAtomic()Tests if this field's type is an atomic type.
BiodbEntryField$isAtomic()
character, integer, double or logical), FALSE otherwise.
isVector()Tests if this field's type is a basic vector type.
BiodbEntryField$isVector()
character, integer, double or logical), FALSE otherwise.
equals()Compares this instance with another, and tests if they are equal.
BiodbEntryField$equals(other, fail = FALSE)
otherAnother BiodbEntryField instance.
failIf set to TRUE, then throws error instead of returning FALSE.
TRUE if they are equal, FALSE otherwise.
updateWithValuesFrom()Updates fields using values from other instance. The updated fields
BiodbEntryField$updateWithValuesFrom(other)
otherAnother BiodbEntryField instance.
are'alias' and 'computable.from'. No values will be removed from those vectors. The new values will only be appended. This allows to extend an existing field inside a new connector definition.
Nothing.
print()Print informations about this entry.
BiodbEntryField$print()
Nothing.
getCardinality()Gets the field's cardinality.
BiodbEntryField$getCardinality()
The cardinality: "one" or "many".
check()Checks if essential values are defined.
BiodbEntryField$check()
Nothing.
clone()The objects of this class are cloneable with this method.
BiodbEntryField$clone(deep = FALSE)
deepWhether to make a deep clone.
Parent class BiodbEntryFields.
# Get the class of the InChI field.
mybiodb <- biodb::newInst()
inchi.field.class <- mybiodb$getEntryFields()$get('inchi')$getClass()
# Test the cardinality of a field
card.one <- mybiodb$getEntryFields()$get('name')$hasCardOne()
card.many <- mybiodb$getEntryFields()$get('name')$hasCardMany()
# Get the description of a field
desc <- mybiodb$getEntryFields()$get('inchi')$getDescription()
# Terminate instance.
mybiodb$terminate()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.