Class UsageKnowledge


  • public class UsageKnowledge
    extends Object
    A class that stores and manages knowledge about the usage of linked entities within the model.

    It maintains a map where keys are type names (source, relation, or target) and values are sets of LinkedEntity objects that use that type.

    Author:
    Luca Frosini (ISTI - CNR)
    • Field Detail

      • map

        protected Map<String,​Set<LinkedEntity>> map
        A map from type names to the set of linked entities that use them.
    • Constructor Detail

      • UsageKnowledge

        public UsageKnowledge()
        Default constructor. Initializes the usage map.
    • Method Detail

      • add

        protected void add​(String typeName,
                           LinkedEntity linkedEntity)
        Adds a linked entity to the usage map for a specific type name.
        Parameters:
        typeName - The type name (source, relation, or target).
        linkedEntity - The linked entity to add.
      • add

        public void add​(LinkedEntity linkedEntity)
        Adds a linked entity to the knowledge base, indexing it by its source, relation, and target types.
        Parameters:
        linkedEntity - The linked entity to add.
      • addAll

        public void addAll​(Collection<LinkedEntity> linkedEntities)
        Adds a collection of linked entities to the knowledge base.
        Parameters:
        linkedEntities - The collection of linked entities to add.
      • getUsage

        public Set<LinkedEntity> getUsage​(String typeName)
        Returns the set of linked entities that use a specific type.
        Parameters:
        typeName - The name of the type.
        Returns:
        A set of LinkedEntity objects, or null if the type is not found.