Extend an ontology by creating mappings between classes and concepts of external vocabularies and the harmonised classes and concepts.
new_mapping( new = NULL, target, source = NULL, lut = NULL, match = NULL, certainty = NULL, type = "concept", ontology = NULL, verbose = FALSE, beep = NULL )
the english external label(s) that shall be mapped to labels that do already exist in the ontology.
the already harmonised English label(s) to which the external labels shall be mapped; derive with get_concept().
any character uniquely identifying the source dataset of the new label.
in case the terms used for mapping are from a look up table (i.e. a standardised set of terms with a description), provide this table with column names 'label' and 'description' here.
the certainty of the match. Possible values are between 1 and 4, with meaning
2 = unclear, assigned according to a given definition
3 = clear, assigned according to a given definition
4 = original, harmonised term (can't be assigned by a user)
whether the new labels are mapped to a
"concept", or to a
either a path where the ontology is stored, or an already loaded ontology.
whether or not to give detailed information on the process of this function.
No return value, called for the side effect of adding new mappings to an ontology.
ontoDir <- system.file("extdata", "crops.rds", package = "ontologics") onto <- load_ontology(path = ontoDir) mapping <- data.frame(old = c("BIOENERGY CROPS", "Bioenergy woody", "Other bioenergy crops"), new = c("bioenergy plants", "Wood plantation for fuel", "Algae for bioenergy"), type = c("close", "broader", "broader")) onto <- new_source(name = "externalDataset", version = "0.0.1", description = "a vocabulary", homepage = "https://www.something.net", license = "CC-BY-0", ontology = onto) onto <- get_concept(label = mapping$old, ontology = onto) %>% new_mapping(new = mapping$new, target = ., match = mapping$type, source = "externalDataset", certainty = 3, ontology = onto)