001 /**
002 * Copyright (C) 2007-2011, 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 */
019
020 package org.dllearner.core.options;
021
022 import java.util.Set;
023 import java.util.SortedSet;
024 import java.util.TreeSet;
025
026 import org.dllearner.core.options.fuzzydll.FuzzyExample;
027 import org.dllearner.core.owl.NamedClass;
028 import org.dllearner.core.owl.Individual;
029 import org.dllearner.core.owl.ObjectProperty;
030 import org.dllearner.core.owl.fuzzydll.FuzzyIndividual;
031 import org.dllearner.utilities.owl.ConceptComparator;
032
033 /**
034 * @author Jens Lehmann
035 *
036 */
037 public class CommonConfigMappings {
038
039 private static ConceptComparator cm = new ConceptComparator();
040 // private static RoleComparator rc = new RoleComparator();
041
042 public static SortedSet<Individual> getIndividualSet(Set<String> individuals) {
043 SortedSet<Individual> set = new TreeSet<Individual>();
044 for(String individual : individuals){
045 set.add(new Individual(individual));
046 }
047 return set;
048 }
049
050 public static SortedSet<NamedClass> getAtomicConceptSet(Set<String> atomicConcepts) {
051 SortedSet<NamedClass> set = new TreeSet<NamedClass>(cm);
052 for(String atomicConcept : atomicConcepts) {
053 set.add(new NamedClass(atomicConcept));
054 }
055 return set;
056 }
057
058 public static SortedSet<ObjectProperty> getAtomicRoleSet(Set<String> atomicRoles) {
059 SortedSet<ObjectProperty> set = new TreeSet<ObjectProperty>();
060 for(String atomicRole : atomicRoles){
061 set.add(new ObjectProperty(atomicRole));
062 }
063 return set;
064 }
065
066 // added by Josue
067 public static SortedSet<FuzzyIndividual> getFuzzyIndividualSet(Set<FuzzyExample> examples) {
068 SortedSet<FuzzyIndividual> set = new TreeSet<FuzzyIndividual>();
069 for(FuzzyExample example : examples){
070 set.add(new FuzzyIndividual(example.getExampleName(), example.getFuzzyDegree()));
071 }
072 return set;
073 }
074 }