Module: BEL::Gen::Term

Includes:
Parameter
Included in:
Nanopub, Statement
Defined in:
lib/bel/gen/term.rb

Overview

The Term module defines methods that generate random BEL terms.

Constant Summary collapse

FUNCTIONS =

Array of all BEL 1.0 functions including both short and long form.

BEL::Language::FUNCTIONS.map { |_, fx|
  [ fx[:short_form], fx[:long_form] ]
}.flatten.sort.uniq

Constants included from Namespace

Namespace::NAMESPACES

Instance Method Summary collapse

Methods included from Parameter

#bel_parameter, #bel_parameter_with_namespace, #bel_parameter_without_namespace

Methods included from Namespace

#namespace, #referenced_namespaces

Instance Method Details

#bel_termString

Returns a randomly constructed BEL term.

Returns:

  • (String)

    the term label



28
29
30
# File 'lib/bel/gen/term.rb', line 28

def bel_term
  "#{function}(#{bel_parameter})"
end

#functionSymbol

Returns a randomly chosen function.

Returns:

  • (Symbol)

    the function label (short or long form)



20
21
22
23
24
# File 'lib/bel/gen/term.rb', line 20

def function
  Rantly {
    choose(*FUNCTIONS)
  }
end