Class ConceptGraph

  • All Implemented Interfaces:
    CPO<Concept>
    Direct Known Subclasses:
    DAGConceptGraph, ProductLatticeCPO

    public abstract class ConceptGraph
    extends java.lang.Object
    implements CPO<Concept>
    An abstract class that defines the ordering relationships in an ontology. An ontology is a set of concepts and the relationships between them. In a general ontology the graph describing the relationships between concepts need not be a complete partial order (CPO). But we restrict our implementation to a CPO because we currently deal only with ontologies that can be partially ordered. This is particularly important for an ontology whose graph is a lattice, where we can use the Rehof and Mogensen algorithm to do a scalable analysis and inference on a model to assign concepts from the ontology to each element in the model. This specialization is implemented as a LatticeOntologySolver, a subclass of OntologySolver.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Thomas Mandl, Man-Kit Leung, Edward A. Lee, Ben Lickly, Dai Bui, Christopher Brooks
    See Also:
    Ontology, CPO
    Pt.AcceptedRating:
    Red (mankit)
    Pt.ProposedRating:
    Red (mankit)
    • Constructor Detail

      • ConceptGraph

        public ConceptGraph()
    • Method Detail

      • bottom

        public abstract Concept bottom()
        Return the least element of this concept graph.
        Specified by:
        bottom in interface CPO<Concept>
        Returns:
        The least element of this graph.
      • compare

        public abstract int compare​(java.lang.Object e1,
                                    java.lang.Object e2)
        Compare two concepts in the ontology. The arguments must be instances of Concept, otherwise an exception will be thrown. This method returns one of ptolemy.graph.CPO.LOWER, ptolemy.graph.CPO.SAME, ptolemy.graph.CPO.HIGHER, ptolemy.graph.CPO.INCOMPARABLE, indicating the first argument is lower than, equal to, higher than, or incomparable with the second argument in the property hierarchy, respectively.
        Specified by:
        compare in interface CPO<Concept>
        Parameters:
        e1 - An instance of Concept.
        e2 - An instance of Concept.
        Returns:
        One of CPO.LOWER, CPO.SAME, CPO.HIGHER, CPO.INCOMPARABLE.
        Throws:
        java.lang.IllegalArgumentException - If one or both arguments are not instances of Concept.
      • downSet

        public Concept[] downSet​(java.lang.Object e)
        Compute the down-set of an element in this concept graph. Not implemented in this base class.
        Specified by:
        downSet in interface CPO<Concept>
        Parameters:
        e - An Object representing a concept in this concept graph.
        Returns:
        An array of Concepts of the down-set of the specified element.
        Throws:
        java.lang.IllegalArgumentException - Always thrown in this base class.
      • greatestElement

        public Concept greatestElement​(java.util.Set<Concept> subset)
        Compute the greatest element of a subset.
        Specified by:
        greatestElement in interface CPO<Concept>
        Parameters:
        subset - A set of Objects representing the subset.
        Returns:
        An Object representing the greatest element of the subset, or null if the greatest element does not exist.
        Throws:
        java.lang.IllegalArgumentException - If at least one Object in the specified array is not an element of this concept graph.
        See Also:
        leastElement(Set)
      • greatestLowerBound

        public Concept greatestLowerBound​(java.lang.Object e1,
                                          java.lang.Object e2)
        Compute the greatest lower bound (GLB) of two elements. Not implemented in this base class.
        Specified by:
        greatestLowerBound in interface CPO<Concept>
        Parameters:
        e1 - An Object representing an element in this concept graph.
        e2 - An Object representing an element in this concept graph.
        Returns:
        An Object representing the GLB of the two specified elements, or null if the GLB does not exist.
        Throws:
        java.lang.IllegalArgumentException - Always thrown in this base class.
      • greatestLowerBound

        public Concept greatestLowerBound​(java.util.Set<Concept> subset)
        Compute the greatest lower bound (GLB) of a subset.
        Specified by:
        greatestLowerBound in interface CPO<Concept>
        Parameters:
        subset - A set of Objects representing the subset.
        Returns:
        Nothing.
        Throws:
        java.lang.IllegalArgumentException - If at least one Object is not an element of this concept graph, or greatestLowerBound is not implemented.
        See Also:
        leastUpperBound(Set)
      • isLattice

        public boolean isLattice()
        Return whether this concept graph is a lattice. Should be true for all existing concept graphs. Not implemented in this base class.
        Specified by:
        isLattice in interface CPO<Concept>
        Returns:
        True, if the concept graph is a lattice.
        Throws:
        java.lang.IllegalArgumentException - Always thrown in this base class.
      • leastElement

        public Concept leastElement​(java.util.Set<Concept> subset)
        Compute the least element of a subset. The least element of a subset is an element in the subset that is lower than all the other elements in the subset.
        Specified by:
        leastElement in interface CPO<Concept>
        Parameters:
        subset - A set of Objects representing the subset.
        Returns:
        The least element of the subset, if it exists, and null if there is no least element of the given subset.
        Throws:
        java.lang.IllegalArgumentException - If at least one Object in the specified array is not an element of this concept graph.
        See Also:
        greatestElement(Set)
      • leastUpperBound

        public abstract Concept leastUpperBound​(java.lang.Object e1,
                                                java.lang.Object e2)
        Compute the least upper bound (LUB) of two elements. The LUB of two elements is the least element in the concept graph that is greater than or equal to both of the two elements. Not implemented in this base class.
        Specified by:
        leastUpperBound in interface CPO<Concept>
        Parameters:
        e1 - An Object representing a concept in this concept graph.
        e2 - An Object representing a concept in this concept graph.
        Returns:
        A Concept representing the LUB of the two specified elements, or null if the LUB does not exist.
        Throws:
        java.lang.IllegalArgumentException - If at least one of the specified Objects is not an element of this concept graph.
      • leastUpperBound

        public Concept leastUpperBound​(java.util.Set<Concept> subset)
        Compute the least upper bound (LUB) of a subset. The LUB of a subset is the least element in the concept graph that is greater than or equal to all the elements in the subset.
        Specified by:
        leastUpperBound in interface CPO<Concept>
        Parameters:
        subset - An set of Objects representing the subset.
        Returns:
        The least upper bound of the given subset, if it exists, and null if it does not.
        Throws:
        java.lang.IllegalArgumentException - If at least one Object in the specified array is not an element of this concept graph.
        See Also:
        greatestLowerBound(Set)
      • nonLatticeReason

        public abstract NonLatticeCounterExample nonLatticeReason()
        Return a human readable string as to why this graph is not a lattice. If it is a lattice, return null.
        Returns:
        The reason why this graph is not a lattice, or null, if it is.
      • top

        public abstract Concept top()
        Return the greatest element in this concept graph.
        Specified by:
        top in interface CPO<Concept>
        Returns:
        The greatest element in this concept graph.
      • upSet

        public Concept[] upSet​(java.lang.Object e)
        Compute the up-set of an element in this concept graph. The up-set of an element is the subset consisting of all the elements greater than or equal to the specified element.
        Specified by:
        upSet in interface CPO<Concept>
        Parameters:
        e - An Object representing an element in this concept graph.
        Returns:
        An array of Concepts of the up-set of the specified element.
        Throws:
        java.lang.IllegalArgumentException - Always thrown in this base class.