com.haley.haleyrules
Interface Ruleset

All Superinterfaces:
KnowledgeBaseObject

public interface Ruleset
extends KnowledgeBaseObject

The Ruleset interface publishes the API for a ruleset defined by the Eclipse "defruleset" construct. A rulset belongs to a knowledge base and contains a set of agendas A ruleset is returned by KnowledgeBase.findRuleset(String) and Agenda.getRuleset().

Author:
The Haley Enterprise Copyright © 1998-2004, all rights reserved. Questions, comments or to report a problem contact support@haley.com

Method Summary
 void excise()
          Removes the ruleset from the knowledge base and calls KnowledgeBaseObject.release().
 Agenda findAgenda(java.lang.String name)
          Finds the Agenda agenda for this ruleset with the specified name.
 AgendaIterator getAgendas()
           
 java.lang.String getName()
           
 int getSalience()
          Returns the salience for the ruleset.
 long run(WorkingMemory wm)
          Runs the inference engine, executing rules from any agenda within this ruleset
 long run(WorkingMemory wm, long limit)
          Runs the inference engine, executing rules from any agenda within this ruleset until the limit has been reached.
 
Methods inherited from interface com.haley.haleyrules.KnowledgeBaseObject
getKnowledgeBase, release
 

Method Detail

getAgendas

public AgendaIterator getAgendas()
                          throws EclipseException
Throws:
EclipseException

findAgenda

public Agenda findAgenda(java.lang.String name)
                  throws EclipseException
Finds the Agenda agenda for this ruleset with the specified name. Each call to this function must be accompanied with a corresponding call to KnowledgeBaseObject.release() or Agenda.excise().

Parameters:
name - the name of the agenda to look for
Returns:
the agenda with the specified name in the ruleset or null if it could not be found
Throws:
EclipseException - if knowledge base has been cleared
EclipseException - if the ruleset has been excised
See Also:
KnowledgeBase.findRuleset(String), KnowledgeBaseObject.release()

getName

public java.lang.String getName()
                         throws EclipseException
Returns:
the name of the encapsulated ruleset (the same as the first argument to defruleset).
Throws:
EclipseException - if knowledge base has been cleared
EclipseException - if ruleset has been excised

getSalience

public int getSalience()
                throws EclipseException
Returns the salience for the ruleset. Rulesets with a higher salience will be activated before rulesets with lower salience

Returns:
the salience for the ruleset
Throws:
EclipseException - if knowledge base has been cleared
EclipseException - if ruleset has been excised

excise

public void excise()
            throws EclipseException
Removes the ruleset from the knowledge base and calls KnowledgeBaseObject.release(). Any subsequent use of any member function, other than KnowledgeBaseObject.release(), will result in an exception. Since all agendas within the ruleset, as well as all of the rules within their agendas, are also removed, any subsequent use of these objects will also result in an exception. Even after an excise, every function that returned the ruleset, e.g., KnowledgeBase.findRuleset(String) or Agenda.getRuleset(), must be paired with a corresponding call to KnowledgeBaseObject.release() or excise().

Throws:
EclipseException - if knowledge base has been cleared
EclipseException - if ruleset has been excised

run

public long run(WorkingMemory wm,
                long limit)
         throws EclipseException
Runs the inference engine, executing rules from any agenda within this ruleset until the limit has been reached.

Parameters:
wm - the working memory for the run
limit - the maximum number of rules to fire, where -1 indicates that there is no limit
Returns:
the number of rules executed
Throws:
EclipseException - if knowledgebase has been cleared
EclipseException - if the working memory has been deleted
EclipseException - if the ruleset has been excised
EclipseException - if an error occurs
See Also:
run(WorkingMemory), Agenda.run(WorkingMemory,long), Agenda.run(WorkingMemory), WorkingMemory.run(long), WorkingMemory.run()

run

public long run(WorkingMemory wm)
         throws EclipseException
Runs the inference engine, executing rules from any agenda within this ruleset

Parameters:
wm - the working memory for the run
Returns:
the number of rules executed
Throws:
EclipseException - if the knowledge base has been cleared
EclipseException - if the working memory has been deleted
EclipseException - if the ruleset has been excised
EclipseException - if an error occurs
See Also:
run(WorkingMemory,long), Agenda.run(WorkingMemory,long), Agenda.run(WorkingMemory), WorkingMemory.run(long), WorkingMemory.run()


Copyright © 1998-2006 Haley Systems, Inc. All Rights Reserved.