ubc.cs.JLog.Foundation
Class jAPIQueryThread
java.lang.Object
java.lang.Thread
ubc.cs.JLog.Foundation.jPrologServiceThread
ubc.cs.JLog.Foundation.jRetryQueryThread
ubc.cs.JLog.Foundation.jAPIQueryThread
- All Implemented Interfaces:
- Runnable
public class jAPIQueryThread
- extends jRetryQueryThread
This class is the thread that attempts to prove a query. It can parse an
input string into the predicates of a user query, and it contains the
Prolog prover itself. The prover runs as part of this thread. It is similar to
jUserQueryThread, but is designed for use via jPrologAPI where the
caller is responsible to handling exceptions.
- Version:
- %I%, %G%
- Author:
- Glendon Holst
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
qinput
protected String qinput
beginq
protected jPrologServiceBroadcaster beginq
retryq
protected jPrologServiceBroadcaster retryq
endq
protected jPrologServiceBroadcaster endq
debugm
protected jPrologServiceBroadcaster debugm
prover
protected jProver prover
query
protected jPredicateTerms query
result
protected boolean result
retry
protected int retry
var_vector
protected jVariableVector var_vector
var_prebindings
protected Hashtable var_prebindings
result_exception
protected RuntimeException result_exception
jAPIQueryThread
public jAPIQueryThread(jPrologServices ps,
String qin)
jAPIQueryThread
public jAPIQueryThread(jPrologServices ps,
Hashtable bindings,
String qin)
setListeners
public void setListeners(jPrologServiceBroadcaster b,
jPrologServiceBroadcaster r,
jPrologServiceBroadcaster e,
jPrologServiceBroadcaster s,
jPrologServiceBroadcaster d)
retry
public void retry()
- Specified by:
retry in class jRetryQueryThread
waitForRetry
protected boolean waitForRetry()
run
public void run()
- Specified by:
run in interface Runnable- Overrides:
run in class Thread
query
protected void query()
internal_prove
protected void internal_prove()
internal_retry
protected void internal_retry()
getResultHashtable
public Hashtable getResultHashtable()
- Returns a hashtable of the variable bindings, as a result of a sucessful query / retry.
- Returns:
- Returns a hashtable with all the variables in the query, and their bindings.
Each key in the hashtable is a variable name, and the associated value
is the
jTerm the variable was bound to.
Returns null if the query failed.
getResultException
public RuntimeException getResultException()
- Returns the RuntimeException thrown by an unsucessful query / retry
(e.g., UnknownPredicateException).
- Returns:
- Returns a RuntimeException if the query failed.
Returns null if the query did not throw an exception.
Copyright © 2011. All Rights Reserved.