protected Set<OWLClass> filterClassesTemperature(Set<OWLClass> original, String temperature) throws OWLReasonerException { Set<OWLClass> result = new HashSet<OWLClass>(); for (Iterator<OWLClass> it = original.iterator(); it.hasNext(); ) { OWLClass cls = it.next(); if (this.filterClasses(reasoner.getSuperClasses(cls)) .contains(getTemperatureCoffeeClass(temperature))) result.add(cls); } return result; }
/** * filters the result of e.g. getSubclasses which is Set<Set<OWLClass>> To Set<OWLClass> * * @param original * @return * @throws OWLReasonerException */ protected Set<OWLClass> filterClasses(Set<Set<OWLClass>> original) throws OWLReasonerException { Set<OWLClass> result = new HashSet<OWLClass>(); for (Set<OWLClass> set : original) { for (Iterator<OWLClass> it = set.iterator(); it.hasNext(); ) { OWLClass cls = it.next(); if (cls.getURI().equals(OWLRDFVocabulary.OWL_NOTHING)) { it.remove(); } else { result.add(cls); } } } return result; }