ontoDir <- system.file("extdata", "crops.rds", package = "ontologics")
onto <- load_ontology(path = ontoDir)
# exact matches from a loaded ontology ...
get_concept(label = "FODDER CROPS", ontology = onto)
# ... or a path
get_concept(label = c("FODDER CROPS", "CEREALS"), ontology = ontoDir)
# ignore querries that would not be valid in filter()
get_concept(label != 'Bioenergy woody' & has_broader == '.01', ontology = onto)
# extract concepts based on regular expressions
library(stringr)
get_concept(str_detect(label, "crop") & str_detect(id, ".03$"), ontology = ontoDir)
Run the code above in your browser using DataLab