org.semwebcentral.sweetrules.sweetxsb
Class SweetXSBForwardInferencingTask

java.lang.Object
  extended byorg.semwebcentral.sweetrules.sweetxsb.SweetXSBForwardInferencingTask
All Implemented Interfaces:
ISweetInferenceEngineTask

public class SweetXSBForwardInferencingTask
extends java.lang.Object
implements ISweetInferenceEngineTask


This class performs exhaustive brute force inferencing on XSB It first converts the any(non xsb) input format through the common rules into XSB and parses the first line(s) of the output to get a list of predicates and their arity. Once this has been determined, it queries each predicate with all parameters being variables and returns the results.

If the input is XSB then it is converted to clp and then back again to XSB and the above process of extracting the predicate names and querying is repeated

Modified on: Sep 3, 2004 7:23:40 PM

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

Field Summary
private  ISweetKBDescriptor kbDescriptor
          The KB descriptor on which exhaustive forward inferencing is done
private  Logger logger
          The logger object for this class
private  java.lang.String tableDeclarationRegex
          The regex for a table declaration in XSB
private  SweetXSBEngine xsbEngine
          The XSB engine
 
Constructor Summary
SweetXSBForwardInferencingTask(ISweetKBDescriptor kbDescriptor, SweetXSBEngine engine)
          Constructor for the exhaustive brute force inferencing
 
Method Summary
 java.lang.Object execute()
          Implementation of execute for the exhaustive brute force forward inferencing
private  void generatePredicateList(java.lang.String tableDeclaration, java.util.Vector predicateNameVector, java.util.Vector predicateArityVector)
          The method to generate predicate list
private  java.lang.String generateXSBKB()
          Converts the data in the KB specified by the descriptor to a canonical XSB form same as the form generated by CommonRules
private  java.lang.String getTableDeclaration(java.lang.String canonicalXSB)
          Returns the table declaration from a given XSB KB String
private  ISweetQueryResult[] runQueries(java.lang.String xsbKB, java.util.Vector predicateNameVector, java.util.Vector predicateArityVector)
          Runs the exhaustive queries and returns the results
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tableDeclarationRegex

private java.lang.String tableDeclarationRegex
The regex for a table declaration in XSB


kbDescriptor

private ISweetKBDescriptor kbDescriptor
The KB descriptor on which exhaustive forward inferencing is done


xsbEngine

private SweetXSBEngine xsbEngine
The XSB engine


logger

private Logger logger
The logger object for this class

Constructor Detail

SweetXSBForwardInferencingTask

public SweetXSBForwardInferencingTask(ISweetKBDescriptor kbDescriptor,
                                      SweetXSBEngine engine)
Constructor for the exhaustive brute force inferencing

Parameters:
kbDescriptor - The descriptor of the knowledge base to load
engine - The XSB engine to execute forward inferencing on
Method Detail

execute

public java.lang.Object execute()
                         throws SweetInferenceEngineException
Implementation of execute for the exhaustive brute force forward inferencing

Specified by:
execute in interface ISweetInferenceEngineTask
Returns:
The result of doing exhaustive forward inferencing
Throws:
SweetInferenceEngineException - if an error occurs

runQueries

private ISweetQueryResult[] runQueries(java.lang.String xsbKB,
                                       java.util.Vector predicateNameVector,
                                       java.util.Vector predicateArityVector)
                                throws SweetInferenceEngineException
Runs the exhaustive queries and returns the results

Parameters:
xsbKB - The XSB knowledge base
predicateNameVector - The vector of predicate names
predicateArityVector - The vector of predicate arities
Returns:
The result of executing the queries
Throws:
SweetInferenceEngineException

generateXSBKB

private java.lang.String generateXSBKB()
                                throws SweetInferenceEngineException
Converts the data in the KB specified by the descriptor to a canonical XSB form same as the form generated by CommonRules

Returns:
The XSB KB
Throws:
SweetInferenceEngineException

getTableDeclaration

private java.lang.String getTableDeclaration(java.lang.String canonicalXSB)
                                      throws SweetInferenceEngineException
Returns the table declaration from a given XSB KB String

Parameters:
canonicalXSB - The xsb KB string
Returns:
The table declaration
Throws:
SweetInferenceEngineException - if a proper table declaration is not found

generatePredicateList

private void generatePredicateList(java.lang.String tableDeclaration,
                                   java.util.Vector predicateNameVector,
                                   java.util.Vector predicateArityVector)
The method to generate predicate list

Parameters:
tableDeclaration - A valid XSB table declaration
predicateNameVector - The predicate name vector to be filled with predicate names
predicateArityVector - The predicate arity vector to be filled with predicate arity