Package ptolemy.data.ontologies
Class ConceptGraph
- java.lang.Object
-
- ptolemy.data.ontologies.ConceptGraph
-
- 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ptolemy.graph.CPO
CPO.BoundType
-
-
Field Summary
-
Fields inherited from interface ptolemy.graph.CPO
HIGHER, INCOMPARABLE, LOWER, SAME
-
-
Constructor Summary
Constructors Constructor Description ConceptGraph()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Concept
bottom()
Return the least element of this concept graph.abstract int
compare(java.lang.Object e1, java.lang.Object e2)
Compare two concepts in the ontology.Concept[]
downSet(java.lang.Object e)
Compute the down-set of an element in this concept graph.Concept
greatestElement(java.util.Set<Concept> subset)
Compute the greatest element of a subset.Concept
greatestLowerBound(java.lang.Object e1, java.lang.Object e2)
Compute the greatest lower bound (GLB) of two elements.Concept
greatestLowerBound(java.util.Set<Concept> subset)
Compute the greatest lower bound (GLB) of a subset.boolean
isLattice()
Return whether this concept graph is a lattice.Concept
leastElement(java.util.Set<Concept> subset)
Compute the least element of a subset.abstract Concept
leastUpperBound(java.lang.Object e1, java.lang.Object e2)
Compute the least upper bound (LUB) of two elements.Concept
leastUpperBound(java.util.Set<Concept> subset)
Compute the least upper bound (LUB) of a subset.abstract NonLatticeCounterExample
nonLatticeReason()
Return a human readable string as to why this graph is not a lattice.abstract Concept
top()
Return the greatest element in this concept graph.Concept[]
upSet(java.lang.Object e)
Compute the up-set of an element in this concept graph.
-
-
-
Method Detail
-
bottom
public abstract Concept bottom()
Return the least element of this concept 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 ofConcept
, 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.
-
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.
-
greatestElement
public Concept greatestElement(java.util.Set<Concept> subset)
Compute the greatest element of a subset.- Specified by:
greatestElement
in interfaceCPO<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 interfaceCPO<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 interfaceCPO<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.
-
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 interfaceCPO<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 interfaceCPO<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 interfaceCPO<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.
-
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.
-
-