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

uk.ac.manchester.cs.owl.explanation.JustificationCache Maven / Gradle / Ivy

package uk.ac.manchester.cs.owl.explanation;

import org.semanticweb.owl.explanation.api.Explanation;
import org.semanticweb.owlapi.model.OWLAxiom;

import java.util.*;

/**
 * Author: Matthew Horridge
* Stanford University
* Bio-Medical Informatics Research Group
* Date: 20/03/2012 */ public class JustificationCache { private Map>> cache = new HashMap>>(); public boolean contains(OWLAxiom entailment) { return cache.containsKey(entailment); } public Set> get(OWLAxiom entailment) { Set> explanations = cache.get(entailment); if(explanations == null) { return Collections.emptySet(); } return new HashSet>(explanations); } public void put(Explanation explanation) { Set> expls = cache.get(explanation.getEntailment()); if(expls == null) { expls = new HashSet>(); cache.put(explanation.getEntailment(), expls); } expls.add(explanation); } public void put(Set> explanations) { for(Explanation expl : explanations) { put(expl); } } public void clear() { cache.clear(); } public void clear(OWLAxiom entailment) { cache.remove(entailment); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy