001/**
002 * 
003 */
004package org.dllearner.algorithms.isle.index;
005
006import java.util.HashMap;
007import java.util.HashSet;
008import java.util.Set;
009
010import org.dllearner.algorithms.isle.EntityCandidateGenerator;
011import org.semanticweb.owlapi.model.OWLEntity;
012import org.semanticweb.owlapi.model.OWLOntology;
013
014/**
015 * @author Lorenz Buehmann
016 *
017 */
018public class SimpleEntityCandidateGenerator extends EntityCandidateGenerator{
019        
020        private Set<OWLEntity> allEntities = new HashSet<>();
021        
022        public SimpleEntityCandidateGenerator(OWLOntology ontology) {
023                super(ontology);
024                
025                allEntities.addAll(ontology.getClassesInSignature());
026                allEntities.addAll(ontology.getObjectPropertiesInSignature());
027                allEntities.addAll(ontology.getDataPropertiesInSignature());
028                
029        }
030
031        /* (non-Javadoc)
032         * @see org.dllearner.algorithms.isle.EntityCandidateGenerator#getCandidates(org.dllearner.algorithms.isle.index.Annotation)
033         */
034        @Override
035        public Set<EntityScorePair> getCandidates(Annotation annotation) {
036        HashSet<EntityScorePair> result = new HashSet<>();
037        for (OWLEntity e : allEntities) {
038            result.add(new EntityScorePair(e, 1.0));
039        }
040        return result;
041    }
042
043        @Override
044        public HashMap<Annotation, Set<EntityScorePair>> getCandidatesMap(Set<Annotation> annotations) {
045                HashMap<Annotation, Set<EntityScorePair>> result = new HashMap<>();
046                for (Annotation annotation: annotations) 
047                        result.put(annotation, getCandidates(annotation));
048                
049                return result;
050        }
051
052}