|
||||||||||
| PREV CLASS NEXT CLASS | NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
The TemplateAssertion interface publishes the API to assert a fact for an Eclipse template, i.e., a representation declared with "deftemplate", whereas
the RelationAssertion interface publishes the API to assert facts for an Eclipse relation, i.e., a representation declared with "defrelation".
After obtaining the template from a knowledge base, e.g, KnowledgeBase.findTemplate(String), an application may begin
the process of asserting a fact into a working memory with a call to Template.beginAssertion(WorkingMemory).
An application can assign values to the fields via the methods published by this interface.
Once all the desired fields have been initialized, a fact is created with a call to Assertion.assertFact().
Any values that are not specified default a value defined by template itself. Also, since the
assertion is a KnowledgeBaseObject, it needs to be released.
TemplateAssertion assertion = null;
try {
assertion = template.beginAssertion(wm);
...
assertion.assign(field,"John Doe");
...
assertion.assertFact();
} catch (Exception e) {
...
} finally {
if (assertion != null)
assertion.release();
}
| Method Summary | |
void |
assign(TemplateField field,
boolean value)
Assign the specified boolean to the specified field. |
void |
assign(TemplateField field,
double value)
Assign the specified number to the specified field. |
void |
assign(TemplateField field,
long value)
Assign the specified number to the specified field. |
void |
assign(TemplateField field,
java.lang.String value)
Assign the specified string to the specified field. |
void |
assignAsDate(TemplateField field,
java.util.Date value)
Assign the specified date to the specified field without a time component. |
void |
assignAsDate(TemplateField field,
int year,
int month,
int day)
Assign year/month/day as a date in the specified field without a time component. |
void |
assignAsDate(TemplateField field,
java.lang.String dateString,
java.lang.String format)
Assign a date specified by converting the dateString to a date based upon the format to the specified field. |
void |
assignAsObject(TemplateField field,
java.lang.Object object)
Assign the specified object to the specified field. |
void |
assignAsTime(TemplateField field,
java.util.Date value)
Assign the specified date as a specific point in time. |
void |
assignAsTime(TemplateField field,
long seconds)
Assign a time specified as the number of seconds (not milliseconds) since 00:00:00 Jan 1, 1970 to the specified field. |
void |
assignAsTime(TemplateField field,
java.lang.String timeString,
java.lang.String format)
Assign a time specified by converting the timeString to a time based upon the format to the specified field. |
void |
assignAsUnsigned(TemplateField field,
long value)
Assign the specified long to the specified field. |
void |
assignDefault(TemplateField field)
Assigns the default value for the specified field. |
| Methods inherited from interface com.haley.haleyrules.Assertion |
assertFact, reset |
| Methods inherited from interface com.haley.haleyrules.WorkingMemoryObject |
getWorkingMemory |
| Methods inherited from interface com.haley.haleyrules.KnowledgeBaseObject |
getKnowledgeBase, release |
| Method Detail |
public void assign(TemplateField field,
boolean value)
throws EclipseException
field - the template field to which to assignvalue - the boolean value to assign
EclipseException - if the assertion has been released
EclipseException - if the field does not belong to the template being asserted
EclipseException - if the knowledge base has been cleared
EclipseException - if the knowledge base has been deleted
EclipseException - if the working memory has been deleted
public void assign(TemplateField field,
double value)
throws EclipseException
field - the template field to which to assignvalue - the double value to assign
EclipseException - if the assertion has been released
EclipseException - if the field does not belong to the template being asserted
EclipseException - if the knowledge base has been cleared
EclipseException - if the knowledge base has been deleted
EclipseException - if the working memory has been deleted
public void assign(TemplateField field,
long value)
throws EclipseException
field - the template field to which to assignvalue - the long value to assign
EclipseException - if the assertion has been released
EclipseException - if the field does not belong to the template being asserted
EclipseException - if the knowledge base has been cleared
EclipseException - if the knowledge base has been deleted
EclipseException - if the working memory has been deleted
public void assignAsUnsigned(TemplateField field,
long value)
throws EclipseException
field - the template field to which to assignvalue - the long value to assign
EclipseException - if the specified number is negative
EclipseException - if the assertion has been released
EclipseException - if the field does not belong to the template being asserted
EclipseException - if the knowledge base has been cleared
EclipseException - if the knowledge base has been deleted
EclipseException - if the working memory has been deleted
public void assign(TemplateField field,
java.lang.String value)
throws EclipseException
assignAsObject(TemplateField,Object) if you want the string to be assigned as an object rather than an Eclipse symbol.
field - the template field to which to assignvalue - the string value to assign
EclipseException - if the assertion has been released
EclipseException - if the field does not belong to the template being asserted
EclipseException - if the knowledge base has been cleared
EclipseException - if the knowledge base has been deleted
EclipseException - if the working memory has been deleted
public void assignAsDate(TemplateField field,
java.util.Date value)
throws EclipseException
assignAsTime(TemplateField,Date) if you want the date to be asserted as an Eclipse point in time rather than an Eclipse date.
Use assignAsObject(TemplateField,Object) if you want the date to be asserted as an object rather than an Eclipse date.
field - the template field to which to assignvalue - the date value to assign
EclipseException - if the assertion has been released
EclipseException - if the field does not belong to the template being asserted
EclipseException - if the knowledge base has been cleared
EclipseException - if the knowledge base has been deleted
EclipseException - if the working memory has been deleted
public void assignAsDate(TemplateField field,
int year,
int month,
int day)
throws EclipseException
field - the template field to which to assignyear - the four digit year e.g., 2001month - the month 1=January, ..., 12=Decemberday - the day of the month 1 through 31
EclipseException - if the assertion has been released
EclipseException - if the field does not belong to the template being asserted
EclipseException - if the knowledge base has been cleared
EclipseException - if the knowledge base has been deleted
EclipseException - if the working memory has been deleted
public void assignAsDate(TemplateField field,
java.lang.String dateString,
java.lang.String format)
throws EclipseException
field - the template field to which to assigndateString - the string representation of a dateformat - the format of the dateString
EclipseException - if the assertion has been released
EclipseException - if the field does not belong to the template being asserted
EclipseException - if the knowledge base has been cleared
EclipseException - if the knowledge base has been deleted
EclipseException - if the working memory has been deleted
public void assignAsTime(TemplateField field,
java.util.Date value)
throws EclipseException
field - the template field to which to assignvalue - the date value to assign
EclipseException - if the assertion has been released
EclipseException - if the field does not belong to the template being asserted
EclipseException - if the knowledge base has been cleared
EclipseException - if the knowledge base has been deleted
EclipseException - if the working memory has been deleted
public void assignAsTime(TemplateField field,
long seconds)
throws EclipseException
field - the template field in which to store the time value.seconds - the number of seconds (not milliseconds) since 00:00:00 Jan 1, 1970
EclipseException - if the assertion has been released
EclipseException - if the field does not belong to the template being asserted
EclipseException - if the knowledge base has been cleared
EclipseException - if the knowledge base has been deleted
EclipseException - if the working memory has been deleted
public void assignAsTime(TemplateField field,
java.lang.String timeString,
java.lang.String format)
throws EclipseException
field - the template field in which to store the time valuetimeString - the string representation of a timeformat - the format of the timeString
EclipseException - if the assertion has been released
EclipseException - if the field does not belong to the template being asserted
EclipseException - if the knowledge base has been cleared
EclipseException - if the knowledge base has been deleted
EclipseException - if the working memory has been deleted
public void assignAsObject(TemplateField field,
java.lang.Object object)
throws EclipseException
field - the template field to which to assign "l"object - the object value to assign
EclipseException - if the assertion has been released
EclipseException - if the field does not belong to the template being asserted
EclipseException - if the knowledge base has been cleared
EclipseException - if the knowledge base has been cleared
EclipseException - if the knowledge base has been deleted
EclipseException - if the working memory has been deleted
public void assignDefault(TemplateField field)
throws EclipseException
field -
EclipseException - if the assertion has been released
EclipseException - if the field does not belong to the template being asserted
EclipseException - if the knowledge base has been cleared
EclipseException - if the knowledge base has been cleared
EclipseException - if the knowledge base has been deleted
EclipseException - if the working memory has been deleted
|
||||||||||
| PREV CLASS NEXT CLASS | NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||