All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.unife.endif.ml.bundle.utilities.QueryResult Maven / Gradle / Ivy

/**
 *  This file is part of BUNDLE.
 * 
 *  BUNDLE is a probabilistic reasoner for OWL 2 ontologies.
 * 
 *  BUNDLE can be used both as module and as standalone.
 * 
 *  LEAP was implemented as a plugin of DL-Learner http://dl-learner.org, 
 *  but some components can be used as stand-alone.
 * 
 *  BUNDLE and all its parts are distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see .
 * 
 */
package it.unife.endif.ml.bundle.utilities;

//import java.math.BigDecimal;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.semanticweb.owlapi.model.OWLAxiom;
import net.sf.javabdd.BDD;
import org.mindswap.pellet.utils.Timers;
import it.unife.endif.ml.math.ApproxDouble;

/**
 * Class containing the results of a query: explanations, probabilities, usedAxioms, BDDs
 * 
 * @author Giuseppe Cota , Riccardo Zese 
 */
public class QueryResult {

    private ApproxDouble queryProbability;
    private BDD bdd;
    private Set> explanations;
    private List probAxioms;
    private List usedAxioms;
//    private List probOfAxioms;

    private int numberOfExplanations;
    
    private Timers timers;

    public QueryResult() {
        explanations = new HashSet<>();
        numberOfExplanations = 0;
    }

    /**
     * @return the explanations
     */
    public Set> getExplanations() {
        return explanations;
    }

    /**
     * @param explanations the explanations to set
     */
    public void setExplanations(Set> explanations) {
        this.explanations = explanations;
        numberOfExplanations = explanations.size();
    }

    /**
     * @return the probAxioms
     */
    public List getProbAxioms() {
        return probAxioms;
    }

    /**
     * @param probAxioms the probAxioms to set
     */
    public void setProbAxioms(List probAxioms) {
        this.probAxioms = probAxioms;
    }

//    /**
//     * @return the probOfAxioms
//     */
//    public List getProbOfAxioms() {
//        return probOfAxioms;
//    }
//
//    /**
//     * @param probOfAxioms the probOfAxioms to set
//     */
//    public void setProbOfAxioms(List probOfAxioms) {
//        this.probOfAxioms = probOfAxioms;
//    }

    /**
     * @return the queryProbability
     */
    public ApproxDouble getQueryProbability() {
        return queryProbability;
    }

    /**
     * @param probability the queryProbability to set
     */
    public void setQueryProbability(ApproxDouble probability) {
        this.queryProbability = probability;
    }

    public void merge(QueryResult qr) {
        explanations.addAll(qr.getExplanations());
    }

    /**
     * @return the number of explanations
     */
    public int getNumberOfExplanations() {
        return numberOfExplanations;
    }

    /**
     * @return the bdd
     */
    public BDD getBDD() {
        return bdd;
    }

    /**
     * @param bdd the bdd to set
     */
    public void setBDD(BDD bdd) {
        this.bdd = bdd;
    }

    @Override
    public String toString() {
        return "N. of Explanations: " + numberOfExplanations
                + " | Probability of the query: " + queryProbability;
    }

    /**
     * @return the timers
     */
    public Timers getTimers() {
        return timers;
    }

    /**
     * @param timers the timers to set
     */
    public void setTimers(Timers timers) {
        this.timers = timers;
    }

    /**
     * @return the usedAxioms
     */
    public List getUsedAxioms() {
        return usedAxioms;
    }

    /**
     * @param usedAxioms the usedAxioms to set
     */
    public void setUsedAxioms(List usedAxioms) {
        this.usedAxioms = usedAxioms;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy