public interface IlrVocabulary extends IlrBaseElement, java.lang.Cloneable
IlrVocabulary defines a vocabulary.
The vocabulary is the root artifact that contains all vocabulary elements, that is, concepts, fact types and concept instances. Some vocabulary elements can be verbalized, that is, they have a label and can be localized.
You use IlrVocabulary to:
Services around a vocabulary such as persistence and cache management, are
centralized in the IlrVocabularyController object returned by
calling getController().
Code example
The following code example shows how to use a IlrBOMVocabularyFactory
instance class to create a vocabulary from a BOM.
Locale vocabularyLocale = new Locale("en", "US");
IlrVocabularyGeneratorConfiguration config = new
IlrVocabularyGeneratorConfiguration(IlrVerbalizationGenerator.BUSINESS);
config.useLegacyAlternates(false);
// Generate minimal vocabulary, only classes and members used by space coverage
config.setModelFilter(new IlrGapReportModelFilter(report));
IlrVocabulary boot = IlrBOMVocabularyHelper.getBootVocabulary(vocabularyLocale);
IlrBOMVocabulary vocTmp = IlrBOMVocabularyHelper.loadBOMVocabulary(vocabularyLocale, "alltypes", this.getClass().getClassLoader(), "UTF-8");
IlrBOMVocabulary voc = IlrBOMVocabularyFactory.createBOMVocabularySet(
vocabularyLocale,
new IlrBOMVocabulary[] {
(IlrBOMVocabulary) boot,
(IlrBOMVocabulary) vocTmp
},
false);
// Return the verbalization provider
Map rulesetParametersEnglishVerbalization = new HashMap();
rulesetParametersEnglishVerbalization.put("loan", "the loan");
rulesetParametersEnglishVerbalization.put("borrower", "the borrower");
return new IlrDefaultRulesetVerbalizationProvider(voc, rulesetParametersEnglishVerbalization);
One of the most common uses of this API is to create a custom verbalizer. For more
information, see
ilog.rules.vocabulary.verbalization packages.
IlrVocabularyController| Modifier and Type | Method and Description |
|---|---|
boolean |
addArtifact(IlrBusinessArtifact artifact)
Adds an element into this vocabulary.
|
java.lang.Object |
clone()
Clones this vocabulary.
|
java.util.List |
getArtifacts()
Gets the list of all vocabulary elements contained in this vocabulary.
|
java.util.Set |
getCategories(IlrBusinessArtifact artifact)
Returns the categories associated to a vocabulary element.
|
java.util.List |
getChildConcepts(IlrConcept concept)
Returns the list of children of a concept.
|
IlrConcept |
getConcept(IlrConceptInstance instance)
Returns the concept associated to a concept instance.
|
IlrConcept |
getConcept(IlrRole role)
Returns the
IlrConcept instance associated to a role. |
IlrConcept |
getConcept(java.lang.String conceptIdentifier)
Gets a concept by its identifier.
|
IlrConceptInstance |
getConceptInstance(IlrConcept concept,
java.lang.String instanceName)
Returns the instance of a concept, based on its name.
|
IlrConceptInstance |
getConceptInstance(java.lang.String conceptInstanceIdentifier)
Gets a concept instance by its identifier.
|
java.util.List |
getConceptInstances()
Gets the list of concept instances contained in this vocabulary.
|
java.util.List |
getConceptInstances(IlrConcept concept)
Returns the list of instances of a concept.
|
java.util.List |
getConcepts()
Gets the list of concepts contained in this vocabulary.
|
IlrVocabularyController |
getController()
Returns the controller instance of this vocabulary.
|
IlrFactType |
getFactType(java.lang.String factTypeIdentifier)
Gets a fact type by its identifier.
|
java.util.List |
getFactTypes()
Gets the list of fact types contained in this vocabulary.
|
IlrGlossary |
getGlossary()
Returns the glossary attached to this vocabulary.
|
java.util.List |
getHeldFactTypes(IlrConcept concept)
This method returns the fact types held by the given concept in this vocabulary
|
java.lang.String |
getLabel(IlrVerbalizable verbalizable)
Gets the label of a verbalizable element.
|
java.util.Locale |
getLocale()
Gets the locale of this vocabulary.
|
java.util.List |
getParentConcepts(IlrConcept concept)
Returns the list of parents of a concept.
|
boolean |
hasConceptInstances(IlrConcept concept)
Tests if a concept has concept instances.
|
boolean |
hasParentConcept(IlrConcept concept,
IlrConcept parent)
Tests if a concept has a specific parent concept.
|
boolean |
isDeprecated(IlrConcept concept)
Returns
true if a given concept is deprecated. |
boolean |
isDeprecated(IlrSentence sentence)
Returns
true if a given sentence is deprecated. |
boolean |
isValueType(IlrConcept concept)
Returns
true if a given concept is considered as a value type. |
void |
removeArtifact(IlrBusinessArtifact artifact)
Removes an element from this vocabulary.
|
void |
setGlossary(IlrGlossary glossary)
Sets a new glossary for this vocabulary.
|
accept, clearInstanceProperties, clearProperties, clearVolatileProperties, delete, getProperties, getProperty, hasProperty, isDeleted, removeProperty, setProperties, setPropertyaddListener, getListeners, notify, removeListenerjava.util.Locale getLocale()
java.util.List getArtifacts()
java.util.List getConcepts()
IlrConcept getConcept(java.lang.String conceptIdentifier)
conceptIdentifier - The identifier of the concept.null.java.util.List getConceptInstances()
IlrConceptInstance getConceptInstance(java.lang.String conceptInstanceIdentifier)
conceptInstanceIdentifier - The identifier of the concept instance.null.java.util.List getFactTypes()
IlrFactType getFactType(java.lang.String factTypeIdentifier)
factTypeIdentifier - The identifier of the fact type.null.java.util.List getHeldFactTypes(IlrConcept concept)
concept - boolean addArtifact(IlrBusinessArtifact artifact)
artifact - The element to add.true if the element has been successfully added.void removeArtifact(IlrBusinessArtifact artifact)
artifact - The element to remove.IlrVocabularyController getController()
IlrVocabularyControllervoid setGlossary(IlrGlossary glossary)
glossary - The new glossary of this vocabulary.IlrGlossary getGlossary()
null if no glossary has been attached.boolean hasParentConcept(IlrConcept concept, IlrConcept parent)
concept - The concept to test.parent - The parent concept.java.util.List getParentConcepts(IlrConcept concept)
concept - The concept.java.util.List getChildConcepts(IlrConcept concept)
concept - The concept.java.util.List getConceptInstances(IlrConcept concept)
concept - The concept.IlrConceptInstance getConceptInstance(IlrConcept concept, java.lang.String instanceName)
concept - The concept.instanceName - The name of the instance.null.boolean hasConceptInstances(IlrConcept concept)
concept - The concept.true if the concept has instances.IlrConcept getConcept(IlrRole role)
IlrConcept instance associated to a role. A role is the representation of a concept in a fact type.role - The role.null.IlrConcept getConcept(IlrConceptInstance instance)
instance - The concept instance.null.java.lang.String getLabel(IlrVerbalizable verbalizable)
null. For a role (IlrRole),
if its label is null, then the label of the attached concept is returned.verbalizable - The verbalizable element.java.util.Set getCategories(IlrBusinessArtifact artifact)
artifact - The vocabulary element.boolean isValueType(IlrConcept concept)
true if a given concept is considered as a value type.concept - The concept.true if the concept is a value type.boolean isDeprecated(IlrConcept concept)
true if a given concept is deprecated.concept - The concept.true if the concept is deprecated.boolean isDeprecated(IlrSentence sentence)
true if a given sentence is deprecated. A sentence is a text template associated to a fact type.sentence - The sentence.true if the specified sentence is deprecated.java.lang.Object clone()
throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException© Copyright IBM Corp. 1987, 2017