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

it.unife.ml.probowlapi.monitor.NullInconsRendererTimeExplanationProgressMonitor Maven / Gradle / Ivy

Go to download

This package encapsulates OWL API adding tools for managing DISPONTE probabilistic semantics. Used by the reasoner BUNDLE.

The newest version!
/**
 *  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.
 *
 *  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.ml.probowlapi.monitor;

import it.unife.ml.probowlapi.constants.UniFeIRI;
import org.semanticweb.owl.explanation.api.Explanation;
import org.semanticweb.owl.explanation.api.ExplanationGenerator;
import org.semanticweb.owlapi.model.*;
import uk.ac.manchester.cs.owl.owlapi.OWLNamedIndividualImpl;

import java.util.HashSet;
import java.util.Set;

public class NullInconsRendererTimeExplanationProgressMonitor
        extends NullRendererTimeExplanationProgressMonitor {
    private Set> setExplanations;
    private OWLIndividual queryInd;

    public NullInconsRendererTimeExplanationProgressMonitor() {
        this.queryInd = new OWLNamedIndividualImpl(IRI.create(UniFeIRI.QUERY_PLACEHOLDER));
        this.setExplanations = new HashSet();

    }

    public void foundExplanation(ExplanationGenerator generator, Explanation explanation, Set> allFoundExplanations) {
        Set axioms = new HashSet<>();
        Boolean inconsExpl = true;
        for (OWLAxiom ax : explanation.getAxioms()) {
            if (!ax.getIndividualsInSignature().contains(queryInd)) {
                axioms.add(ax);
            } else {
                inconsExpl = false;
            }
        }
        Explanation cleanedExpl = new Explanation<>(explanation.getEntailment(), axioms);
        this.setExplanations.add(cleanedExpl);

    }

    public void foundNoExplanations(OWLAxiom axiom) {
    }

    public Set> getFoundExplanations() {
        return this.setExplanations;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy