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;
021    
022    import java.util.Map;
023    import java.util.Set;
024    import java.util.SortedSet;
025    
026    import org.dllearner.core.owl.Axiom;
027    import org.dllearner.core.owl.Constant;
028    import org.dllearner.core.owl.DatatypeProperty;
029    import org.dllearner.core.owl.Entity;
030    import org.dllearner.core.owl.Individual;
031    import org.dllearner.core.owl.NamedClass;
032    import org.dllearner.core.owl.ObjectProperty;
033    
034    /**
035     * Contains the following reasoning/query operations:
036     * <ul>
037     *   <li>queries for elements contained in the knowledge base (classes, properties, ...)</li>
038     *   <li>basic reasoning requests related to the knowledge base as a whole (e.g. consistency)</li>
039     * </ul>
040     * (Many methods in this interface do not require reasoning algorithms, but rather
041     * return information about the knowledge base.)
042     * 
043     * @author Jens Lehmann
044     *
045     */
046    public interface BaseReasoner {
047    
048            /**
049             * Checks consistency of the knowledge.
050             * @return True if the knowledge base is consistent and false otherwise.
051             */
052            public boolean isSatisfiable();
053            
054            /**
055             * Checks whether adding the specified axiom leads to an inconsistency.
056             * @param axiom The axiom to be added to the knowledge base.
057             * @return True of the knowledge base including the axiom is satisfiable. False otherwise.
058             */
059            public boolean remainsSatisfiable(Axiom axiom);
060            
061            /**
062             * Gets all named classes in the knowledge base, e.g. Person, City, Car.
063             * @return All named classes in KB.
064             */
065            public Set<NamedClass> getNamedClasses();
066            
067            /**
068             * Gets all object properties in the knowledge base, e.g. hasChild, isCapitalOf, hasEngine.
069             * @return All object properties in KB.
070             */
071            public Set<ObjectProperty> getObjectProperties();
072            
073            /**
074             * Gets all data properties in the knowledge base, e.g. hasIncome, height.
075             * @return All data properties in KB.
076             */
077            public SortedSet<DatatypeProperty> getDatatypeProperties();
078            
079            /**
080             * Gets all data properties with range xsd:boolean.
081             * @see org.dllearner.core.owl.Datatype#BOOLEAN
082             * @return Boolean data properties in KB.
083             */
084            public SortedSet<DatatypeProperty> getBooleanDatatypeProperties();
085            
086            /**
087             * Gets all data properties with range xsd:double.
088             * TODO We could extend this to all types, which can be parsed into
089             * a double value, e.g. floats.
090             * @see org.dllearner.core.owl.Datatype#DOUBLE
091             * @return Double data properties in KB.
092             */
093            public SortedSet<DatatypeProperty> getDoubleDatatypeProperties();
094            
095            /**
096             * Gets all data properties with range xsd:int.
097             * TODO We could extend this to all types, which can be parsed into
098             * Integers, e.g. xsd:integer, xsd:negativeInteger, xsd:nonNegativeInteger etc.
099             * @see org.dllearner.core.owl.Datatype#INT
100             * @return Integer data properties in KB.
101             */
102            public SortedSet<DatatypeProperty> getIntDatatypeProperties();
103            
104            /**
105             * Gets all data properties with range xsd:string.
106             * TODO We could extend this to all types, which can be parsed into
107             * strings and even include the properties without any specified datatype.
108             * @see org.dllearner.core.owl.Datatype#String
109             * @return String data properties in KB.
110             */
111            public SortedSet<DatatypeProperty> getStringDatatypeProperties(); 
112            
113            /**
114             * Gets all individuals in the knowledge base, e.g. Eric, London, Car829. 
115             * @return All individuals in KB.
116             */     
117            public SortedSet<Individual> getIndividuals();
118    
119            /**
120             * Returns the base URI of the knowledge base. If several knowledge sources are
121             * used, we only pick one of their base URIs.
122             * @return The base URI, e.g. http://dbpedia.org/resource/.
123             */
124            public String getBaseURI();
125            
126            /**
127             * Returns the prefixes used in the knowledge base, e.g. foaf for
128             * foaf: <http://xmlns.com/foaf/0.1/>. If several knowledge sources are used,
129             * their prefixes are merged. (In case a prefix is defined twice with different
130             * values, we pick one of those.)
131             * @return The prefix mapping.
132             */
133            public Map<String, String> getPrefixes();
134            
135            /**
136             * Returns the RDFS labels of an entity.
137             * @param entity An entity, e.g. Machine.
138             * @return All values of rdfs:label for the entity, e.g. {"Machine"@en, "Maschine"@de}. 
139             */
140            public Set<Constant> getLabel(Entity entity);
141            
142    }