001/** 002 * Copyright (C) 2007 - 2016, Jens Lehmann 003 * 004 * This file is part of DL-Learner. 005 * 006 * DL-Learner is free software; you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation; either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * DL-Learner is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 018 */ 019package org.dllearner.utilities.examples; 020 021import java.util.SortedSet; 022import java.util.TreeSet; 023 024import org.apache.log4j.Logger; 025import org.dllearner.core.AbstractReasonerComponent; 026import org.semanticweb.owlapi.model.OWLClassExpression; 027import org.semanticweb.owlapi.model.OWLIndividual; 028 029public class AutomaticPositiveExampleFinderOWL { 030 031 // LOGGER: ComponentManager 032 private static Logger logger = Logger 033 .getLogger(AutomaticPositiveExampleFinderOWL.class); 034 035 036 private AbstractReasonerComponent reasoningService; 037 038 private SortedSet<OWLIndividual> posExamples; 039 040 public AutomaticPositiveExampleFinderOWL(AbstractReasonerComponent reasoningService) { 041 042 this.posExamples = new TreeSet<>(); 043 this.reasoningService = reasoningService; 044 } 045 046 //QUALITY resultsize is not accounted for 047 public void makePositiveExamplesFromConcept(OWLClassExpression concept){ 048 logger.debug("making Positive Examples from Concept: "+concept); 049 this.posExamples.clear(); 050 this.posExamples.addAll(reasoningService.getIndividuals(concept)); 051 //this.posExamples = sparqltasks.retrieveInstancesForClassDescription(conceptKBSyntax, 0); 052 logger.debug("pos Example size: "+posExamples.size()); 053 } 054 055 056 public SortedSet<OWLIndividual> getPosExamples() { 057 return posExamples; 058 } 059 060 061 062 063 064}