001 // This file is part of AceWiki. 002 // Copyright 2008-2012, AceWiki developers. 003 // 004 // AceWiki is free software: you can redistribute it and/or modify it under the terms of the GNU 005 // Lesser General Public License as published by the Free Software Foundation, either version 3 of 006 // the License, or (at your option) any later version. 007 // 008 // AceWiki is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 009 // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 010 // Lesser General Public License for more details. 011 // 012 // You should have received a copy of the GNU Lesser General Public License along with AceWiki. If 013 // not, see http://www.gnu.org/licenses/. 014 015 package ch.uzh.ifi.attempto.acewiki.core; 016 017 import java.util.List; 018 import java.util.Map; 019 020 // TODO split this interface into several interfaces: 021 // - AceWikiReasoner 022 // - AssignmentsReasoner 023 // - HierarchyReasoner 024 // - ConceptSatisfiabilityReasoner 025 // - QuestionReasoner 026 /** 027 * This is the reasoner interface for AceWiki. 028 * 029 * @author Tobias Kuhn 030 */ 031 public interface AceWikiReasoner { 032 033 /** 034 * This is the first method to be called and provides the ontology object. 035 * 036 * @param ontology The ontology object. 037 */ 038 public void init(Ontology ontology); 039 040 /** 041 * Should return the name of the reasoner. 042 * 043 * @return The name of the reasoner. 044 */ 045 public String getReasonerName(); 046 047 /** 048 * Should return the version of the reasoner. 049 * 050 * @return The version of the reasoner. 051 */ 052 public String getReasonerVersion(); 053 054 /** 055 * Should return the type of the reasoner. 056 * 057 * @return The reasoner type. 058 */ 059 public String getReasonerType(); 060 061 /** 062 * This method can return a map of name/value pairs with information about the reasoner. 063 * To retain the insertion order, a map implementation like LinkedHashMap should be used. 064 * It is allowed to return null for no information. 065 * 066 * @return A map of name/value pairs with reasoner information. 067 */ 068 public Map<String, String> getInfo(); 069 070 /** 071 * Loads the reasoner or reasoner interface. 072 */ 073 public void load(); 074 075 /** 076 * Loads the given ontology element. The method flushElements is called after each 077 * sequence of one or more loadElement-calls. 078 * 079 * @param element The ontology element. 080 */ 081 public void loadElement(OntologyElement element); 082 083 /** 084 * Unloads the given ontology element. The method flushElements is called after each 085 * sequence of one or more unloadElement-calls. 086 * 087 * @param element The ontology element. 088 */ 089 public void unloadElement(OntologyElement element); 090 091 /** 092 * This method can finalize the loading or unloading of elements. It is always called 093 * after a sequence of one or more loadElement- or unloadElement-calls. 094 */ 095 public void flushElements(); 096 097 /** 098 * Should return all concepts the given individual belongs to. 099 * 100 * @param ind The individual. 101 * @return A list of all concepts of the individual. 102 */ 103 public List<Concept> getConcepts(Individual ind); 104 105 /** 106 * Should return all individuals that belong to the given concept. 107 * 108 * @param concept The concept. 109 * @return A list of all individuals of the concept. 110 */ 111 public List<Individual> getIndividuals(Concept concept); 112 113 /** 114 * Should return all super-concepts of the given concept. 115 * 116 * @param concept The concept for which all super-concepts should be returned. 117 * @return A list of all super-concepts. 118 */ 119 public List<Concept> getSuperConcepts(Concept concept); 120 121 /** 122 * Should return all the sub-concepts of the given concept. 123 * 124 * @param concept The concept for which all sub-concepts should be returned. 125 * @return A list of all sub-concepts. 126 */ 127 public List<Concept> getSubConcepts(Concept concept); 128 129 /** 130 * Should return a list of ontology elements that answer the given question. 131 * 132 * @param question The question to be answered. 133 * @return A list of ontology elements that are the answer to the question. 134 */ 135 public List<AnswerElement> getAnswer(Question question); 136 137 /** 138 * Should return true if the ontology is consistent. 139 * 140 * @return true if the ontology is consistent. 141 */ 142 public boolean isConsistent(); 143 144 /** 145 * Should check if the given concept is satisfiable. 146 * 147 * @param concept The concept. 148 * @return true if the concept is satisfiable. 149 */ 150 public boolean isSatisfiable(Concept concept); 151 152 /** 153 * Loads the given sentence. 154 * 155 * @param sentence The sentence. 156 */ 157 public void loadSentence(Sentence sentence); 158 159 /** 160 * Unloads the given sentence. 161 * 162 * @param sentence The sentence. 163 */ 164 public void unloadSentence(Sentence sentence); 165 166 }