Module: BEL::Gen::Statement

Includes:
Term
Included in:
Nanopub
Defined in:
lib/bel/gen/statement.rb

Overview

The Statement module defines methods that generate random BEL statements.

Constant Summary collapse

RELATIONSHIPS =

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

BEL::Language::RELATIONSHIPS.each.to_a.flatten.sort.uniq

Constants included from Term

Term::FUNCTIONS

Constants included from Namespace

Namespace::NAMESPACES

Instance Method Summary collapse

Methods included from Term

#bel_term, #function

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_statementString

Returns a randomly constructed BEL statement.

Returns:

  • (String)

    the statement label



26
27
28
29
30
# File 'lib/bel/gen/statement.rb', line 26

def bel_statement
  sub = bel_term
  obj = bel_term
  "#{sub} #{relationship} #{obj}"
end

#relationshipSymbol

Returns a randomly chosen relationship.

Returns:

  • (Symbol)

    the relationship label (short or long form)



18
19
20
21
22
# File 'lib/bel/gen/statement.rb', line 18

def relationship
  Rantly {
    choose(*RELATIONSHIPS)
  }
end