Class AbsHelper


  • public class AbsHelper
    extends Object
    Author:
    Federico Bergenti - Universita` di Parma, Giovanni Caire - TILAB
    • Constructor Detail

      • AbsHelper

        public AbsHelper()
    • Method Detail

      • externaliseAID

        public static AbsConcept externaliseAID​(AID obj)
        Converts an AID into an AbsConcept representing an AID
        Parameters:
        obj - the AID
        Returns:
        the abstract descriptor.
      • nullifyVariables

        public static AbsObject nullifyVariables​(AbsObject abs,
                                                 boolean removeEmptyAggregate)
        Remove all variables and empty aggregates (only if specified)
        Parameters:
        abs - to nullify
        removeEmptyAggregate - if true remove all empty aggregates
        Returns:
        abs without variables and empty aggregates
      • removePrefix

        public static AbsObject removePrefix​(AbsObject abs,
                                             String separator)
                                      throws OntologyException
        Recursively removes prefix (if present) from abs-type-name, except for BasicOntology types Prefix is identified from last separator string Eg. A.B.C -> C (if separator is .)
        Parameters:
        abs - abs to un-prefix
        separator - separator string
        Returns:
        un-prefixde abs
        Throws:
        OntologyException
      • addPrefix

        public static AbsObject addPrefix​(AbsObject abs,
                                          String prefix)
                                   throws OntologyException
        Recursively add prefix to abs-type-name, except for BasicOntology types Eg. C -> A.B.C (if prefix is A.B.)
        Parameters:
        abs - abs to prefix
        prefix - prefix to add
        Returns:
        prefix abs
        Throws:
        OntologyException
      • isAbsTemplate

        public static boolean isAbsTemplate​(AbsObject abs)
        Return true if the abs-object is a template. A template is an abs with all slots AbsVariable or AbsAggregate empty
        Parameters:
        abs - abs-object to check
        Returns:
        true if is a template
      • applyDefaultValues

        public static AbsObject applyDefaultValues​(AbsObject absTemplate,
                                                   AbsObject absDefault)
                                            throws OntologyException
        Apply default value to template Replace node with default value only if the value in template is null or AbsVariable or default value is null and template is a true template
        Parameters:
        absTemplate - abs template value
        absDefault - abs value with default value
        Returns:
        Throws:
        OntologyException