RBNpackage
Class OneStrucData

java.lang.Object
  extended by RBNpackage.OneStrucData

public class OneStrucData
extends java.lang.Object

An object of the class OneStrucData represents one (partial) observation of a given set of relations for one given input domain. The set of relations can either be the set of predefined relations in an input domain (then OneStrucData is the main part of the specification of the input domain), or the set of probabilistic relations (then OneStrucData is the main part of the specification of a data case, or of evidence).


Constructor Summary
OneStrucData()
           
OneStrucData(java.util.Vector<OneRelData> alldat)
           
 
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 addAtomsToElement(Element el, RelStruc struc)
           
 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
 OneStrucData copy()
           
 OneRelData dataAt(int i)
           
 void delete(Atom at)
           
 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)
           
 void deleteShift(int a)
          Delete all atoms containing a and subtract 1 from all elements with index > a
 java.lang.String dvAt(int i)
           
 OneRelData find(Rel r)
           
 OneRelData find(java.lang.String relname)
          Finds the OneRelData with name relname
 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
 java.util.Vector<Rel> getRels()
          The RelStruc argument is used to save the data using the real names for the objects.
 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 setData(Rel r, int[] args, boolean tv)
           
 void setData(java.lang.String relname, int[] args, boolean tv)
           
 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

OneStrucData

public OneStrucData()

OneStrucData

public OneStrucData(java.util.Vector<OneRelData> alldat)
Method Detail

add

public void add(OneRelData ord)

setData

public void setData(Rel r,
                    int[] args,
                    boolean tv)
             throws RBNIllegalArgumentException
Throws:
RBNIllegalArgumentException

setData

public void setData(java.lang.String relname,
                    int[] args,
                    boolean tv)
             throws RBNIllegalArgumentException
Throws:
RBNIllegalArgumentException

find

public OneRelData find(java.lang.String relname)
Finds the OneRelData with name relname

Parameters:
relname -
Returns:

find

public OneRelData find(Rel r)

add

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

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)

deleteShift

public void deleteShift(int a)
Delete all atoms containing a and subtract 1 from all elements with index > a

Parameters:
a -

delete

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


shiftArgs

public void shiftArgs(int a)

copy

public OneStrucData 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)

addAtomsToElement

public void addAtomsToElement(Element el,
                              RelStruc struc)

getRels

public java.util.Vector<Rel> getRels()
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 -

dvAt

public java.lang.String dvAt(int i)