All Packages Class Hierarchy This Package Previous Next Index
Class ShoeKb.ParkaInterface
java.lang.Object
|
+----ShoeKb.KBInterface
|
+----ShoeKb.ParkaInterface
- public class ParkaInterface
- extends KBInterface
- implements ParkaWin
Implements the KBInterface for dynamic communication with a
Parka KB.
-
ParkaInterface()
-
-
closeConnection()
- Closes the current connection.
-
closeKB()
- Closes the current KB without closing the connection.
-
createClass(String)
- Creates a new class with the specified name.
-
createKB(String)
- Creates a new KB with the name supplied by the user.
-
createPredicate(String, int)
- Creates a new predicate in the KB using the given name and arity.
-
createPredicate(String, String[])
- Creates a new predicate with given name and types for
arguments.
-
deleteClaims(String)
- Deletes all claims made by a source by first getting a list of the
sources claims, deleting all of these and then checking to see
if there are any other claims for the same assertions.
-
displayMessage(String)
-
-
escapeSpecialChars(String)
- This function takes a string intended as an argument and escapes those
characters that have special meaning in a Parka Assertion or query.
-
establishConnection(String, int)
- Establish a connection to the given host and port number.
-
formatAssert(String, String, String)
-
-
formatAssert(String, String[])
- Create a Parka assertion string.
-
formatAtom(Atom)
- Given a generic atom object, returns the equivalent Parka query
or assertion string.
-
formatSentence(Sentence)
- Given a generic Sentence object, returns the equivalent Parka
string.
-
openKB(String)
- Open a KB using the existing connection.
-
openKB(String, String, int)
- Initialize the specified knowledge base via connection at the
given host and port number.
-
queryKB(Query)
- Issues an arbitrary query to the KB.
-
storeAxiom(Axiom)
- Asserts a new axiom to the KB.
-
storeClaim(String, Sentence)
- Given a Sentence, creates a Parka claims for it.
-
storeClaim(String, String, String[])
- Creates a Parka claim given a source, predicate and array of
arguments.
ParkaInterface
public ParkaInterface()
establishConnection
public void establishConnection(String newHost,
int newPort) throws KBException
- Establish a connection to the given host and port number.
- Overrides:
- establishConnection in class KBInterface
createKB
public void createKB(String kbName) throws KBException
- Creates a new KB with the name supplied by the user.
- Overrides:
- createKB in class KBInterface
openKB
public void openKB(String parkaKB,
String newHost,
int newPort) throws KBException
- Initialize the specified knowledge base via connection at the
given host and port number.
- Overrides:
- openKB in class KBInterface
openKB
public void openKB(String parkaKB) throws KBException
- Open a KB using the existing connection.
- Overrides:
- openKB in class KBInterface
closeKB
public void closeKB()
- Closes the current KB without closing the connection.
- Overrides:
- closeKB in class KBInterface
closeConnection
public void closeConnection()
- Closes the current connection. Any open KBs will be closed as well.
- Overrides:
- closeConnection in class KBInterface
queryKB
public ResultSet queryKB(Query query)
- Issues an arbitrary query to the KB. Variable arguments are
preceded by question marks. The answers are returned in a matrix.
- Overrides:
- queryKB in class KBInterface
storeClaim
public void storeClaim(String source,
Sentence sentence)
- Given a Sentence, creates a Parka claims for it. If the Sentence
has conjuncts, then a claim is created for each conjunct. Two
inserts are actually made to Parka: one for the actual fact, and one
that states the claimant of the fact. If the arguments of these
inserts contain any special Parka characters, the appropriate escape
codes are inserted.
storeClaim
public void storeClaim(String source,
String predicate,
String args[])
- Creates a Parka claim given a source, predicate and array of
arguments. The arguments have escape codes inserted if they contain
any special Parka characters. Two inserts are made to Parka:
one for the actual fact, and one that states the claimant of
the fact.
- Overrides:
- storeClaim in class KBInterface
deleteClaims
public void deleteClaims(String source)
- Deletes all claims made by a source by first getting a list of the
sources claims, deleting all of these and then checking to see
if there are any other claims for the same assertions. If not, the
assertion is deleted as well.
- Overrides:
- deleteClaims in class KBInterface
createClass
public void createClass(String className)
- Creates a new class with the specified name.
- Overrides:
- createClass in class KBInterface
createPredicate
public void createPredicate(String predicate,
int arity)
- Creates a new predicate in the KB using the given name and arity.
- Overrides:
- createPredicate in class KBInterface
createPredicate
public void createPredicate(String predicate,
String argTypes[])
- Creates a new predicate with given name and types for
arguments.
- Overrides:
- createPredicate in class KBInterface
storeAxiom
public void storeAxiom(Axiom anAxiom)
- Asserts a new axiom to the KB.
- Overrides:
- storeAxiom in class KBInterface
displayMessage
public void displayMessage(String msg)
escapeSpecialChars
public static String escapeSpecialChars(String inString)
- This function takes a string intended as an argument and escapes those
characters that have special meaning in a Parka Assertion or query.
In particular, the hash ('#'), backslash ('\') and parentheses ('(', ')')
are escaped. Also, newlines are converted to spaces so that the
query string can be safely used in the file format
formatAssert
public static String formatAssert(String predicate,
String args[])
- Create a Parka assertion string. Pounds (#'s) are inserted after
the predicate name and between each argument. Any special characters
are escaped. If an argument is missing, it is replaced with a dash.
formatAssert
public static String formatAssert(String predicate,
String arg1,
String arg2)
formatAtom
public static String formatAtom(Atom atom)
- Given a generic atom object, returns the equivalent Parka query
or assertion string.
formatSentence
public static String formatSentence(Sentence sentence)
- Given a generic Sentence object, returns the equivalent Parka
string.
All Packages Class Hierarchy This Package Previous Next Index