See: Description
| Interface | Description |
|---|---|
| IlrArticleBuilder |
Interface for article builders.
|
| IlrLabelBuilder |
Facade interface for creating the label (singular or plural) of a verbalizable element.
|
| IlrPluralBuilder |
Interface for plural label builders.
|
| IlrSingularBuilder |
This interface is implemented by verbalizer that are able to provide the singular given a
plural term.
|
| IlrTermBuilder |
This interface defines a term builder, used by an
IlrVerbalizer. |
| IlrVerbalizer |
Interface for verbalizers.
|
| Class | Description |
|---|---|
| IlrArticle |
Type-safe enumeration for article categories.
|
| IlrDefaultArticleBuilder |
This abstract class defines the default implementation of
IlrArticleBuilder. |
| IlrDefaultLabelBuilder |
Default implementation of
IlrLabelBuilder. |
| IlrDefaultTermBuilder |
This class defines the default behavior for a term builder, used by
IlrDefaultVerbalizer. |
| IlrDefaultVerbalizer |
Base implementation of
IlrVerbalizer. |
| IlrVerbalizationContext |
IlrVerbalizationContext provides a context while verbalizing a
vocabulary element. |
| IlrVerbalizerHelper |
This class provides many facilities for verbalizing vocabulary elements.
|
| IlrVerbalizerHelper.BasicVerbalizable |
This class provides a basic implementation of verbalizable whose label is given as argument of the constructor.
|
| Exception | Description |
|---|---|
| IlrVerbalizationException |
Exception for verbalization errors.
|
Verbalization is the process of associating terms and phrases to elements of the business object model. In terms of the API this means that a vocabulary element has a label and can be localized. The standard rule project verbalization is in English. In a rule project, each verbalization is stored as a series of key-value properties in a vocabulary (_<locale>.voc) file. There is one vocabulary file per locale, so a BOM entry can be associated with several vocabulary files.
The following is an extract from the vocabulary file for the loanvalidation-rules example project.
# loan.Borrower
loan.Borrower#concept.label = borrower
# loan.Borrower.Bankruptcy
loan.Borrower.Bankruptcy#concept.label = bankruptcy
loan.Borrower.Bankruptcy.chapter#phrase.navigation = {chapter} of {this}
loan.Borrower.Bankruptcy.date#phrase.navigation = {date} of {this}
loan.Borrower.Bankruptcy.reason#phrase.navigation = {reason} of {this}
Using the API you can either extend an existing verbalization, based on the Business
Action Language or create your own vocabulary. The most current scenario is to localize
an existing verbalization. For example, if you wished to create a spanish verbalization,
you will first make a copy of the existing vocabulary file and rename it
The following code example shows an example of how to to extend
IlrDefaultVerbalizer:
public class IlrSpanishVerbalizer extends IlrDefaultVerbalizer
{
public IlrSpanishVerbalizer() {
setLabelBuilder(makeLabelBuilder());
}
public String verbalize(IlrVerbalizable verbalizable, IlrVerbalizationContext context)
throws IlrVerbalizationException {
StringBuffer buff = new StringBuffer();
String label = context.isPlural() ? getLabelBuilder().getDisplayPluralLabel(
verbalizable, this, context) : getLabelBuilder().getDisplayLabel(verbalizable,
this, context);
String articleStr = getArticleBuilder().getArticle(context, verbalizable);
if (articleStr != null) {
buff.append(articleStr);
if (articleStr.length() != 0 && !articleStr.endsWith("'"))
if (buff.length() > 0 && buff.charAt(buff.length() - 1) != ' ')
buff.append(" ");
}
buff.append(label);
return buff.toString();
}
protected IlrArticleBuilder makeArticleBuilder() {
return new IlrSpanishArticleBuilder(this);
}
protected IlrPluralBuilder makePluralBuilder() {
return new IlrSpanishPluralBuilder();
}
protected IlrLabelBuilder makeLabelBuilder() {
return new IlrSpanishLabelBuilder();
}
protected IlrTermBuilder makeTermBuilder() {
return new IlrSpanishTermBuilder();
}
public IlrGender getDefaultGender() {
return IlrGender.MALE_LITERAL;
}
public IlrGender[] getSupportedGenders() {
return new IlrGender[] { IlrGender.MALE_LITERAL, IlrGender.FEMALE_LITERAL };
}
public String getGetterTemplate(IlrSentence sentence, List synRoles) {
...
}
public String getSetterTemplate(IlrSentence sentence, List synRoles) {
...
}
public String getPredicateGetterTemplate(IlrSentence sentence, List synRoles) {
...
}
public String getPredicateSetterTemplate(IlrSentence sentence, List synRoles)
{
...
}
public String getCollectionAddTemplate(IlrSentence sentence, List synRoles) {
...
}
public String getCollectionRemoveTemplate(IlrSentence sentence, List synRoles) {
...
}
}
For more information on how to extend IlrDefaultVerbalizer, see the sample,
Rule Studio Authoring Extensions in the ILOG JRules documentation.
© Copyright IBM Corp. 1987, 2017