proof_attempt_configuration.rb revision e0ae31a48b304a53c4280b5b3b50a6dfba6d448a
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksaclass ProofAttemptConfiguration < ActiveRecord::Base
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa include Numbering
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa numbering_parent_column 'ontology_id'
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksa belongs_to :logic_mapping
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa belongs_to :prover
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa belongs_to :ontology
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa has_many :proof_attempts, dependent: :destroy
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksa has_and_belongs_to_many :axioms,
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksa class_name: 'Axiom',
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksa association_foreign_key: 'sentence_id',
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksa join_table: 'axioms_proof_attempt_configurations'
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksa has_and_belongs_to_many :goals,
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksa class_name: 'Theorem',
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksa association_foreign_key: 'sentence_id',
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksa join_table: 'goals_proof_attempt_configurations'
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksa # timeout in seconds
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksa attr_accessible :timeout
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa attr_accessible :locid
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa
82b684a930d8914af8f829c4dc6687c698d82169Eugen Kuksa validates :ontology, presence: true
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa before_create :generate_locid
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa
e0ae31a48b304a53c4280b5b3b50a6dfba6d448aEugen Kuksa def empty?
e0ae31a48b304a53c4280b5b3b50a6dfba6d448aEugen Kuksa [logic_mapping, prover, timeout, axioms, goals].all?(&:blank?)
e0ae31a48b304a53c4280b5b3b50a6dfba6d448aEugen Kuksa end
e0ae31a48b304a53c4280b5b3b50a6dfba6d448aEugen Kuksa
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa protected
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa def self.find_with_locid(locid, _iri = nil)
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa where(locid: locid).first
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa end
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen 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 =
44f41210d9e3ab001acbbe8df9b39445ac00b5ddEugen Kuksa "#{ontology.locid}//#{self.class.to_s.underscore.dasherize}-#{number}"
44f41210d9e3ab001acbbe8df9b39445ac00b5ddEugen Kuksa end
8d4c6e7397e88fade190ad107583c30dc6b34afcEugen Kuksa end
c4bdc37c9de27abfa1d5be18008953b32457e6c4Eugen Kuksaend