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