Class: RDF::Statement

Inherits:
Object
  • Object
show all
Defined in:
lib/rdf/reasoner/extensions.rb

Constant Summary collapse

@@entailments =
{}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_entailment(method, proc) ⇒ Object

Add an entailment method. The method accepts no arguments, and returns or yields an array of values associated with the particular entailment method

Parameters:

  • method (Symbol)
  • proc (Proc)

123
124
125
# File 'lib/rdf/reasoner/extensions.rb', line 123

def add_entailment(method, proc)
  @@entailments[method] = proc
end

Instance Method Details

#entail(method) {|term| ... } ⇒ Array<Term>

Perform an entailment on this term.

Parameters:

  • method (Symbol)

    A registered entailment method

Yields:

  • term

Yield Parameters:

  • term (Term)

Returns:

  • (Array<Term>)

135
136
137
# File 'lib/rdf/reasoner/extensions.rb', line 135

def entail(method, &block)
  self.send(@@entailments.fetch(method), &block)
end