org.semwebcentral.sweetrules.sweetxsb
Class SweetXSBEngine

java.lang.Object
  extended byorg.semwebcentral.sweetrules.infrastructure.AbstractSweetInferenceEngine
      extended byorg.semwebcentral.sweetrules.sweetxsb.SweetXSBEngine
All Implemented Interfaces:
ISweetInferenceEngine

public final class SweetXSBEngine
extends AbstractSweetInferenceEngine


Implementation of the XSB engine object as a singleton It is a singleton because interProlog throws an exception if multiple instances are created

Modified on: Aug 25, 2004, 2:08:55 PM

Author:
Shashidhara K Ganjugunte, Dr. Benjamin Grosof, Dr. Said Tabet, Chitravanu Neogy

Field Summary
static java.lang.String NONDETERMINISTIC_GOAL_NAME
          The name of the non deterministic goal, which helps in returning all the results
private  java.lang.String nonDeterministicGoalCreateString
          The string to create the nondeterminstic goal refer to interprolog faq for more details
private  PrologEngine prologEngine
          Prolog engine provided by interProlog
private static SweetXSBEngine xsbEngine
          The private singleton instance
 
Fields inherited from class org.semwebcentral.sweetrules.infrastructure.AbstractSweetInferenceEngine
engineDescriptor
 
Constructor Summary
private SweetXSBEngine(java.lang.String xsbEnginePath)
          Constructor for the XSB engine
 
Method Summary
private  void bootStrapXSBEngine()
          We need to add some rules to the XSB engine in order to retrieve multiple results (consult InterProlog faq on returning more than 1 result) This is done by this method.
static SweetXSBEngine getInstance(java.lang.String xsbEnginePath)
          Get method to access the singleton xsb engine
 PrologEngine getPrologEngine()
          Get method for the PrologEngine returns the native engine stored in this engine
 
Methods inherited from class org.semwebcentral.sweetrules.infrastructure.AbstractSweetInferenceEngine
getIEDescriptor, runTask, setIEDescriptor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONDETERMINISTIC_GOAL_NAME

public static final java.lang.String NONDETERMINISTIC_GOAL_NAME
The name of the non deterministic goal, which helps in returning all the results

See Also:
Constant Field Values

nonDeterministicGoalCreateString

private final java.lang.String nonDeterministicGoalCreateString
The string to create the nondeterminstic goal refer to interprolog faq for more details

See Also:
Constant Field Values

prologEngine

private PrologEngine prologEngine
Prolog engine provided by interProlog


xsbEngine

private static SweetXSBEngine xsbEngine
The private singleton instance

Constructor Detail

SweetXSBEngine

private SweetXSBEngine(java.lang.String xsbEnginePath)
                throws SweetInferenceEngineException
Constructor for the XSB engine

Parameters:
xsbEnginePath - The path to xsb engine executable
Method Detail

getInstance

public static SweetXSBEngine getInstance(java.lang.String xsbEnginePath)
                                  throws SweetInferenceEngineException
Get method to access the singleton xsb engine

Parameters:
xsbEnginePath -
Returns:
Bootstrapped xsbEngine (singleton) instance
Throws:
SweetInferenceEngineException

getPrologEngine

public PrologEngine getPrologEngine()
Get method for the PrologEngine returns the native engine stored in this engine

Returns:
The native prolog engine(bootstrapped) assoicated with this SweetXSBEngine

bootStrapXSBEngine

private void bootStrapXSBEngine()
                         throws java.io.IOException
We need to add some rules to the XSB engine in order to retrieve multiple results (consult InterProlog faq on returning more than 1 result) This is done by this method. This ensures all engines stored inside SweetXSBEngine have been configured to return multiple results

Throws:
java.io.IOException