RBNpackage
Class RelStruc

java.lang.Object
  extended by RBNpackage.RelStruc
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
OrdStruc, SparseRelStruc

public abstract class RelStruc
extends java.lang.Object
implements java.lang.Cloneable


Field Summary
static int BLP_FORMAT
           
 int dom
           
static int MLN_FORMAT
           
 
Constructor Summary
RelStruc()
          Creates new RelStruc
RelStruc(int n)
          Creates new RelStruc with a domain of n elements
RelStruc(RelStruc toCopy)
           
RelStruc(java.util.Vector en, OneStrucData data, java.util.Vector coords)
           
 
Method Summary
 void addDomainDec(Element el)
           
 void addNode()
           
 void addNode(int xc, int yc)
           
 void addNode(java.lang.String st)
           
 void addNode(java.lang.String st, int xc, int yc)
           
abstract  void addRelation(Rel r)
           
 int addTuple(Rel r, int[] tuple)
           
 void addTuple(Rel r, java.lang.String[] tuple)
           
 int[][] allArgTuples(Rel r)
           
 int[] allElements(Type rtype)
          Returns all elements in the domain of type rtype.
 int[][] allTrue(CConstr cc, java.lang.String[] vars)
           
 java.util.Vector<int[]> allTrue(Rel r)
           
 int[][] allTypedTuples(Type[] types)
          Returns an array of integer tuples of length types.length.
abstract  java.lang.Object clone()
           
 void createCoords()
           
 void deleteRelation(Rel r)
           
 void deleteTuple(Rel r, int[] tuple)
           
 int domSize()
           
 java.util.Vector<Rel> getArbitraryRelations()
           
 java.util.Vector<Rel> getAttributes()
           
 java.util.Vector getAttributesColors(int n)
           
 java.util.Vector[] getBinaryColors(int node)
          Returns the binary relation tuples from this node to some other node and the colors of the relations
 java.util.Vector<Rel> getBinaryRelations()
           
 java.util.Vector getCoords()
           
 OneStrucData getData()
           
 int[] getIndexes(java.lang.String[] tuple)
           
 java.util.Vector getNames()
           
 java.util.Vector<Rel> getRels()
           
 int getSize()
           
 boolean isOrdRel(Rel r)
          Returns true if r is one of the OrdRels
 java.lang.String nameAt(int i)
           
 java.lang.String namesAt(int[] args)
           
 java.lang.String[] namesAtAsArray(int[] args)
           
 void saveToAtomFile(java.lang.String filename, int format)
          Saves the RelStruc into a file using the BLP or MLN syntax for logical specifications
 void saveToMysql(java.lang.String dbname)
          Saves the RelStruc to a new MySQL database
 void saveToProximityText(java.lang.String path)
          Saves the RelStruc to a collection of text file in Proximity format path is a directory path
 void saveToRDEF(java.io.File f)
           
 void saveToTextFiles(java.lang.String path)
          Saves structure into collection of text files into directory path
protected  void setData(OneStrucData dat)
           
 int setName(java.lang.String name, int i)
           
 boolean trueCC(CConstr cc, java.lang.String[] vars, int[] args)
           
 boolean trueGroundCC(CConstr cc)
           
 boolean trueOrdAtom(CConstrAtom at)
           
 boolean trueOrdAtom(CConstrAtom at, java.lang.String[] vars, int[] args)
           
 int truthValueOf(Rel r, int[] args)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLP_FORMAT

public static int BLP_FORMAT

MLN_FORMAT

public static int MLN_FORMAT

dom

public int dom
Constructor Detail

RelStruc

public RelStruc()
Creates new RelStruc


RelStruc

public RelStruc(int n)
Creates new RelStruc with a domain of n elements


RelStruc

public RelStruc(java.util.Vector en,
                OneStrucData data,
                java.util.Vector coords)

RelStruc

public RelStruc(RelStruc toCopy)
Since:
20060515
Method Detail

clone

public abstract java.lang.Object clone()
Overrides:
clone in class java.lang.Object
Since:
20060515

domSize

public int domSize()

nameAt

public java.lang.String nameAt(int i)

namesAt

public java.lang.String namesAt(int[] args)

namesAtAsArray

public java.lang.String[] namesAtAsArray(int[] args)

setName

public int setName(java.lang.String name,
                   int i)

createCoords

public void createCoords()

addNode

public void addNode()

addNode

public void addNode(java.lang.String st)

addNode

public void addNode(java.lang.String st,
                    int xc,
                    int yc)

addNode

public void addNode(int xc,
                    int yc)

addTuple

public int addTuple(Rel r,
                    int[] tuple)

deleteTuple

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

addRelation

public abstract void addRelation(Rel r)
                          throws RBNCompatibilityException
Throws:
RBNCompatibilityException

deleteRelation

public void deleteRelation(Rel r)

getCoords

public java.util.Vector getCoords()

getNames

public java.util.Vector getNames()

getSize

public int getSize()

getAttributesColors

public java.util.Vector getAttributesColors(int n)

getBinaryColors

public java.util.Vector[] getBinaryColors(int node)
Returns the binary relation tuples from this node to some other node and the colors of the relations


getAttributes

public java.util.Vector<Rel> getAttributes()

getBinaryRelations

public java.util.Vector<Rel> getBinaryRelations()

getArbitraryRelations

public java.util.Vector<Rel> getArbitraryRelations()

isOrdRel

public boolean isOrdRel(Rel r)
Returns true if r is one of the OrdRels


trueCC

public boolean trueCC(CConstr cc,
                      java.lang.String[] vars,
                      int[] args)
               throws java.lang.IllegalArgumentException,
                      RBNCompatibilityException
Throws:
java.lang.IllegalArgumentException
RBNCompatibilityException

trueGroundCC

public boolean trueGroundCC(CConstr cc)
                     throws RBNCompatibilityException
Throws:
RBNCompatibilityException

trueOrdAtom

public boolean trueOrdAtom(CConstrAtom at)

trueOrdAtom

public boolean trueOrdAtom(CConstrAtom at,
                           java.lang.String[] vars,
                           int[] args)

allElements

public int[] allElements(Type rtype)
                  throws RBNIllegalArgumentException
Returns all elements in the domain of type rtype. Throws RBNIllegalArgumentException if RelStruc does not contain a unary relation corresponding to the relation defining rtype.

Parameters:
rtype -
Returns:
Throws:
RBNIllegalArgumentException

allTrue

public int[][] allTrue(CConstr cc,
                       java.lang.String[] vars)
                throws java.lang.IllegalArgumentException,
                       RBNCompatibilityException
Throws:
java.lang.IllegalArgumentException
RBNCompatibilityException

allTrue

public java.util.Vector<int[]> allTrue(Rel r)

allTypedTuples

public int[][] allTypedTuples(Type[] types)
                       throws RBNIllegalArgumentException
Returns an array of integer tuples of length types.length. The array contains all tuples of domainelements such that the i'th component in the tuple is an element in the relation types[i]; Throws an error if types contains a type not corresponding to a unary relation in this RelStruc

Parameters:
types -
Returns:
Throws:
RBNIllegalArgumentException

allArgTuples

public int[][] allArgTuples(Rel r)
                     throws RBNIllegalArgumentException
Throws:
RBNIllegalArgumentException

saveToAtomFile

public void saveToAtomFile(java.lang.String filename,
                           int format)
Saves the RelStruc into a file using the BLP or MLN syntax for logical specifications


saveToRDEF

public void saveToRDEF(java.io.File f)

saveToProximityText

public void saveToProximityText(java.lang.String path)
                         throws RBNioException
Saves the RelStruc to a collection of text file in Proximity format path is a directory path

Throws:
RBNioException

saveToMysql

public void saveToMysql(java.lang.String dbname)
Saves the RelStruc to a new MySQL database


saveToTextFiles

public void saveToTextFiles(java.lang.String path)
Saves structure into collection of text files into directory path

Parameters:
path -

getData

public OneStrucData getData()

setData

protected void setData(OneStrucData dat)

addDomainDec

public void addDomainDec(Element el)

addTuple

public void addTuple(Rel r,
                     java.lang.String[] tuple)

getIndexes

public int[] getIndexes(java.lang.String[] tuple)

getRels

public java.util.Vector<Rel> getRels()

truthValueOf

public int truthValueOf(Rel r,
                        int[] args)