Kernel Prolog with Fluent based Builtins

tarau.jinni
Class DataBase

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--tarau.jinni.HashDict
                    |
                    +--tarau.jinni.BlackBoard
                          |
                          +--tarau.jinni.DataBase

public class DataBase
extends BlackBoard

Implements a Term and Clause objects based blackboard (database).

See Also:
Serialized Form

Field Summary
private static java.lang.String lastFile
           
private static Const no
           
private static Const yes
           
 
Fields inherited from class java.util.Hashtable
count, ENTRIES, entrySet, KEYS, keySet, loadFactor, modCount, serialVersionUID, table, threshold, values, VALUES
 
Constructor Summary
DataBase()
           
 
Method Summary
static void addClause(Clause C, HashDict ktable)
          adds a Clause to the joint Linda and Predicate table
 Term all(java.lang.String k, Term FX)
          Returns a (possibly empty) list of matching Term objects
private  void all0(int max, java.util.Vector To, java.lang.String k, Term FXs)
           
private  Term all1(int max, Term FXs)
           
private  Term all2(int max, java.lang.String k, Term FXs)
           
private static void apply_parser(Parser p, java.lang.String fname, BlackBoard ktable)
           
 Term cin(java.lang.String k, Term pattern)
          Removes a matching Term from the blackboards and signals failure if no such term is found.
private static boolean fileToProg(java.lang.String fname, boolean overwrite)
           
static boolean fromFile()
          reconsults the last reconsulted file
static boolean fromFile(java.lang.String f)
          reconsults a file by overwritting similar predicates in memory
static boolean fromFile(java.lang.String f, boolean overwrite)
          consults or reconsults a Prolog file by adding or overriding existing predicates to be extended to load from URLs transparently
 Term out(java.lang.String key, Term pattern)
          Adds a copy of a Term to the blackboard
 Term out(java.lang.String k, Term pattern, boolean copying)
          Adds a Term to the blackboard
 java.lang.String pprint()
          Returns a formatted String representation of this PrologBlackboard object
 java.lang.String pred_to_string(java.lang.String key)
           
static void processClause(Clause C, HashDict ktable)
          adds a Clause to the joint Linda and Predicate table
static boolean streamToProg(java.io.Reader sname, boolean overwrite)
          Reads a set of clauses from a stream and adds them to the blackboard.
private static boolean streamToProg(java.lang.String fname, java.io.Reader sname, boolean overwrite)
           
 java.util.Enumeration toEnumerationFor(java.lang.String k)
          Gives an Enumeration view to the Queue of Term or Clause objects stored at key k
 
Methods inherited from class tarau.jinni.BlackBoard
add, addBack, pick, take, toEnumeration
 
Methods inherited from class tarau.jinni.HashDict
name, stat
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, readObject, rehash, remove, size, toString, values, writeObject
 
Methods inherited from class java.lang.Object
, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

yes

private static Const yes

no

private static Const no

lastFile

private static java.lang.String lastFile
Constructor Detail

DataBase

public DataBase()
Method Detail

cin

public Term cin(java.lang.String k,
                Term pattern)
Removes a matching Term from the blackboards and signals failure if no such term is found.

out

public Term out(java.lang.String k,
                Term pattern,
                boolean copying)
Adds a Term to the blackboard

out

public Term out(java.lang.String key,
                Term pattern)
Adds a copy of a Term to the blackboard

all0

private void all0(int max,
                  java.util.Vector To,
                  java.lang.String k,
                  Term FXs)

all1

private Term all1(int max,
                  Term FXs)

all2

private Term all2(int max,
                  java.lang.String k,
                  Term FXs)

all

public Term all(java.lang.String k,
                Term FX)
Returns a (possibly empty) list of matching Term objects

toEnumerationFor

public java.util.Enumeration toEnumerationFor(java.lang.String k)
Gives an Enumeration view to the Queue of Term or Clause objects stored at key k
Overrides:
toEnumerationFor in class BlackBoard
See Also:
Queue, Term, Clause

pprint

public java.lang.String pprint()
Returns a formatted String representation of this PrologBlackboard object

pred_to_string

public java.lang.String pred_to_string(java.lang.String key)

fromFile

public static boolean fromFile(java.lang.String f,
                               boolean overwrite)
consults or reconsults a Prolog file by adding or overriding existing predicates to be extended to load from URLs transparently

fromFile

public static boolean fromFile(java.lang.String f)
reconsults a file by overwritting similar predicates in memory

fromFile

public static boolean fromFile()
reconsults the last reconsulted file

fileToProg

private static boolean fileToProg(java.lang.String fname,
                                  boolean overwrite)

streamToProg

public static boolean streamToProg(java.io.Reader sname,
                                   boolean overwrite)
Reads a set of clauses from a stream and adds them to the blackboard. Overwrites old predicates if asked to. Returns true if all went well.

streamToProg

private static boolean streamToProg(java.lang.String fname,
                                    java.io.Reader sname,
                                    boolean overwrite)

apply_parser

private static void apply_parser(Parser p,
                                 java.lang.String fname,
                                 BlackBoard ktable)

addClause

public static void addClause(Clause C,
                             HashDict ktable)
adds a Clause to the joint Linda and Predicate table

processClause

public static void processClause(Clause C,
                                 HashDict ktable)
adds a Clause to the joint Linda and Predicate table
See Also:
Clause

Kernel Prolog with Fluent based Builtins