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
)

Arguments

new

character(.)
the english external label(s) that shall be mapped to labels that do already exist in the ontology.

target

data.frame(.)
the already harmonised English label(s) to which the external labels shall be mapped; derive with get_concept().

source

character(1)
any character uniquely identifying the source dataset of the new label.

lut

character(.)
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.

match

character(1)
the skos mapping property used to describe the link, possible values are "close", "exact", "broad" and "narrow".

certainty

integerish(1)
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)

.

type

character(1)
whether the new labels are mapped to a "concept", or to a "class".

ontology

ontology(1)
either a path where the ontology is stored, or an already loaded ontology.

verbose

logical(1)
whether or not to give detailed information on the process of this function.

beep

integerish(1)
Number specifying what sound to be played to signal the user that a point of interaction is reached by the program, see beep.

Value

No return value, called for the side effect of adding new mappings to an ontology.

Examples

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)