proof_attempt_configuration.rb revision 25f85f6174d2238cc1ea058fa129cb65961cf54a
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksaclass ProofAttemptConfiguration < ActiveRecord::Base
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksa belongs_to :logic_mapping
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa belongs_to :prover
f9328b75002f0a5584b4ec930536fc43e5b56fdcEugen Kuksa belongs_to :axiom_selection
63499d8d12a219d26744bcb896789ea28459814fEugen Kuksa has_one :proof_attempt, dependent: :destroy
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksa # timeout in seconds
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksa attr_accessible :timeout
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa attr_accessible :locid
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa
25f85f6174d2238cc1ea058fa129cb65961cf54aEugen Kuksa validates :proof_attempt, presence: true
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa
f9328b75002f0a5584b4ec930536fc43e5b56fdcEugen Kuksa delegate :axioms, to: :axiom_selection
25f85f6174d2238cc1ea058fa129cb65961cf54aEugen Kuksa delegate :ontology, to: :proof_attempt
f9328b75002f0a5584b4ec930536fc43e5b56fdcEugen Kuksa
e0ae31a48b304a53c4280b5b3b50a6dfba6d448aEugen Kuksa def empty?
63499d8d12a219d26744bcb896789ea28459814fEugen Kuksa [logic_mapping, prover, timeout, axioms].all?(&:blank?)
e0ae31a48b304a53c4280b5b3b50a6dfba6d448aEugen Kuksa end
e0ae31a48b304a53c4280b5b3b50a6dfba6d448aEugen Kuksa
d1b9592add080035a1d8adf1e35e9af00ad6f1e1Eugen Kuksa def prove_options
d1b9592add080035a1d8adf1e35e9af00ad6f1e1Eugen Kuksa return @prove_options if @prove_options
d1b9592add080035a1d8adf1e35e9af00ad6f1e1Eugen Kuksa options = {}
d1b9592add080035a1d8adf1e35e9af00ad6f1e1Eugen Kuksa options[:prover] = prover if prover
d1b9592add080035a1d8adf1e35e9af00ad6f1e1Eugen Kuksa options[:timeout] = timeout if timeout
d1b9592add080035a1d8adf1e35e9af00ad6f1e1Eugen Kuksa options[:axioms] = axiom_selection.axioms if axiom_selection.axioms.any?
d1b9592add080035a1d8adf1e35e9af00ad6f1e1Eugen Kuksa @prove_options = Hets::ProveOptions.new(options)
d1b9592add080035a1d8adf1e35e9af00ad6f1e1Eugen Kuksa end
d1b9592add080035a1d8adf1e35e9af00ad6f1e1Eugen Kuksa
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa def generate_locid
44f41210d9e3ab001acbbe8df9b39445ac00b5ddEugen Kuksa # It's possible that the database columns `locid` and `number` have not yet
44f41210d9e3ab001acbbe8df9b39445ac00b5ddEugen Kuksa # been created.
44f41210d9e3ab001acbbe8df9b39445ac00b5ddEugen Kuksa if respond_to?(:locid) && respond_to?(:number)
44f41210d9e3ab001acbbe8df9b39445ac00b5ddEugen Kuksa self.locid =
25f85f6174d2238cc1ea058fa129cb65961cf54aEugen Kuksa "#{proof_attempt.locid}//#{self.class.to_s.underscore.dasherize}"
44f41210d9e3ab001acbbe8df9b39445ac00b5ddEugen Kuksa end
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa end
25f85f6174d2238cc1ea058fa129cb65961cf54aEugen Kuksa
25f85f6174d2238cc1ea058fa129cb65961cf54aEugen Kuksa protected
25f85f6174d2238cc1ea058fa129cb65961cf54aEugen Kuksa
25f85f6174d2238cc1ea058fa129cb65961cf54aEugen Kuksa def self.find_with_locid(locid, _iri = nil)
25f85f6174d2238cc1ea058fa129cb65961cf54aEugen Kuksa where(locid: locid).first
25f85f6174d2238cc1ea058fa129cb65961cf54aEugen Kuksa end
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksaend