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.util.Map;
023
024 /**
025 * This class represents restrictions on datatypes, such as
026 * Man AND EXISTS hasAge >= 18.
027 *
028 * TODO: connect this with a data range and a datatype property
029 *
030 * @author Jens Lehmann
031 *
032 */
033 public class DatatypeSomeRestriction extends DatatypeQuantorRestriction {
034
035 /**
036 *
037 */
038 private static final long serialVersionUID = -9190086621306032225L;
039 DataRange dataRange;
040
041 /**
042 * @param datatypeProperty
043 */
044 public DatatypeSomeRestriction(DatatypeProperty datatypeProperty, DataRange dataRange) {
045 super(datatypeProperty);
046 this.dataRange = dataRange;
047 }
048
049 /* (non-Javadoc)
050 * @see org.dllearner.core.owl.Description#getArity()
051 */
052 @Override
053 public int getArity() {
054 return 0;
055 }
056
057 /* (non-Javadoc)
058 * @see org.dllearner.core.owl.KBElement#getLength()
059 */
060 public int getLength() {
061 return 1 + dataRange.getLength();
062 }
063
064 /* (non-Javadoc)
065 * @see org.dllearner.core.owl.KBElement#toString(java.lang.String, java.util.Map)
066 */
067 public String toString(String baseURI, Map<String, String> prefixes) {
068 return restrictedPropertyExpression.toString(baseURI, prefixes) + dataRange.toString(baseURI, prefixes);
069 }
070
071 /* (non-Javadoc)
072 * @see org.dllearner.core.owl.KBElement#toKBSyntaxString(java.lang.String, java.util.Map)
073 */
074 public String toKBSyntaxString(String baseURI, Map<String, String> prefixes) {
075 return restrictedPropertyExpression.toKBSyntaxString(baseURI, prefixes) + dataRange.toKBSyntaxString(baseURI, prefixes);
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 /* (non-Javadoc)
091 * @see org.dllearner.core.owl.Description#toManchesterSyntaxString()
092 */
093 @Override
094 public String toManchesterSyntaxString(String baseURI, Map<String,String> prefixes) {
095 return restrictedPropertyExpression.toManchesterSyntaxString(baseURI, prefixes) + dataRange.toManchesterSyntaxString(baseURI, prefixes);
096 }
097
098 /**
099 * @return the dataRange
100 */
101 public DataRange getDataRange() {
102 return dataRange;
103 }
104 }