001/*
002 * To change this license header, choose License Headers in Project Properties.
003 * To change this template file, choose Tools | Templates
004 * and open the template in the editor.
005 */
006package org.dllearner.core.probabilistic.unife;
007
008import org.dllearner.core.AbstractCELA;
009import org.dllearner.core.AbstractLearningProblem;
010import org.dllearner.core.LearningProblem;
011import org.dllearner.core.StoppableLearningAlgorithm;
012import org.springframework.beans.factory.annotation.Autowired;
013
014/**
015 *
016 * @author Giuseppe Cota <giuseppe.cota@unife.it>, Riccardo Zese
017 * <riccardo.zese@unife.it>
018 */
019public abstract class AbstractPSLA implements ProbabilisticStructureLearningAlgorithm, StoppableLearningAlgorithm {
020
021    /**
022     * The learning algorithm used to compute the probabilistic parameters.
023     */
024    protected AbstractParameterLearningAlgorithm pla;
025
026    /**
027     * The learning algorithm used to extract new class expressions.
028     */
029    protected AbstractCELA cela;
030
031    /**
032     * The learning problem variable, which must be used by all learning
033     * algorithm implementations.
034     */
035    protected AbstractLearningProblem learningProblem;
036
037    protected String outFormat = "OWLXML";
038
039    protected String outputFile = "learnedOntology.owl";
040
041    protected boolean isRunning = false;
042    protected boolean stop = false;
043
044    public AbstractPSLA() {
045
046    }
047
048    /**
049     * Each probabilistic structure learning algorithm gets a class expression
050     * learning algorithm and a parameter learning algorithm
051     *
052     * @param cela
053     * @param pla
054     */
055    public AbstractPSLA(AbstractCELA cela, AbstractParameterLearningAlgorithm pla) {
056        this.cela = cela;
057        this.pla = pla;
058    }
059
060    public AbstractCELA getClassExpressionLearningAlgorithm() {
061        return cela;
062    }
063
064    @Autowired
065    public void setClassExpressionLearningAlgorithm(AbstractCELA la) {
066        this.cela = la;
067    }
068
069    @Override
070    public ParameterLearningAlgorithm getLearningParameterAlgorithm() {
071        return pla;
072    }
073
074    @Autowired
075    @Override
076    public void setLearningParameterAlgorithm(ParameterLearningAlgorithm pla) {
077        this.pla = (AbstractParameterLearningAlgorithm) pla;
078    }
079
080    /**
081     * The learning problem variable, which must be used by all learning
082     * algorithm implementations.
083     */
084    @Override
085    public AbstractLearningProblem getLearningProblem() {
086        return learningProblem;
087    }
088
089    @Autowired
090    @Override
091    public void setLearningProblem(LearningProblem learningProblem) {
092        this.learningProblem = (AbstractLearningProblem) learningProblem;
093    }
094
095    @Override
096    public boolean isRunning() {
097        return isRunning;
098    }
099
100    @Override
101    public void stop() {
102        stop = true;
103    }
104
105    /**
106     * @return the outputFile
107     */
108    public String getOutputFile() {
109        return outputFile;
110    }
111
112    /**
113     * @param outputFile the outputFile to set
114     */
115    public void setOutputFile(String outputFile) {
116        this.outputFile = outputFile;
117    }
118
119}