Method: Model::Reasoner#check_condition

Defined in:
lib/services/reasoner.rb

#check_condition(condition) ⇒ Object

makes sure that the graph with name condition is valid to do that, it creates a temporary graph (:helper_graph) and tries to imply condition => helper_graph it creates a new temp_reasoner object so as not to modify the current repository with the helper_graph



32
33
34
35
36
37
38
39
40
# File 'lib/services/reasoner.rb', line 32

def check_condition(condition)
  temp_repository = @repository.clone
  temp_repository << [ LV.condition, LV.was, LV.true, :helper_graph ]

  temp_reasoner = Reasoner.new temp_repository
  result = temp_reasoner.imply(condition, :helper_graph)

  result.query([ LV.condition, LV.was, LV.true ]).any?
end