org.ceryle.tm
Interface Inferencer

All Known Implementing Classes:
InferencerImpl

public interface Inferencer

Defines an inferencing API based upon topic map constructs. Absent a base ontology for first order logic, only native topic map relationships such as class-instance and superclass-subclass can be inferred. This problem is solved via a "logic.xtm" topic map defining a set of PSIs for various fundamental atoms, functions, and predicates.

Both the logic Topic Map and this API are planned to be extended via a number of additional features, such as support for sets, collections, first order logical relations, etc. So while this is an API, it should not be considered stable in that it will be added to successively. Existing methods will (hopefully) remain stable.

Copyright 2001-2007 Murray Altheim. All Rights Reserved.

Since:
JDK1.3
Version:
$Id: Inferencer.java,v 3.6 2007-06-15 12:09:32 altheim Exp $
Author:
Murray Altheim

Field Summary
static String LOGIC_PSI
          A String containing the base URL for Published Subject Indicator (PSI) for the logic PSIs defined in the topic map "logic.xtm" (located in that directory).
static String PSI_false
          A String containing the Published Subject Indicator (PSI) for the truth value 'false'.
static String PSI_true
          A String containing the Published Subject Indicator (PSI) for the truth value 'true'.
 
Method Summary
 Set getClasses(Topic topic)
          Returns a Set containing the classes to which the Topic topic is an instance.
 Set getInstances(Topic topic)
          Returns a Set containing the instances of the Topic topic as a class.
 Set getSubclasses(Topic topic)
          Returns a Set containing the subclasses of the Topic topic.
 Set getSuperclasses(Topic topic)
          Returns a Set containing the superclasses of the Topic topic.
 Association instanceOf(Topic instance, Topic classTopic)
          Creates Topic instance as an instance of the class Topic classTopic, adding it to the topic map as a new Association.
 boolean isClass(Topic topic)
          Returns true if Topic topic plays the role of class in any class-instance associations.
 boolean isClassInstance(Association assoc)
          Returns true if Association assoc is an instance of a class-instance association.
 boolean isClassOf(Topic classTopic, Topic instance, boolean proper)
          Returns true if Topic classTopic is an class for which Topic instance is an instance.
 boolean isInstance(Topic topic)
          Returns true if Topic topic plays the role of instance in any class-instance associations.
 boolean isInstanceOf(Topic instance, Topic classTopic, boolean proper)
          Returns true if Topic instance is an instance of Topic classTopic.
 boolean isMemberOf(Topic topic, Association assoc)
          Returns true if the Topic topic is a Member of Association assoc, regardless of role or type.
 boolean isSubclass(Topic topic)
          Returns true if Topic topic plays the role of subclass in any superclass-subclass associations.
 boolean isSubclassOf(Topic subclass, Topic superclass, boolean proper)
          Returns true if Topic subclass is a subclass of Topic superclass.
 boolean isSuperclass(Topic topic)
          Returns true if Topic topic plays the role of superclass in any superclass-subclass associations.
 boolean isSuperclassOf(Topic superclass, Topic subclass, boolean proper)
          Returns true if Topic superclass is a superclass of Topic subclass.
 boolean isSuperclassSubclass(Association assoc)
          Returns true if Association assoc is an instance of a superclass-subclass association.
 boolean playsRoleInAssociation(Topic topic, Topic rolespec, Topic type)
          Returns true if the Topic topic plays the role of rolespec in any Associations of Topic type.
 boolean playsRoleOfClassIn(Topic topic, Association assoc)
          Returns true if Topic topic plays the role of 'class' in Association assoc, which must be a class-instance association.
 boolean playsRoleOfInstanceIn(Topic topic, Association assoc)
          Returns true if Topic topic plays the role of 'instance' in Association assoc, which must be a class-instance association.
 boolean playsRoleOfSubclassIn(Topic topic, Association assoc)
          Returns true if Topic topic plays the role of 'subclass' in Association assoc, which must be a superclass-subclass association.
 boolean playsRoleOfSuperclassIn(Topic topic, Association assoc)
          Returns true if Topic topic plays the role of 'superclass' in Association assoc, which must be a superclass-subclass association.
 Association subclassOf(Topic subclass, Topic superclass)
          Creates Topic subclass as a subclass of Topic superclass, adding it to the topic map as a new Association.
 String truthValue(boolean value)
          Converts from a Java boolean value to the Ceryle PSIs for true and false.
 boolean truthValue(String uri)
          Converts from the Ceryle PSIs for true and false to a Java boolean.
 

Field Detail

LOGIC_PSI

static final String LOGIC_PSI
A String containing the base URL for Published Subject Indicator (PSI) for the logic PSIs defined in the topic map "logic.xtm" (located in that directory).

See Also:
Constant Field Values

PSI_true

static final String PSI_true
A String containing the Published Subject Indicator (PSI) for the truth value 'true'.

See Also:
Constant Field Values

PSI_false

static final String PSI_false
A String containing the Published Subject Indicator (PSI) for the truth value 'false'.

See Also:
Constant Field Values
Method Detail

truthValue

boolean truthValue(String uri)
                   throws InferenceException
Converts from the Ceryle PSIs for true and false to a Java boolean.

Throws:
InferenceException - if the URI is not recognized

truthValue

String truthValue(boolean value)
Converts from a Java boolean value to the Ceryle PSIs for true and false.


isClass

boolean isClass(Topic topic)
                throws InferenceException
Returns true if Topic topic plays the role of class in any class-instance associations.

Throws:
InferenceException

isInstance

boolean isInstance(Topic topic)
                   throws InferenceException
Returns true if Topic topic plays the role of instance in any class-instance associations.

Throws:
InferenceException

isSuperclass

boolean isSuperclass(Topic topic)
                     throws InferenceException
Returns true if Topic topic plays the role of superclass in any superclass-subclass associations.

Throws:
InferenceException

isSubclass

boolean isSubclass(Topic topic)
                   throws InferenceException
Returns true if Topic topic plays the role of subclass in any superclass-subclass associations.

Throws:
InferenceException

isClassInstance

boolean isClassInstance(Association assoc)
                        throws InferenceException
Returns true if Association assoc is an instance of a class-instance association.

This uses XTM's PSI class-instance to identify the association type.

Throws:
InferenceException

isSuperclassSubclass

boolean isSuperclassSubclass(Association assoc)
                             throws InferenceException
Returns true if Association assoc is an instance of a superclass-subclass association.

This uses XTM's PSI superclass-subclass to identify the association type.

Throws:
InferenceException

isMemberOf

boolean isMemberOf(Topic topic,
                   Association assoc)
Returns true if the Topic topic is a Member of Association assoc, regardless of role or type.


playsRoleOfClassIn

boolean playsRoleOfClassIn(Topic topic,
                           Association assoc)
                           throws InferenceException
Returns true if Topic topic plays the role of 'class' in Association assoc, which must be a class-instance association.

Throws:
InferenceException - if the Association is of the wrong type

playsRoleOfInstanceIn

boolean playsRoleOfInstanceIn(Topic topic,
                              Association assoc)
                              throws InferenceException
Returns true if Topic topic plays the role of 'instance' in Association assoc, which must be a class-instance association.

Throws:
InferenceException - if the Association is of the wrong type

playsRoleOfSuperclassIn

boolean playsRoleOfSuperclassIn(Topic topic,
                                Association assoc)
                                throws InferenceException
Returns true if Topic topic plays the role of 'superclass' in Association assoc, which must be a superclass-subclass association.

Throws:
InferenceException - if the Association is of the wrong type

playsRoleOfSubclassIn

boolean playsRoleOfSubclassIn(Topic topic,
                              Association assoc)
                              throws InferenceException
Returns true if Topic topic plays the role of 'subclass' in Association assoc, which must be a superclass-subclass association.

Throws:
InferenceException - if the Association is of the wrong type

playsRoleInAssociation

boolean playsRoleInAssociation(Topic topic,
                               Topic rolespec,
                               Topic type)
                               throws InferenceException
Returns true if the Topic topic plays the role of rolespec in any Associations of Topic type.

Throws:
InferenceException - if an error occurs while processing.

isSuperclassOf

boolean isSuperclassOf(Topic superclass,
                       Topic subclass,
                       boolean proper)
                       throws InferenceException
Returns true if Topic superclass is a superclass of Topic subclass. If the boolean proper is true, only proper (direct) relations return true.

Throws:
InferenceException

isSubclassOf

boolean isSubclassOf(Topic subclass,
                     Topic superclass,
                     boolean proper)
                     throws InferenceException
Returns true if Topic subclass is a subclass of Topic superclass. If the boolean proper is true, only proper (direct) relations return true.

Throws:
InferenceException

isClassOf

boolean isClassOf(Topic classTopic,
                  Topic instance,
                  boolean proper)
                  throws InferenceException
Returns true if Topic classTopic is an class for which Topic instance is an instance. If the boolean proper is false, a traversal of the superclass-subclass hierarchy is done to determine if this is a superclass for any of the instance Topic's class.

Throws:
InferenceException

isInstanceOf

boolean isInstanceOf(Topic instance,
                     Topic classTopic,
                     boolean proper)
                     throws InferenceException
Returns true if Topic instance is an instance of Topic classTopic. If the boolean proper is false, a traversal of the superclass-subclass hierarchy is done to determine if this is an instance of any of the class Topic's superclasses.

Throws:
InferenceException

getSuperclasses

Set getSuperclasses(Topic topic)
                    throws InferenceException
Returns a Set containing the superclasses of the Topic topic.

Throws:
InferenceException

getSubclasses

Set getSubclasses(Topic topic)
                  throws InferenceException
Returns a Set containing the subclasses of the Topic topic.

Throws:
InferenceException

getClasses

Set getClasses(Topic topic)
               throws InferenceException
Returns a Set containing the classes to which the Topic topic is an instance.

Throws:
InferenceException

getInstances

Set getInstances(Topic topic)
                 throws InferenceException
Returns a Set containing the instances of the Topic topic as a class.

Throws:
InferenceException

subclassOf

Association subclassOf(Topic subclass,
                       Topic superclass)
                       throws InferenceException
Creates Topic subclass as a subclass of Topic superclass, adding it to the topic map as a new Association. If the Association already exists, returns the existing one.

(This is the equivalent of Cyc's #$genls predicate)

Throws:
InferenceException

instanceOf

Association instanceOf(Topic instance,
                       Topic classTopic)
                       throws InferenceException
Creates Topic instance as an instance of the class Topic classTopic, adding it to the topic map as a new Association. If the Association already exists, returns the existing one.

(This is the equivalent of Cyc's #$isa predicate)

Throws:
InferenceException


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.