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.owl;
021
022 import java.net.URI;
023 import java.util.Map;
024
025 /**
026 * Implementation of owl:thing/TOP.
027 *
028 * TODO: According to the OWL 1.1 spec, owl:thing is special instance of
029 * class, so it might be better to put a method there for retrieving
030 * a/the instance of owl:thing. However, some algorithms require parent
031 * links e.g. in EXISTS r.TOP we may need to know where TOP belongs
032 * (especially for genetic operators). This is instance dependant, i.e.
033 * two different instances of TOP can have different parent links.
034 *
035 * @author Jens Lehmann
036 *
037 */
038 public class Thing extends Description {
039
040 /**
041 *
042 */
043 private static final long serialVersionUID = -880276915058868775L;
044 public static final Thing instance = new Thing();
045
046 private static final URI uri = URI.create("http://www.w3.org/2002/07/owl#Thing");
047
048 public String toString(String baseURI, Map<String,String> prefixes) {
049 return "TOP";
050 }
051
052 public String toKBSyntaxString(String baseURI, Map<String,String> prefixes) {
053 return "TOP";
054 }
055
056 @Override
057 public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) {
058 // in Protege 3.3 owl:Thing
059 // in Protege 4.0 only Thing
060 //return "owl:Thing";
061 return "Thing";
062
063 }
064
065 public URI getURI(){
066 return uri;
067 }
068
069 public int getLength() {
070 return 1;
071 }
072
073 @Override
074 public int getArity() {
075 return 0;
076 }
077
078 /* (non-Javadoc)
079 * @see org.dllearner.core.owl.Description#accept(org.dllearner.core.owl.DescriptionVisitor)
080 */
081 @Override
082 public void accept(DescriptionVisitor visitor) {
083 visitor.visit(this);
084 }
085
086 public void accept(KBElementVisitor visitor) {
087 visitor.visit(this);
088 }
089
090
091 }