new_concept: Add a new concept to an ontology

View source: R/new_concept.R

new_conceptR Documentation

Add a new concept to an ontology

Description

This adds a new concept to an existing ontology to semantically integrate and thus harmonise it with the already existing ontology.

Usage

new_concept(
  new,
  broader = NULL,
  description = NULL,
  class = NULL,
  ontology = NULL
)

Arguments

new

character(.)
the english label(s) of new concepts that shall be included in the ontology.

broader

data.frame(.)
the english label(s) of already harmonised concepts to which the new concept shall be semantically linked via a skos:broader relation, see Details.

description

character(.)
a verbatim description of the new concept(s).

class

character(.)
the class(es) of the new labels.

ontology

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

Value

returns invisibly a table of the new harmonised concepts that were added to the ontology, or a message that nothing new was added.

Examples

ontoDir <- system.file("extdata", "crops.rds", package = "ontologics")
onto <- load_ontology(path = ontoDir)

# add fully known concepts
concepts <- data.frame(
  old = c("Bioenergy woody", "Bioenergy herbaceous"),
  new = c("acacia", "miscanthus")
)

onto <- new_source(
  version = "0.0.1",
  name = "externalDataset",
  description = "a vocabulary",
  homepage = "https://www.something.net",
  license = "CC-BY-0",
  ontology = onto
)

onto <- new_concept(
  new = concepts$new,
  broader = get_concept(label = concepts$old, ontology = onto),
  class = "crop",
  ontology = onto
)

# add concepts where the nesting is clear, but not the new class
concepts <- data.frame(
  old = c("Barley", "Barley"),
  new = c("food", "bio-energy")
)

onto <- new_concept(
  new = concepts$new,
  broader = get_concept(label = concepts$old, ontology = onto),
  ontology = onto
)

# define that class ...
onto <- new_class(
  new = "use type", target = "class",
  description = "the way a crop is used", ontology = onto
)

# ... and set the concepts again
onto <- new_concept(
  new = concepts$new,
  broader = get_concept(label = concepts$old, ontology = onto),
  class = "use type",
  ontology = onto
)


ontologics documentation built on May 31, 2023, 6:53 p.m.