JTP API Documentation

jtp.frame.listen
Class Context

java.lang.Object
  |
  +--java.beans.beancontext.BeanContextChildSupport
        |
        +--java.beans.beancontext.BeanContextSupport
              |
              +--jtp.context.BasicReasoningContext
                    |
                    +--jtp.frame.listen.Context
All Implemented Interfaces:
BeanContext, BeanContextChild, BeanContextServiceRevokedListener, BeanContextServicesListener, Collection, DesignMode, EventListener, PropertyChangeListener, Serializable, VetoableChangeListener, Visibility
Direct Known Subclasses:
RDFReasoningContext

public class Context
extends BasicReasoningContext

See Also:
Serialized Form

Field Summary
protected static Symbol ONE_VALUE
           
protected static Symbol TRIPLE
           
protected static Symbol VALUE_LINK
           
protected static Symbol VC
           
 
Fields inherited from class jtp.context.BasicReasoningContext
tracer
 
Fields inherited from class java.beans.beancontext.BeanContextSupport
bcmListeners, children, designTime, locale, okToUseGui
 
Fields inherited from class java.beans.beancontext.BeanContextChildSupport
beanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupport
 
Fields inherited from interface java.beans.beancontext.BeanContext
globalHierarchyLock
 
Fields inherited from interface java.beans.DesignMode
PROPERTYNAME
 
Constructor Summary
Context()
           
 
Method Summary
protected  void addLink(Literal tgt, Literal src)
           
protected  void addListener(String name, Clause ruleClause, Collection ignore, URL publicLocation)
           
 void addRule(Clause ruleClause, String ruleName)
          Adds a new forward-chaining rule to the system.
protected  void addRule(Literal[] antecedents, Literal consequent, String ruleName)
          Adds a new forward-chaining rule to the system.
protected  void createContentHolders()
           
protected  void createEmptyContentHolders()
           
 DAMLParser getDamlParser()
           
 FrameKB getFrameKB()
           
 KIF2CNF getKifParser()
           
 void loadSpecs(URL spec)
           
 void loadSpecs(URL spec, URL publicLocation)
           
protected  Literal[] orderLiterals(Literal[] lits)
          Returns a new array of the Literals from lits.
 void setFrameKB(FrameKB f)
           
 void setUp()
           
 
Methods inherited from class jtp.context.BasicReasoningContext
ask, assertString, defaultSetup, getAskingDispatcher, getAskingReasoner, getAssertionResults, getIntermediateResultDispatcher, getMaxDepth, getParser, getStringAssertionResults, getTellingDispatcher, getTellingReasoner, getTracer, getTranslator, getUndoManager, loadClauses, loadKB, loadKB, setAskingDispatcher, setAskingReasoner, setIntermediateResultDispatcher, setMaxDepth, setParser, setTellingDispatcher, setTellingReasoner, setTracer, setUndoManager, tell, tellInternal, tellString, tellString, undo, untell
 
Methods inherited from class java.beans.beancontext.BeanContextSupport
add, addAll, addBeanContextMembershipListener, avoidingGui, bcsChildren, bcsPreDeserializationHook, bcsPreSerializationHook, childDeserializedHook, childJustAddedHook, childJustRemovedHook, classEquals, clear, contains, containsAll, containsKey, copyChildren, createBCSChild, deserialize, dontUseGui, fireChildrenAdded, fireChildrenRemoved, getBeanContextPeer, getChildBeanContextChild, getChildBeanContextMembershipListener, getChildPropertyChangeListener, getChildSerializable, getChildVetoableChangeListener, getChildVisibility, getLocale, getResource, getResourceAsStream, initialize, instantiateChild, isDesignTime, isEmpty, isSerializing, iterator, needsGui, okToUseGui, propertyChange, readChildren, remove, remove, removeAll, removeBeanContextMembershipListener, retainAll, serialize, setDesignTime, setLocale, size, toArray, toArray, validatePendingAdd, validatePendingRemove, vetoableChange, writeChildren
 
Methods inherited from class java.beans.beancontext.BeanContextChildSupport
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, initializeBeanContextResources, isDelegated, releaseBeanContextResources, removePropertyChangeListener, removeVetoableChangeListener, serviceAvailable, serviceRevoked, setBeanContext, validatePendingSetBeanContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.beans.beancontext.BeanContextChild
addPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Field Detail

VC

protected static final Symbol VC

VALUE_LINK

protected static final Symbol VALUE_LINK

ONE_VALUE

protected static final Symbol ONE_VALUE

TRIPLE

protected static final Symbol TRIPLE
Constructor Detail

Context

public Context()
Method Detail

getFrameKB

public FrameKB getFrameKB()

setFrameKB

public void setFrameKB(FrameKB f)

getDamlParser

public DAMLParser getDamlParser()

getKifParser

public KIF2CNF getKifParser()

setUp

public void setUp()

createContentHolders

protected void createContentHolders()
                             throws IOException
IOException

createEmptyContentHolders

protected void createEmptyContentHolders()

loadSpecs

public void loadSpecs(URL spec)
               throws IOException,
                      ReasoningException
IOException
ReasoningException

loadSpecs

public void loadSpecs(URL spec,
                      URL publicLocation)
               throws IOException,
                      ReasoningException
IOException
ReasoningException

addListener

protected void addListener(String name,
                           Clause ruleClause,
                           Collection ignore,
                           URL publicLocation)
                    throws ReasoningException
ReasoningException

addLink

protected void addLink(Literal tgt,
                       Literal src)
                throws ReasoningException
ReasoningException

addRule

public void addRule(Clause ruleClause,
                    String ruleName)
             throws ReasoningException
Adds a new forward-chaining rule to the system. ruleClause must be a Horn clause. If legal bindings can be found for all literals in the antecedent, the consequent will be told. ruleName is an identifier for the forward-chaining rule.

This method attempts to provide a reasonable binding order for the literals in the clause.

As an example, this is the clause used to implement the forward-chaining rule for type inheritance in RDF:

 (=> (and (subClassOf ?sub ?super)
          (type ?x ?sub))
     (type ?x ?super))
 

It is also legal to have inequality literals for comparing two constants use the Unique Name Assumption. For example, this clause defines a relation sibling:

 (=> (and (mother ?child1 ?child2)
          (/= ?child1 ?child2))
     (sibling ?child1 ?child2))
 

Parameters:
ruleClause - a Horn clause
ruleName - an identifier for the new forward-chaining rule
ReasoningException

orderLiterals

protected Literal[] orderLiterals(Literal[] lits)
Returns a new array of the Literals from lits. The ordering of the literals in the array returned is expected to be close-to-optimal for forward-chaining.

Note: The polarity of the input Literals is not checked. Also, the contents of the array returned may not be exactly the same as lits. Some of the Literals may have been rewritten.


addRule

protected void addRule(Literal[] antecedents,
                       Literal consequent,
                       String ruleName)
                throws ReasoningException
Adds a new forward-chaining rule to the system. If a set of bindings can be found for all of the Literals in antecedents, the bindings will be applied to consequent and asserted.

The forward-chaining reasoners will bind the antecedents in the order that they appear in the array.

Parameters:
antecedents - an array of antecedent Literals
consequent - a conclusion to be inferred from antecedents
ReasoningException

JTP API Documentation