zeus.concepts
Class Fact

java.lang.Object
  extended byzeus.concepts.Fact

public class Fact
extends java.lang.Object

The Fact class is key conceptual data structure in ZEUS, since Fact objects store the information that collectively forms the application ontology. Each fact consists of a number of attribute-value pairs, which are stored in the AttributeList variable.

Fact objects come in two forms:

Facts originate from template descriptions, so they can only be created from an existing ontology by invoking the OntologyDb.getFact(boolean, java.lang.String) method of the agent's OntologyDb. This class is a little case study in how a little knowledge can be a dangerous thing. It seems that the concept of checking boolean flags one at a time didn't appeal to whoever implemented it (DN?) and instead a int based mask system has been used to check and set the characteristics of the class. Unfortunately I suspect that the mask is used in side effects for a number of algorithms in the core reasoners, so while I would like to remove this nonsense, I so far haven't summed up the courage!


Field Summary
static char A_CHR
           
static java.lang.String A_STR
           
protected  AttributeList attr
           
(package private)  java.lang.String descp
           
static char F_CHR
           
static java.lang.String F_STR
           
static boolean FACT
           
(package private)  ValueFunction functor
           
protected  java.lang.String id
           
protected static int IS_LOCAL
           
protected static int IS_NEGATION
           
protected static int IS_READ_ONLY
           
protected static int IS_REPLACED
           
protected static int IS_SIDE_EFFECT
           
protected static int IS_VARIABLE
           
protected  int modifiers
           
static java.lang.String NONVAR
           
protected  OntologyDb ontology
           
static java.lang.String SELF
           
static java.lang.String SELF_NAME
           
static java.lang.String THIS
           
static java.lang.String THIS_NAME
           
protected  java.lang.String type
           
static char V_CHR
           
static java.lang.String V_STR
           
static java.lang.String VAR
           
static boolean VARIABLE
           
 
Constructor Summary
  Fact()
           
  Fact(boolean is_variable, Fact fact)
           
(package private) Fact(boolean is_variable, java.lang.String type, OntologyDb ontology, GenSym genSym)
           
  Fact(Fact fact)
           
protected Fact(java.lang.String type, java.lang.String id, int modifiers, AttributeList attr, OntologyDb ontology)
           
 
Method Summary
 java.lang.String[] buildMap(Fact mapper)
          test to see if any of the values in this fact are mapped to the valeus in the @param mapper, make a map of attno to attno for all the attributes so that they can be mapped in the method map
 TreeNode createAttributeTree(boolean mode)
          Here mode defines whether or not this fact owns the attribute being edited, where 'true' implies the fact owns the attribute
private  void debug(java.lang.String str)
           
 boolean disjoin(Fact f)
           
 void doMap(Fact mapper, java.lang.String[] tmap)
          map the values of the attributes in this fact to the values in the fact mapper. map is an array of ints such that map[1] = 3 indicates that the attribute value[3] of mapper should be mapped to the value 1 of this fact
 Fact duplicate(DuplicationTable table)
           
 Fact duplicate(java.lang.String name, GenSym genSym)
           
 boolean equals(java.lang.Object obj)
          possibly this should return a true if it is equals in an oo sense?
 ValueFunction functor()
           
 AttributeList getAttributeList()
          getAttributeList returns a list of the attributes of the Fact.
 double getDouble(java.lang.String attribute)
           
 ValueFunction getFn(java.lang.String attribute)
           
 java.lang.String getId()
           
 int getInt(java.lang.String attribute)
           
 long getLong(java.lang.String attribute)
           
 int getModifiers()
           
 double getNetCost()
           
 int getNumber()
           
 OntologyDb getOntologyDb()
          made this accessor public (simon 23/9/02) with the object of using it to get service description information
 java.lang.String getType()
           
 double getUnitCost()
           
 ValueFunction getVal(int pos)
           
 java.lang.String getValue(java.lang.String attribute)
           
 java.lang.String ID()
           
 boolean isa(java.lang.String ancestor)
           
 boolean isDeterminate()
           
 boolean isDeterminate(java.lang.String attribute)
           
 boolean isLocal()
           
static boolean isLocal(int x)
           
 boolean isNegative()
           
static boolean isNegative(int x)
           
 boolean isReadOnly()
           
static boolean isReadOnly(int x)
           
 boolean isReplaced()
           
static boolean isReplaced(int x)
           
 boolean isSideEffect()
           
static boolean isSideEffect(int x)
           
 boolean isVariable()
           
static boolean isVariable(int x)
           
 java.lang.String[] listAttributes()
           
 ValueFunction[] listValues()
           
static void main(java.lang.String[] argv)
           
 void map(Fact toMap)
           
protected static java.lang.String name(boolean isVariable, GenSym genSym)
           
 VarFn newVar()
           
static java.lang.String newVar(GenSym genSym)
           
 java.lang.String[] objectAttributeNames()
           
 java.lang.String pprint()
           
 java.lang.String pprint(int sp)
           
 java.lang.String printDAML(java.lang.String header, java.lang.String footer)
          this is a bit of a mess, because we are passing a parameter that is used to ppring the fact into DAML format... header is the front of the parameter, footer is the close tag
 boolean resolve(Bindings bindings)
           
 boolean resolve(ResolutionContext context, Bindings bindings)
           
(package private)  void setAttributeList(AttributeList List)
           
protected  void setFunctor()
           
 void setId(java.lang.String id)
           
 void setIsLocal(boolean set)
           
static int setIsLocal(int x, boolean set)
           
 void setIsNegative(boolean set)
           
static int setIsNegative(int x, boolean set)
           
 void setIsReadOnly(boolean set)
           
static int setIsReadOnly(int x, boolean set)
           
 void setIsReplaced(boolean set)
           
static int setIsReplaced(int x, boolean set)
           
 void setIsSideEffect(boolean set)
           
static int setIsSideEffect(int x, boolean set)
           
 void setIsVariable(boolean set)
           
static int setIsVariable(int x, boolean set)
           
 void setModifiers(int modifiers)
           
 void setNumber(int x)
           
 void setNumber(VarFn var1)
           
 void setType(java.lang.String type)
           
 void setUnitCost(double x)
           
 void setUnitCost(VarFn var1)
           
 void setValue(java.lang.String attribute, boolean value)
           
 void setValue(java.lang.String attribute, double value)
           
 void setValue(java.lang.String attribute, int value)
           
 void setValue(java.lang.String attribute, long value)
           
 void setValue(java.lang.String attribute, java.lang.String value)
           
 void setValue(java.lang.String attribute, ValueFunction value)
           
 void setValues(java.lang.String[] input)
           
 java.lang.String toSL()
          added by Simon on 20/02/02 Get the SL value of this fact An abs factory implementation would be better, but I want to have a go at this first before investing too heavily in a final implementation
 java.lang.String toString()
           
 boolean unifiesWith(Fact f, Bindings bindings)
           
 boolean unifiesWithChild(Fact f, Bindings bindings)
           
 ValueFunction[] variables()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONVAR

public static final java.lang.String NONVAR
See Also:
Constant Field Values

VAR

public static final java.lang.String VAR
See Also:
Constant Field Values

V_STR

public static final java.lang.String V_STR
See Also:
Constant Field Values

V_CHR

public static final char V_CHR
See Also:
Constant Field Values

F_STR

public static final java.lang.String F_STR
See Also:
Constant Field Values

F_CHR

public static final char F_CHR
See Also:
Constant Field Values

A_STR

public static final java.lang.String A_STR
See Also:
Constant Field Values

A_CHR

public static final char A_CHR
See Also:
Constant Field Values

FACT

public static final boolean FACT
See Also:
Constant Field Values

VARIABLE

public static final boolean VARIABLE
See Also:
Constant Field Values

SELF_NAME

public static final java.lang.String SELF_NAME
See Also:
Constant Field Values

THIS_NAME

public static final java.lang.String THIS_NAME
See Also:
Constant Field Values

THIS

public static final java.lang.String THIS
See Also:
Constant Field Values

SELF

public static final java.lang.String SELF
See Also:
Constant Field Values

IS_VARIABLE

protected static final int IS_VARIABLE
See Also:
Constant Field Values

IS_NEGATION

protected static final int IS_NEGATION
See Also:
Constant Field Values

IS_READ_ONLY

protected static final int IS_READ_ONLY
See Also:
Constant Field Values

IS_REPLACED

protected static final int IS_REPLACED
See Also:
Constant Field Values

IS_LOCAL

protected static final int IS_LOCAL
See Also:
Constant Field Values

IS_SIDE_EFFECT

protected static final int IS_SIDE_EFFECT
See Also:
Constant Field Values

functor

transient ValueFunction functor

descp

transient java.lang.String descp

id

protected java.lang.String id

type

protected java.lang.String type

modifiers

protected int modifiers

attr

protected AttributeList attr

ontology

protected OntologyDb ontology
Constructor Detail

Fact

public Fact()

Fact

Fact(boolean is_variable,
     java.lang.String type,
     OntologyDb ontology,
     GenSym genSym)

Fact

public Fact(Fact fact)

Fact

public Fact(boolean is_variable,
            Fact fact)

Fact

protected Fact(java.lang.String type,
               java.lang.String id,
               int modifiers,
               AttributeList attr,
               OntologyDb ontology)
Method Detail

newVar

public static final java.lang.String newVar(GenSym genSym)

name

protected static java.lang.String name(boolean isVariable,
                                       GenSym genSym)

getOntologyDb

public OntologyDb getOntologyDb()
made this accessor public (simon 23/9/02) with the object of using it to get service description information


createAttributeTree

public TreeNode createAttributeTree(boolean mode)
Here mode defines whether or not this fact owns the attribute being edited, where 'true' implies the fact owns the attribute


isVariable

public static boolean isVariable(int x)

isNegative

public static boolean isNegative(int x)

isReadOnly

public static boolean isReadOnly(int x)

isLocal

public static boolean isLocal(int x)

isReplaced

public static boolean isReplaced(int x)

isSideEffect

public static boolean isSideEffect(int x)

isVariable

public boolean isVariable()

isNegative

public boolean isNegative()

isReadOnly

public boolean isReadOnly()

isLocal

public boolean isLocal()

isReplaced

public boolean isReplaced()

isSideEffect

public boolean isSideEffect()

ID

public java.lang.String ID()

getId

public java.lang.String getId()

getType

public java.lang.String getType()

getModifiers

public int getModifiers()

setId

public void setId(java.lang.String id)

setType

public void setType(java.lang.String type)

setModifiers

public void setModifiers(int modifiers)

setIsVariable

public static int setIsVariable(int x,
                                boolean set)

setIsNegative

public static int setIsNegative(int x,
                                boolean set)

setIsReadOnly

public static int setIsReadOnly(int x,
                                boolean set)

setIsLocal

public static int setIsLocal(int x,
                             boolean set)

setIsReplaced

public static int setIsReplaced(int x,
                                boolean set)

setIsSideEffect

public static int setIsSideEffect(int x,
                                  boolean set)

setIsVariable

public void setIsVariable(boolean set)

setIsNegative

public void setIsNegative(boolean set)

setIsReadOnly

public void setIsReadOnly(boolean set)

setIsLocal

public void setIsLocal(boolean set)

setIsReplaced

public void setIsReplaced(boolean set)

setIsSideEffect

public void setIsSideEffect(boolean set)

listAttributes

public java.lang.String[] listAttributes()

listValues

public ValueFunction[] listValues()

variables

public ValueFunction[] variables()

getAttributeList

public AttributeList getAttributeList()
getAttributeList returns a list of the attributes of the Fact. This is public in 1.2.1 so that it can be manipulated directly


getValue

public java.lang.String getValue(java.lang.String attribute)

getFn

public ValueFunction getFn(java.lang.String attribute)

getInt

public int getInt(java.lang.String attribute)

getDouble

public double getDouble(java.lang.String attribute)

getLong

public long getLong(java.lang.String attribute)

getNumber

public int getNumber()

setNumber

public void setNumber(int x)

setNumber

public void setNumber(VarFn var1)

getNetCost

public double getNetCost()

getUnitCost

public double getUnitCost()

setUnitCost

public void setUnitCost(double x)

setUnitCost

public void setUnitCost(VarFn var1)

newVar

public VarFn newVar()

setValue

public void setValue(java.lang.String attribute,
                     int value)

setValue

public void setValue(java.lang.String attribute,
                     long value)

setValue

public void setValue(java.lang.String attribute,
                     double value)

setValue

public void setValue(java.lang.String attribute,
                     boolean value)

setValue

public void setValue(java.lang.String attribute,
                     java.lang.String value)

setValue

public void setValue(java.lang.String attribute,
                     ValueFunction value)

setAttributeList

void setAttributeList(AttributeList List)

setValues

public void setValues(java.lang.String[] input)

equals

public boolean equals(java.lang.Object obj)
possibly this should return a true if it is equals in an oo sense?


setFunctor

protected void setFunctor()

isDeterminate

public boolean isDeterminate()

isDeterminate

public boolean isDeterminate(java.lang.String attribute)

objectAttributeNames

public java.lang.String[] objectAttributeNames()

toString

public java.lang.String toString()

toSL

public java.lang.String toSL()
added by Simon on 20/02/02 Get the SL value of this fact An abs factory implementation would be better, but I want to have a go at this first before investing too heavily in a final implementation


pprint

public java.lang.String pprint()

pprint

public java.lang.String pprint(int sp)

printDAML

public java.lang.String printDAML(java.lang.String header,
                                  java.lang.String footer)
this is a bit of a mess, because we are passing a parameter that is used to ppring the fact into DAML format... header is the front of the parameter, footer is the close tag


unifiesWith

public boolean unifiesWith(Fact f,
                           Bindings bindings)

unifiesWithChild

public boolean unifiesWithChild(Fact f,
                                Bindings bindings)

isa

public boolean isa(java.lang.String ancestor)

functor

public ValueFunction functor()

resolve

public boolean resolve(Bindings bindings)

resolve

public boolean resolve(ResolutionContext context,
                       Bindings bindings)

disjoin

public boolean disjoin(Fact f)

duplicate

public Fact duplicate(java.lang.String name,
                      GenSym genSym)

duplicate

public Fact duplicate(DuplicationTable table)

buildMap

public java.lang.String[] buildMap(Fact mapper)
test to see if any of the values in this fact are mapped to the valeus in the @param mapper, make a map of attno to attno for all the attributes so that they can be mapped in the method map


doMap

public void doMap(Fact mapper,
                  java.lang.String[] tmap)
map the values of the attributes in this fact to the values in the fact mapper. map is an array of ints such that map[1] = 3 indicates that the attribute value[3] of mapper should be mapped to the value 1 of this fact


getVal

public ValueFunction getVal(int pos)

map

public void map(Fact toMap)

debug

private void debug(java.lang.String str)

main

public static void main(java.lang.String[] argv)


Copyright © 2000-2003 BT Exact Technologies. All Rights Reserved.