ilog.rules.vocabulary.model

Interface IlrVocabulary

  • All Superinterfaces:
    java.lang.Cloneable, IlrBaseElement, IlrNotifier, java.io.Serializable
    All Known Subinterfaces:
    IlrBOMVocabulary, IlrBOMVocabularySet, IlrVocabularySet


    public interface IlrVocabulary
    extends IlrBaseElement, java.lang.Cloneable
    IlrVocabulary defines a vocabulary.

    Overview

    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:

    • retrieve lists of vocabulary elements from the vocabulary
    • access a specific vocabulary element using an identifier
    • retrieve the label of verbalizable elements
    • manipulate the glossary of terms attached to a vocabulary

    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.
    See Also:
    IlrVocabularyController
    • Method Detail

      • getLocale

        java.util.Locale getLocale()
        Gets the locale of this vocabulary.
        Returns:
        The locale of this vocabulary.
      • getArtifacts

        java.util.List getArtifacts()
        Gets the list of all vocabulary elements contained in this vocabulary.
        Returns:
        The list of all vocabulary elements.
      • getConcepts

        java.util.List getConcepts()
        Gets the list of concepts contained in this vocabulary.
        Returns:
        The list of concepts.
      • getConcept

        IlrConcept getConcept(java.lang.String conceptIdentifier)
        Gets a concept by its identifier.
        Parameters:
        conceptIdentifier - The identifier of the concept.
        Returns:
        The concept found, or null.
      • getConceptInstances

        java.util.List getConceptInstances()
        Gets the list of concept instances contained in this vocabulary.
        Returns:
        The list of concept instances.
      • getConceptInstance

        IlrConceptInstance getConceptInstance(java.lang.String conceptInstanceIdentifier)
        Gets a concept instance by its identifier.
        Parameters:
        conceptInstanceIdentifier - The identifier of the concept instance.
        Returns:
        The concept instance found, or null.
      • getFactTypes

        java.util.List getFactTypes()
        Gets the list of fact types contained in this vocabulary.
        Returns:
        The list of fact types.
      • getFactType

        IlrFactType getFactType(java.lang.String factTypeIdentifier)
        Gets a fact type by its identifier.
        Parameters:
        factTypeIdentifier - The identifier of the fact type.
        Returns:
        The fact type found, or null.
      • getHeldFactTypes

        java.util.List getHeldFactTypes(IlrConcept concept)
        This method returns the fact types held by the given concept in this vocabulary
        Since:
        8.0
        Parameters:
        concept -
        Returns:
        a list of fact types held by this concept and an empty list if this concept does not hold any fact types.
      • addArtifact

        boolean addArtifact(IlrBusinessArtifact artifact)
        Adds an element into this vocabulary.
        Parameters:
        artifact - The element to add.
        Returns:
        true if the element has been successfully added.
      • removeArtifact

        void removeArtifact(IlrBusinessArtifact artifact)
        Removes an element from this vocabulary.
        Parameters:
        artifact - The element to remove.
      • setGlossary

        void setGlossary(IlrGlossary glossary)
        Sets a new glossary for this vocabulary.
        Parameters:
        glossary - The new glossary of this vocabulary.
      • getGlossary

        IlrGlossary getGlossary()
        Returns the glossary attached to this vocabulary.
        Returns:
        The glossary attached to this vocabulary, or null if no glossary has been attached.
      • hasParentConcept

        boolean hasParentConcept(IlrConcept concept,
                               IlrConcept parent)
        Tests if a concept has a specific parent concept.
        Parameters:
        concept - The concept to test.
        parent - The parent concept.
      • getParentConcepts

        java.util.List getParentConcepts(IlrConcept concept)
        Returns the list of parents of a concept.
        Parameters:
        concept - The concept.
        Returns:
        The list of parents of this concept.
      • getChildConcepts

        java.util.List getChildConcepts(IlrConcept concept)
        Returns the list of children of a concept.
        Parameters:
        concept - The concept.
        Returns:
        The list of children of this concept.
      • getConceptInstances

        java.util.List getConceptInstances(IlrConcept concept)
        Returns the list of instances of a concept.
        Parameters:
        concept - The concept.
        Returns:
        The list of instances of a concept.
      • getConceptInstance

        IlrConceptInstance getConceptInstance(IlrConcept concept,
                                            java.lang.String instanceName)
        Returns the instance of a concept, based on its name.
        Parameters:
        concept - The concept.
        instanceName - The name of the instance.
        Returns:
        The concept instance found, or null.
      • hasConceptInstances

        boolean hasConceptInstances(IlrConcept concept)
        Tests if a concept has concept instances.
        Parameters:
        concept - The concept.
        Returns:
        true if the concept has instances.
      • getConcept

        IlrConcept getConcept(IlrRole role)
        Returns the IlrConcept instance associated to a role. A role is the representation of a concept in a fact type.
        Parameters:
        role - The role.
        Returns:
        The concept found, or null.
      • getConcept

        IlrConcept getConcept(IlrConceptInstance instance)
        Returns the concept associated to a concept instance.
        Parameters:
        instance - The concept instance.
        Returns:
        The concept found, or null.
      • getLabel

        java.lang.String getLabel(IlrVerbalizable verbalizable)
        Gets the label of a verbalizable element. This method should never return null. For a role (IlrRole), if its label is null, then the label of the attached concept is returned.
        Parameters:
        verbalizable - The verbalizable element.
        Returns:
        The label corresponding to this verbalizable element.
      • getCategories

        java.util.Set getCategories(IlrBusinessArtifact artifact)
        Returns the categories associated to a vocabulary element.
        Parameters:
        artifact - The vocabulary element.
        Returns:
        A set of string categories, or an empty set if the element does not have any categories assigned to it.
      • isValueType

        boolean isValueType(IlrConcept concept)
        Returns true if a given concept is considered as a value type.
        Parameters:
        concept - The concept.
        Returns:
        true if the concept is a value type.
      • isDeprecated

        boolean isDeprecated(IlrConcept concept)
        Returns true if a given concept is deprecated.
        Parameters:
        concept - The concept.
        Returns:
        true if the concept is deprecated.
      • isDeprecated

        boolean isDeprecated(IlrSentence sentence)
        Returns true if a given sentence is deprecated. A sentence is a text template associated to a fact type.
        Parameters:
        sentence - The sentence.
        Returns:
        true if the specified sentence is deprecated.
      • clone

        java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Clones this vocabulary.
        Throws:
        java.lang.CloneNotSupportedException
        Returns:
        The clone vocabulary.

© Copyright IBM Corp. 1987, 2017