RBNpackage
Class Data

java.lang.Object
  extended by RBNpackage.Data

public class Data
extends java.lang.Object


Constructor Summary
Data()
           
Data(java.lang.String rdef, RelStruc A)
          Read data from rdef file;
 
Method Summary
 void add(Atom at, boolean tv, java.lang.String dv)
           
 void add(Atom at, int tv, java.lang.String dv)
           
 void add(OneRelData ord)
           
 void add(Rel r, int[][] tuples, boolean tv, java.lang.String dv)
           
 int add(Rel r, int[] tuple, boolean tv, java.lang.String dv)
          Returns 1 if r,tuple,tv was not already in the data; 0 otherwise.
 void addRelation(Rel r, java.lang.String dv)
           
 java.util.Vector<int[]> allFalse(Rel r)
          Returns all tuples that are instantiated to false in relation r Tuples represented as integer arrays, using the internal indices of objects
 java.util.Vector<java.lang.String> allFalse(Rel r, RelStruc A)
          Returns all tuples that are instantiated to false in relation r Tuples represented as string arrays, using the names of objects as defined in A
 java.util.Vector<InstAtom> allInstAtoms()
           
 java.util.Vector<int[]> allTrue(Rel r)
          Returns all tuples that are instantiated to true in relation r Tuples represented as integer arrays, using the internal indices of objects
 java.util.Vector<java.lang.String> allTrue(Rel r, RelStruc A)
          Returns all tuples that are instantiated to true in relation r Tuples represented as string arrays, using the names of objects as defined in A
 Data copy()
           
 OneRelData dataAt(int i)
           
 void delete(Atom at)
           
 void delete(int a)
           
 void delete(Rel r)
          delete all instantiations of the relation relname
 void delete(Rel r, int[] tuple)
           
 void delete(Rel r, int[] tuple, boolean tv)
           
 java.util.Vector<Rel> getArbitraryRelations()
          returns all the relations with arity >=3
 java.util.Vector<Rel> getAttributes()
          returns all the relations with arity 1
 java.util.Vector<Rel> getBinaryRelations()
          returns all the relations with arity 2
 boolean isEmpty()
           
 int numRels()
           
 java.lang.String printAsString(RelStruc A, java.lang.String pref)
           
 java.lang.String printSummary()
           
 Rel relAt(int i)
           
 void saveToBLPDatFile(java.lang.String filename, int domsize)
           
 void saveToRDEF(java.io.File file, RelStruc struc)
           
 void saveToRDEF(java.io.FileWriter fwriter, RelStruc struc)
           
 void saveToRDEF(java.lang.String filename, RelStruc struc)
          The RelStruc argument is used to save the data using the real names for the objects.
 void shiftArgs(int a)
           
 int size()
           
 int truthValueOf(Atom at)
          Returns 1,0, or -1 according to whether at is true, false, or undefined according to this instantiation.
 int truthValueOf(Rel r, int[] tuple)
          Returns 1,0, or -1 according to whether r(tuple) is true, false, or undefined according to this instantiation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Data

public Data()

Data

public Data(java.lang.String rdef,
            RelStruc A)
Read data from rdef file;

Parameters:
rdef -
Method Detail

add

public void add(Atom at,
                int tv,
                java.lang.String dv)

add

public void add(OneRelData ord)

add

public void add(Atom at,
                boolean tv,
                java.lang.String dv)

add

public int add(Rel r,
               int[] tuple,
               boolean tv,
               java.lang.String dv)
Returns 1 if r,tuple,tv was not already in the data; 0 otherwise.

Parameters:
r -
tuple -
tv -
dv -
Returns:

add

public void add(Rel r,
                int[][] tuples,
                boolean tv,
                java.lang.String dv)

allTrue

public java.util.Vector<int[]> allTrue(Rel r)
Returns all tuples that are instantiated to true in relation r Tuples represented as integer arrays, using the internal indices of objects


allFalse

public java.util.Vector<int[]> allFalse(Rel r)
Returns all tuples that are instantiated to false in relation r Tuples represented as integer arrays, using the internal indices of objects


allTrue

public java.util.Vector<java.lang.String> allTrue(Rel r,
                                                  RelStruc A)
Returns all tuples that are instantiated to true in relation r Tuples represented as string arrays, using the names of objects as defined in A


allFalse

public java.util.Vector<java.lang.String> allFalse(Rel r,
                                                   RelStruc A)
Returns all tuples that are instantiated to false in relation r Tuples represented as string arrays, using the names of objects as defined in A


isEmpty

public boolean isEmpty()

delete

public void delete(Atom at)

delete

public void delete(Rel r,
                   int[] tuple)

delete

public void delete(Rel r,
                   int[] tuple,
                   boolean tv)

delete

public void delete(int a)

delete

public void delete(Rel r)
delete all instantiations of the relation relname


shiftArgs

public void shiftArgs(int a)

copy

public Data copy()

printAsString

public java.lang.String printAsString(RelStruc A,
                                      java.lang.String pref)

printSummary

public java.lang.String printSummary()

truthValueOf

public int truthValueOf(Atom at)
Returns 1,0, or -1 according to whether at is true, false, or undefined according to this instantiation.


truthValueOf

public int truthValueOf(Rel r,
                        int[] tuple)
Returns 1,0, or -1 according to whether r(tuple) is true, false, or undefined according to this instantiation.


allInstAtoms

public java.util.Vector<InstAtom> allInstAtoms()

saveToBLPDatFile

public void saveToBLPDatFile(java.lang.String filename,
                             int domsize)

numRels

public int numRels()

getAttributes

public java.util.Vector<Rel> getAttributes()
returns all the relations with arity 1


getBinaryRelations

public java.util.Vector<Rel> getBinaryRelations()
returns all the relations with arity 2


getArbitraryRelations

public java.util.Vector<Rel> getArbitraryRelations()
returns all the relations with arity >=3


size

public int size()

relAt

public Rel relAt(int i)

addRelation

public void addRelation(Rel r,
                        java.lang.String dv)

dataAt

public OneRelData dataAt(int i)

saveToRDEF

public void saveToRDEF(java.lang.String filename,
                       RelStruc struc)
The RelStruc argument is used to save the data using the real names for the objects. If struc=null then objects will be represented using their internal integer indices.

Parameters:
filename -
struc -

saveToRDEF

public void saveToRDEF(java.io.File file,
                       RelStruc struc)

saveToRDEF

public void saveToRDEF(java.io.FileWriter fwriter,
                       RelStruc struc)