org.semanticweb.HermiT.model.dataranges
Class DatatypeRestriction

java.lang.Object
  extended by org.semanticweb.HermiT.model.dataranges.DatatypeRestriction
All Implemented Interfaces:
CanonicalDataRange, DataRange, DLPredicate
Direct Known Subclasses:
DatatypeRestrictionAnyURI, DatatypeRestrictionBoolean, DatatypeRestrictionDateTime, DatatypeRestrictionDateTimeFin, DatatypeRestrictionDouble, DatatypeRestrictionInteger, DatatypeRestrictionIntegerFin, DatatypeRestrictionLiteral, DatatypeRestrictionOWLRealPlus, DatatypeRestrictionString, EnumeratedDataRange

public abstract class DatatypeRestriction
extends java.lang.Object
implements DataRange, CanonicalDataRange


Nested Class Summary
static class DatatypeRestriction.DT
           
static class DatatypeRestriction.Facets
           
 
Field Summary
protected  DatatypeRestriction.DT datatype
           
protected  boolean isBottom
           
protected  boolean isNegated
           
protected  java.util.Set<DataConstant> notOneOf
           
protected  java.util.Set<DataConstant> oneOf
           
protected  java.util.Set<DatatypeRestriction.Facets> supportedFacets
           
protected static java.util.Map<java.lang.String,java.lang.String> uris
           
 
Constructor Summary
DatatypeRestriction()
           
 
Method Summary
 boolean addOneOf(DataConstant constant)
          Adds constant to the values that represent this data range.
 boolean facetsAccept(DataConstant constant)
          Checks if the constant conforms to the facets
 int getArity()
           
 DatatypeRestriction.DT getDatatype()
          The datatype implements this DataRange instance
 java.net.URI getDatatypeURI()
          The URI of the datatype that implements this DataRange instance
 java.util.Set<DataConstant> getOneOf()
          Constants that are representing the allowed assignments for this datatype restriction.
 boolean isBottom()
          Checks whether this data range cannot contain values
 boolean isNegated()
          Checks whether this data range is negated.
 void negate()
          Negate this data range, i.e., if the range was negated it is no longer negated afterwards and if it was not negated it will be negated afterwards.
 boolean notOneOf(DataConstant constant)
          Adds constant to the values that are not allowed in this data range.
protected  java.lang.String printExtraInfo(Namespaces namespaces)
          Can be overwritten by the sub-classes, to print something between the datatype restriction and the list of oneOfs/notOneOfs
 void setNotOneOf(java.util.Set<DataConstant> notOneOf)
          A set of values that are not in the interpretation of this datatype restriction.
 void setOneOf(java.util.Set<DataConstant> oneOf)
          Defines the datatype restriction in terms of a set of constants.
 boolean supports(DatatypeRestriction.Facets facet)
          Checks whether the given facet is supported by the concrete implementation of this data range.
 java.lang.String toString()
           
 java.lang.String toString(Namespaces namespaces)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.semanticweb.HermiT.model.dataranges.DataRange
addFacet, getNewInstance
 
Methods inherited from interface org.semanticweb.HermiT.model.dataranges.CanonicalDataRange
accepts, canHandleAll, conjoinFacetsFrom, datatypeAccepts, getEnumerationSize, getSmallestAssignment, hasMinCardinality, isFinite
 

Field Detail

supportedFacets

protected java.util.Set<DatatypeRestriction.Facets> supportedFacets

uris

protected static final java.util.Map<java.lang.String,java.lang.String> uris

datatype

protected DatatypeRestriction.DT datatype

oneOf

protected java.util.Set<DataConstant> oneOf

notOneOf

protected java.util.Set<DataConstant> notOneOf

isNegated

protected boolean isNegated

isBottom

protected boolean isBottom
Constructor Detail

DatatypeRestriction

public DatatypeRestriction()
Method Detail

getArity

public int getArity()
Specified by:
getArity in interface DLPredicate
Returns:
the arity of the predicate

getDatatype

public DatatypeRestriction.DT getDatatype()
Description copied from interface: CanonicalDataRange
The datatype implements this DataRange instance

Specified by:
getDatatype in interface CanonicalDataRange
Specified by:
getDatatype in interface DataRange
Returns:
The datatype for the type of the concrete implementation for this DataRange.

getDatatypeURI

public java.net.URI getDatatypeURI()
Description copied from interface: CanonicalDataRange
The URI of the datatype that implements this DataRange instance

Specified by:
getDatatypeURI in interface CanonicalDataRange
Specified by:
getDatatypeURI in interface DataRange
Returns:
The URI for the type of the concrete implementation for this DataRange.

isNegated

public boolean isNegated()
Description copied from interface: CanonicalDataRange
Checks whether this data range is negated.

Specified by:
isNegated in interface CanonicalDataRange
Specified by:
isNegated in interface DataRange
Returns:
true if negated and false otherwise.

negate

public void negate()
Description copied from interface: CanonicalDataRange
Negate this data range, i.e., if the range was negated it is no longer negated afterwards and if it was not negated it will be negated afterwards.

Specified by:
negate in interface CanonicalDataRange
Specified by:
negate in interface DataRange

isBottom

public boolean isBottom()
Description copied from interface: CanonicalDataRange
Checks whether this data range cannot contain values

Specified by:
isBottom in interface CanonicalDataRange
Specified by:
isBottom in interface DataRange
Returns:
true if the restrictions on this data range cause the interpretation of it to be empty and false otherwise.

getOneOf

public java.util.Set<DataConstant> getOneOf()
Description copied from interface: CanonicalDataRange
Constants that are representing the allowed assignments for this datatype restriction. The strings are String representations of the datatype that concretely implements the DataRange, e.g., if the concrete implementation has URI for integers, the returned strings have to be interpreted as integers.

Specified by:
getOneOf in interface CanonicalDataRange
Specified by:
getOneOf in interface DataRange
Returns:
A set of constants that represent the current datatype restrictions and are to be interpreted according to the datatype URI of the concrete implementation of the DataRange.

setOneOf

public void setOneOf(java.util.Set<DataConstant> oneOf)
Description copied from interface: CanonicalDataRange
Defines the datatype restriction in terms of a set of constants.

Specified by:
setOneOf in interface CanonicalDataRange
Parameters:
oneOf - A set of constants that are String representations of values that are to be interpreted according to the datatype URI of the concrete implementation of the DataRange

addOneOf

public boolean addOneOf(DataConstant constant)
Description copied from interface: DataRange
Adds constant to the values that represent this data range.

Specified by:
addOneOf in interface DataRange
Parameters:
constant - A constants that is a String representation of a value that is to be interpreted according to the datatype URI of the concrete implementation of the DataRange
Returns:
true if the oneOf values did not already contain the given constant and false otherwise

setNotOneOf

public void setNotOneOf(java.util.Set<DataConstant> notOneOf)
Description copied from interface: CanonicalDataRange
A set of values that are not in the interpretation of this datatype restriction.

Specified by:
setNotOneOf in interface CanonicalDataRange
Parameters:
notOneOf - A set of constants that are String representations of values that are to be interpreted according to the datatype URI of the concrete implementation of the DataRange

notOneOf

public boolean notOneOf(DataConstant constant)
Description copied from interface: CanonicalDataRange
Adds constant to the values that are not allowed in this data range.

Specified by:
notOneOf in interface CanonicalDataRange
Parameters:
constant - A constants that is a String representation of a value that is to be interpreted according to the datatype URI of the concrete implementation of the DataRange
Returns:
true if the notOneOf values did not already contain the given constant and false otherwise

facetsAccept

public boolean facetsAccept(DataConstant constant)
Description copied from interface: CanonicalDataRange
Checks if the constant conforms to the facets

Specified by:
facetsAccept in interface CanonicalDataRange
Returns:
true if no facets are present or if facets accept constant and false otherwise

supports

public boolean supports(DatatypeRestriction.Facets facet)
Description copied from interface: DataRange
Checks whether the given facet is supported by the concrete implementation of this data range.

Specified by:
supports in interface DataRange
Parameters:
facet - a facet.
Returns:
true if the facet is supported by the concrete implementation of this data range and false otherwise.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(Namespaces namespaces)
Specified by:
toString in interface DLPredicate

printExtraInfo

protected java.lang.String printExtraInfo(Namespaces namespaces)
Can be overwritten by the sub-classes, to print something between the datatype restriction and the list of oneOfs/notOneOfs

Returns:
a string with extra information for the toString method, e.g., about facet values