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.


Constructor Index

 o ParkaInterface()

Method Index

 o closeConnection()
Closes the current connection.
 o closeKB()
Closes the current KB without closing the connection.
 o createClass(String)
Creates a new class with the specified name.
 o createKB(String)
Creates a new KB with the name supplied by the user.
 o createPredicate(String, int)
Creates a new predicate in the KB using the given name and arity.
 o createPredicate(String, String[])
Creates a new predicate with given name and types for arguments.
 o 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.
 o displayMessage(String)
 o 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.
 o establishConnection(String, int)
Establish a connection to the given host and port number.
 o formatAssert(String, String, String)
 o formatAssert(String, String[])
Create a Parka assertion string.
 o formatAtom(Atom)
Given a generic atom object, returns the equivalent Parka query or assertion string.
 o formatSentence(Sentence)
Given a generic Sentence object, returns the equivalent Parka string.
 o openKB(String)
Open a KB using the existing connection.
 o openKB(String, String, int)
Initialize the specified knowledge base via connection at the given host and port number.
 o queryKB(Query)
Issues an arbitrary query to the KB.
 o storeAxiom(Axiom)
Asserts a new axiom to the KB.
 o storeClaim(String, Sentence)
Given a Sentence, creates a Parka claims for it.
 o storeClaim(String, String, String[])
Creates a Parka claim given a source, predicate and array of arguments.

Constructors

 o ParkaInterface
 public ParkaInterface()

Methods

 o 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
 o createKB
 public void createKB(String kbName) throws KBException
Creates a new KB with the name supplied by the user.

Overrides:
createKB in class KBInterface
 o 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
 o openKB
 public void openKB(String parkaKB) throws KBException
Open a KB using the existing connection.

Overrides:
openKB in class KBInterface
 o closeKB
 public void closeKB()
Closes the current KB without closing the connection.

Overrides:
closeKB in class KBInterface
 o closeConnection
 public void closeConnection()
Closes the current connection. Any open KBs will be closed as well.

Overrides:
closeConnection in class KBInterface
 o 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
 o 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.

 o 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
 o 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
 o createClass
 public void createClass(String className)
Creates a new class with the specified name.

Overrides:
createClass in class KBInterface
 o 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
 o createPredicate
 public void createPredicate(String predicate,
                             String argTypes[])
Creates a new predicate with given name and types for arguments.

Overrides:
createPredicate in class KBInterface
 o storeAxiom
 public void storeAxiom(Axiom anAxiom)
Asserts a new axiom to the KB.

Overrides:
storeAxiom in class KBInterface
 o displayMessage
 public void displayMessage(String msg)
 o 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

 o 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.

 o formatAssert
 public static String formatAssert(String predicate,
                                   String arg1,
                                   String arg2)
 o formatAtom
 public static String formatAtom(Atom atom)
Given a generic atom object, returns the equivalent Parka query or assertion string.

 o 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