Class ModelKnowledge<T,​TI extends TypeInformation<T>>


  • public class ModelKnowledge<T,​TI extends TypeInformation<T>>
    extends Object
    Author:
    Luca Frosini (ISTI - CNR)
    • Constructor Detail

      • ModelKnowledge

        public ModelKnowledge​(TI typeInformation)
        Creates a new instance.
        Parameters:
        typeInformation - The type information.
    • Method Detail

      • reset

        protected void reset()
        Resets the knowledge base.
      • addUsage

        protected void addUsage​(LinkedEntity linkedEntity,
                                UsageKnowledge<LinkedEntity> relationUsage,
                                UsageKnowledge<LinkedEntity> targetEntityUsage)
        Adds a usage of a linked entity.
        Parameters:
        linkedEntity - The linked entity.
        relationUsage - The relation usage.
        targetEntityUsage - The target entity usage.
      • addPropertyUsage

        protected void addPropertyUsage​(T t,
                                        Set<PropertyDefinition> properties)
        Adds the property usage for a type.
        Parameters:
        t - The type.
        properties - The properties.
      • addEntityMetadataUsage

        protected void addEntityMetadataUsage​(T t)
        Adds the entity metadata usage for a type.
        Parameters:
        t - The type.
      • addRelationMetadataUsage

        protected void addRelationMetadataUsage​(T t)
        Adds the relation metadata usage for a type.
        Parameters:
        t - The type.
      • addPropagationConstraintUsage

        protected void addPropagationConstraintUsage​(T t)
        Adds the propagation constraint usage for a type.
        Parameters:
        t - The type.
      • addAllType

        public void addAllType​(Collection<T> types)
        Adds all types to the knowledge base.
        Parameters:
        types - The types to add.
      • addType

        public void addType​(T t)
        Adds a type to the knowledge base.
        Parameters:
        t - The type to add.
      • getTree

        public Tree<T> getTree​(AccessType accessType)
        Returns the tree for the given access type.
        Parameters:
        accessType - The access type.
        Returns:
        The tree.
      • getModelTypesUsage

        public UsageKnowledge<?> getModelTypesUsage​(AccessType accessType)
        Returns the usage knowledge for the given model type.
        Parameters:
        accessType - The access type.
        Returns:
        The usage knowledge.
      • getERTypesUsage

        public UsageKnowledge<LinkedEntity> getERTypesUsage​(AccessType accessType)
        Returns the usage knowledge for the given entity/relation type.
        Parameters:
        accessType - The access type.
        Returns:
        The usage knowledge.
      • getResourceUsage

        public UsageKnowledge<LinkedEntity> getResourceUsage()
        Returns the resource usage.
        Returns:
        The resource usage.
      • getIsRelatedToUsage

        public UsageKnowledge<LinkedEntity> getIsRelatedToUsage()
        Returns the "is related to" usage.
        Returns:
        The "is related to" usage.
      • getConsistsOfUsage

        public UsageKnowledge<LinkedEntity> getConsistsOfUsage()
        Returns the "consists of" usage.
        Returns:
        The "consists of" usage.
      • getTypeByName

        public T getTypeByName​(String typeName)
                        throws RuntimeException
        Return the type if it is contained in the Knowledge
        Parameters:
        typeName - the type we are looking for
        Returns:
        the Type
        Throws:
        RuntimeException - if the type is not found.
      • getNodeByName

        public Node<T> getNodeByName​(String typeName)
                              throws RuntimeException
        Return the node for the type if it is contained in the Knowledge
        Parameters:
        typeName - the type we are looking for
        Returns:
        the Type
        Throws:
        RuntimeException - if the type is not found.