com.clarkparsia.pellet.datatypes
Interface DatatypeReasoner

All Known Implementing Classes:
DatatypeReasonerImpl

public interface DatatypeReasoner

Title: Datatype Reasoner

Description: Reasoner encapsulating all concrete domain and datatype handling

Copyright: Copyright (c) 2009

Company: Clark & Parsia, LLC.

Author:
Mike Smith

Method Summary
 boolean containsAtLeast(int n, java.util.Collection<aterm.ATermAppl> ranges)
          Check that the intersection of a collection of data ranges contains a minimum number of elements.
 boolean declare(aterm.ATermAppl name)
          Declare a named datatype.
 boolean define(aterm.ATermAppl name, aterm.ATermAppl datarange)
          Name a data range (see OWL 2 DatatypeDefinition)
 aterm.ATermAppl getCanonicalRepresentation(aterm.ATermAppl literal)
          Get the canonical representation of a literal.
 Datatype<?> getDatatype(aterm.ATermAppl uri)
          Get the datatype identified by a uri
 aterm.ATermAppl getDefinition(aterm.ATermAppl name)
          Returns the definition for the given datatype name if it is defined, or null otherwise.
 aterm.ATermAppl getLiteral(java.lang.Object value)
          Get the canonical ATermAppl literal representation for a value space object
 java.lang.Object getValue(aterm.ATermAppl literal)
          Get the Java object representation of the data value.
 boolean isDeclared(aterm.ATermAppl name)
          Check if a specific datatype or named data range has been declared.
 boolean isDefined(aterm.ATermAppl name)
          Check if a specific datatype or named data range can be supported by the datatype reasoner.
 boolean isSatisfiable(java.util.Collection<aterm.ATermAppl> dataranges)
          Shorthand for isSatisfiable(Collection, Object) where value == null.
 boolean isSatisfiable(java.util.Collection<aterm.ATermAppl> dataranges, java.lang.Object value)
          Check the data ranges on a single literal node are satisfiable (independent of other nodes).
 boolean isSatisfiable(java.util.Set<Literal> nodes, java.util.Map<Literal,java.util.Set<Literal>> ineqs)
          Check that the data ranges and inequalities asserted on a collection of literal nodes are satisfiable.
 java.util.Collection<aterm.ATermAppl> listDataRanges()
          Return a collection of all known data ranges.
 boolean validLiteral(aterm.ATermAppl typedLiteral)
          Check if a typed literal is valid (i.e., it is in the lexical space for its datatype)
 java.util.Iterator<?> valueIterator(java.util.Collection<aterm.ATermAppl> dataranges)
          Get an iterator for the values of a finite datarange
 

Method Detail

containsAtLeast

boolean containsAtLeast(int n,
                        java.util.Collection<aterm.ATermAppl> ranges)
                        throws InvalidConstrainingFacetException,
                               InvalidLiteralException,
                               UnrecognizedDatatypeException
Check that the intersection of a collection of data ranges contains a minimum number of elements.

Parameters:
n - the minimum number of elements
ranges - the data ranges to intersect
Returns:
true if the intersection of ranges contains at least n elements, false else
Throws:
InvalidConstrainingFacetException
InvalidLiteralException
UnrecognizedDatatypeException

declare

boolean declare(aterm.ATermAppl name)
Declare a named datatype. See isDeclared(ATermAppl).

Parameters:
name - the name (normally URI) of the datatype
Returns:
true if name has not been previously declared, false else.

getCanonicalRepresentation

aterm.ATermAppl getCanonicalRepresentation(aterm.ATermAppl literal)
                                           throws InvalidLiteralException,
                                                  UnrecognizedDatatypeException
Get the canonical representation of a literal. There is a 1:1 mapping from elements in a datatype value space and the canonical representations.

Parameters:
literal - the literal to canonicalize
Returns:
the canonical form of the literal
Throws:
InvalidLiteralException - if the literal is not in the lexical space of the datatype
UnrecognizedDatatypeException - if the datatype is not recognized

getDatatype

Datatype<?> getDatatype(aterm.ATermAppl uri)
Get the datatype identified by a uri

Parameters:
uri - the datatype identifier (e.g., xsd:integer)
Returns:
the Datatype if uri is recognized, null otherwise

getLiteral

aterm.ATermAppl getLiteral(java.lang.Object value)
Get the canonical ATermAppl literal representation for a value space object

Parameters:
value - Element of the value space for some datatype
Returns:
The ATermAppl representation of value
Throws:
java.lang.IllegalArgumentException - if value is not contained in the value space of any recognized datatype

getValue

java.lang.Object getValue(aterm.ATermAppl literal)
                          throws InvalidLiteralException,
                                 UnrecognizedDatatypeException
Get the Java object representation of the data value. E.g., if the literal passed in represents "1"^^xsd:byte, then the object returned is a java.lang.Byte.

Parameters:
literal -
Returns:
Java object representation of literal
Throws:
InvalidLiteralException - if the literal is not in the lexical space of the datatype
UnrecognizedDatatypeException - if the datatype is not recognized

isDeclared

boolean isDeclared(aterm.ATermAppl name)
Check if a specific datatype or named data range has been declared. Declaratations can happen by

isDefined

boolean isDefined(aterm.ATermAppl name)
Check if a specific datatype or named data range can be supported by the datatype reasoner. I.e., it is either built-in or was the name parameter of a call define(ATermAppl, ATermAppl)

Parameters:
name - the name (normally URI) of the datatype or named data range
Returns:
true if name is supported, false else

getDefinition

aterm.ATermAppl getDefinition(aterm.ATermAppl name)
Returns the definition for the given datatype name if it is defined, or null otherwise.

Parameters:
name - the name of the datatype
Returns:
the definition for the given datatype name if it is defined, or null otherwise.

isSatisfiable

boolean isSatisfiable(java.util.Collection<aterm.ATermAppl> dataranges)
                      throws InvalidConstrainingFacetException,
                             InvalidLiteralException,
                             UnrecognizedDatatypeException
Shorthand for isSatisfiable(Collection, Object) where value == null.

Parameters:
dataranges - The data ranges on the literal node
Returns:
true if the conjunction of the data ranges is satisfiable, false else.
Throws:
InvalidConstrainingFacetException
InvalidLiteralException
UnrecognizedDatatypeException

isSatisfiable

boolean isSatisfiable(java.util.Collection<aterm.ATermAppl> dataranges,
                      java.lang.Object value)
                      throws InvalidConstrainingFacetException,
                             InvalidLiteralException,
                             UnrecognizedDatatypeException
Check the data ranges on a single literal node are satisfiable (independent of other nodes).

Parameters:
dconjunction - The data ranges on the literal node
value - A constant value asserted for the node or null if no such value is present.
Returns:
true if the conjunction of the data ranges is satisfiable, false else.
Throws:
InvalidConstrainingFacetException
InvalidLiteralException
UnrecognizedDatatypeException

isSatisfiable

boolean isSatisfiable(java.util.Set<Literal> nodes,
                      java.util.Map<Literal,java.util.Set<Literal>> ineqs)
                      throws InvalidConstrainingFacetException,
                             InvalidLiteralException,
                             UnrecognizedDatatypeException
Check that the data ranges and inequalities asserted on a collection of literal nodes are satisfiable.

Parameters:
nodes - A set representing all literals with in-edges from a single individual
ineqs - A map representing all literal inequality constraints
Returns:
true if the data ranges and inequalities are satisfiable, false else.
Throws:
InvalidConstrainingFacetException
InvalidLiteralException
UnrecognizedDatatypeException

listDataRanges

java.util.Collection<aterm.ATermAppl> listDataRanges()
Return a collection of all known data ranges.


define

boolean define(aterm.ATermAppl name,
               aterm.ATermAppl datarange)
Name a data range (see OWL 2 DatatypeDefinition)

Parameters:
name - a URI used to refer to the datatype
datarange - the datarange
Returns:
true if successful, false if name is already used

validLiteral

boolean validLiteral(aterm.ATermAppl typedLiteral)
                     throws UnrecognizedDatatypeException
Check if a typed literal is valid (i.e., it is in the lexical space for its datatype)

Parameters:
literal - The literal
Returns:
true if the literal is in the lexical space of the datatype, falseelse
Throws:
UnrecognizedDatatypeException

valueIterator

java.util.Iterator<?> valueIterator(java.util.Collection<aterm.ATermAppl> dataranges)
                                    throws InvalidConstrainingFacetException,
                                           InvalidLiteralException,
                                           UnrecognizedDatatypeException
Get an iterator for the values of a finite datarange

Parameters:
dataranges - the data ranges
Returns:
an Iterator
Throws:
InvalidConstrainingFacetException - if dataranges contains a datatype restriction in which the constraining facet is not valid
InvalidLiteralException - if dataranges references a literal value that is invalid
UnrecognizedDatatypeException - if dataranges references an unrecognized datatype
java.lang.IllegalArgumentException - if the conjunction of dataranges is not enumerable


Copyright © 2004 Evren Sirin. All Rights Reserved.