Skip to contents

Generate custom functions based on available predicates.

Usage

predicate_factory(
  x,
  prefix = "",
  to.local = TRUE,
  vocab.table = NULL,
  name.prepend = "P."
)

Arguments

x

Character scalar. Names of the desired predicate functions.

prefix

Character scalar. Name of the prefix the class is from. (Default: "")

to.local

Logical scalar. Whether to return functions in a list (TRUE, Default) or to the environment (FALSE).

vocab.table

data.frame. Used to customize input hints. Output of map_endpoint with return.table set to TRUE. (Default: NULL).

name.prepend

Character scalar. Prefix for the produced a_class functions. (Default: "P.").

Value

A list of functions, or to the environment.

Examples


P <- predicate_factory(
    x = c("predicate_A", "predicate_B", "predicate_C"),
    prefix = "a"
    )

P$P.predicate_A(subject ~ object)
#> pallas::triple character S7_object.
#> subject  predicate      object     
#> subject  a:predicate_A  object  .  
P$P.predicate_B(subject ~ object)
#> pallas::triple character S7_object.
#> subject  predicate      object     
#> subject  a:predicate_B  object  .  
P$P.predicate_C(subject ~ object)
#> pallas::triple character S7_object.
#> subject  predicate      object     
#> subject  a:predicate_C  object  .