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.Set;
023    import java.util.SortedSet;
024    import java.util.TreeSet;
025    
026    import org.dllearner.core.owl.DataRange;
027    import org.dllearner.core.owl.DatatypeProperty;
028    import org.dllearner.core.owl.DatatypePropertyHierarchy;
029    import org.dllearner.core.owl.Description;
030    import org.dllearner.core.owl.ClassHierarchy;
031    import org.dllearner.core.owl.NamedClass;
032    import org.dllearner.core.owl.ObjectProperty;
033    import org.dllearner.core.owl.ObjectPropertyHierarchy;
034    
035    /**
036     * Reasoning requests related to the schema of the knowledge base.
037     * 
038     * @author Jens Lehmann
039     *
040     */
041    public interface SchemaReasoner {
042            
043            /**
044             * Returns all named classes, which are not satisfiable, i.e. cannot 
045             * have instances.
046             * @return The set of inconsistent classes.
047             */
048            public Set<NamedClass> getInconsistentClasses();  
049            
050            /**
051             * Returns the domain of this object property. (Theoretically, there could
052             * be more than one domain axiom. However, this can be considered a modelling
053             * error.)
054             * @param objectProperty An object property in the knowledge base.
055             * @return The rdfs:domain of <code>objectProperty</code>
056             */
057            public Description getDomain(ObjectProperty objectProperty);
058            
059            /**
060             * Returns the domain of this data property.
061             * @param datatypeProperty An data property in the knowledge base.
062             * @return The rdfs:domain of <code>datatypeProperty</code>
063             */     
064            public Description getDomain(DatatypeProperty datatypeProperty);
065            
066            /**
067             * Returns the range of this object property.
068             * @param objectProperty An object property in the knowledge base.
069             * @return The rdfs:range of <code>objectProperty</code>
070             */     
071            public Description getRange(ObjectProperty objectProperty);
072            
073            /**
074             * Returns the range of this data property.
075             * @param datatypeProperty An data property in the knowledge base.
076             * @return The rdfs:range of <code>datatypeProperty</code>
077             */             
078            public DataRange getRange(DatatypeProperty datatypeProperty);
079            
080            /**
081             * Checks whether <code>superClass</code> is a super class of <code>subClass</code>.
082             * @param superClass The (supposed) super class.
083             * @param subClass The (supposed) sub class.
084             * @return Whether <code>superClass</code> is a super class of <code>subClass</code>.
085             */
086            public boolean isSuperClassOf(Description superClass, Description subClass);    
087            
088            /**
089             * Checks whether <code>class1</code> is equivalent to <code>class2</code>.
090             * @param class1 The first class.
091             * @param class2 The second class2.
092             * @return Whether <code>class1</code> is equivalent to <code>class2</code>.
093             */
094            public boolean isEquivalentClass(Description class1, Description class2);       
095                    
096            /**
097             * Returns all asserted owl:equivalence class axioms for the given class.
098             * @param namedClass A named class in the background knowledge.
099             * @return A set of descriptions asserted to be equal to the named class.
100             */
101            public Set<Description> getAssertedDefinitions(NamedClass namedClass);
102            
103            /**
104             * Checks which of <code>superClasses</code> are super classes of <code>subClass</code>
105             * @param superClasses A set of (supposed) super classes.
106             * @param subClasses The (supposed) sub class.
107             * @return The subset of <code>superClasses</code>, which satisfy the superclass-subclass relationship.
108             */
109            public Set<Description> isSuperClassOf(Set<Description> superClasses, Description subClasses);      
110    
111            /**
112             * Computes and returns the class hierarchy of the knowledge base.
113             *
114             * @return The subsumption hierarchy of this knowledge base.
115             */
116            public ClassHierarchy getClassHierarchy();      
117            
118            /**
119             * Returns direct super classes in the class hierarchy.
120             * 
121             * @param description
122             *            Atomic concept, top, or bottom.
123             * @return A set of more general concepts.
124             */
125            public SortedSet<Description> getSuperClasses(Description description);
126    
127            /**
128             * Returns direct sub classes in the class hierarchy.
129             * 
130             * @param description
131             *            Atomic concept, top, or bottom.
132             * @return A set of more special concepts.
133             */
134            public SortedSet<Description> getSubClasses(Description description);
135    
136            /**
137             * Computes and returns the object property hierarchy of the knowledge base.
138             * @return The object property hierarchy of the knowlege base.
139             */
140            public ObjectPropertyHierarchy getObjectPropertyHierarchy();
141            
142            /**
143             * Returns more general concepts in the subsumption hierarchy.
144             * 
145             * @see ObjectPropertyHierarchy#getMoreGeneralRoles(ObjectProperty)
146             * @param objectProperty
147             *            Atomic concept, top, or bottom.
148             * @return A set of more general concepts.
149             */
150            public SortedSet<ObjectProperty> getSuperProperties(ObjectProperty objectProperty);
151    
152            /**
153             * Returns more special concepts in the subsumption hierarchy.
154             * 
155             * @see ObjectPropertyHierarchy#getMoreSpecialRoles(ObjectProperty)
156             * @param objectProperty
157             *            Atomic concept, top, or bottom.
158             * @return A set of more special concepts.
159             */
160            public SortedSet<ObjectProperty> getSubProperties(ObjectProperty objectProperty);
161    
162            /**
163             * TODO Outdated in OWL 2, because the universal role is the most general.
164             * @see ObjectPropertyHierarchy#getMostGeneralRoles()
165             * @return The most general roles.
166             */
167            public TreeSet<ObjectProperty> getMostGeneralProperties();
168    
169            /**
170             * TODO Outdated in OWL, because the bottom role is the most specific.
171             * @see ObjectPropertyHierarchy#getMostSpecialRoles()
172             * @return The most special roles.
173             */
174            public TreeSet<ObjectProperty> getMostSpecialProperties();
175    
176            /**
177             * Computes and returns the data property hierarchy of the knowledge base.
178             * @return The data property hierarchy of the knowlege base.
179             */     
180            public DatatypePropertyHierarchy getDatatypePropertyHierarchy();
181            
182            /**
183             * Returns more general concepts in the subsumption hierarchy.
184             * 
185             * @see ObjectPropertyHierarchy#getMoreGeneralRoles(ObjectProperty)
186             * @param dataProperty
187             *            Atomic concept, top, or bottom.
188             * @return A set of more general concepts.
189             */
190            public SortedSet<DatatypeProperty> getSuperProperties(DatatypeProperty dataProperty);
191    
192            /**
193             * Returns more special concepts in the subsumption hierarchy.
194             * 
195             * @see ObjectPropertyHierarchy#getMoreSpecialRoles(ObjectProperty)
196             * @param dataProperty
197             *            Atomic concept, top, or bottom.
198             * @return A set of more special concepts.
199             */
200            public SortedSet<DatatypeProperty> getSubProperties(DatatypeProperty dataProperty);
201    
202            /**
203             * @see ObjectPropertyHierarchy#getMostGeneralRoles()
204             * @return The most general roles.
205             */
206            public TreeSet<DatatypeProperty> getMostGeneralDatatypeProperties();
207    
208            /**
209             * @see ObjectPropertyHierarchy#getMostSpecialRoles()
210             * @return The most special roles.
211             */
212            public TreeSet<DatatypeProperty> getMostSpecialDatatypeProperties();
213            
214    }