Package ptolemy.data.ontologies
Class Ontology
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity
-
- ptolemy.kernel.CompositeEntity
-
- ptolemy.data.ontologies.Ontology
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
- Direct Known Subclasses:
ProductLatticeOntology
public class Ontology extends CompositeEntity
A specification of an ontology, which is a set of concepts and a partial ordering relation. The structure is represented by interconnections between concepts contained by this ontology.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Edward A. Lee, Ben Lickly, Dai Bui, Christopher Brooks
- See Also:
ConceptGraph
,Concept
- Pt.AcceptedRating:
- Red (blickly)
- Pt.ProposedRating:
- Red (blickly)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.CompositeEntity
CompositeEntity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected ConceptGraph
_graph
The cached graph.protected long
_graphVersion
The workspace version at which the cached graph was valid.-
Fields inherited from class ptolemy.kernel.CompositeEntity
_levelCrossingLinks
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
-
Constructor Summary
Constructors Constructor Description Ontology(CompositeEntity container, java.lang.String name)
Create a new Ontology with the specified container and the specified name.Ontology(Workspace workspace)
Create a new Ontology with no container or name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ConceptGraph
_buildConceptGraph()
Return the graph represented by this ontology.Concept
getConceptByString(java.lang.String conceptString)
Return the concept in the ontology represented by the given string, or null if no such concept exists.ConceptGraph
getConceptGraph()
Return the graph represented by this ontology.java.util.Set<FiniteConcept>
getUnacceptableConcepts()
Return a set of finite concepts which are unacceptable solutions in all situations.boolean
isLattice()
Return true if the ontology graph is a lattice, false otherwise.ComponentRelation
newRelation(java.lang.String name)
Create a new relation with the specified name, add it to the relation list, and return it.-
Methods inherited from class ptolemy.kernel.CompositeEntity
_addEntity, _addRelation, _adjustDeferrals, _containedDecorators, _deepOpaqueEntityList, _description, _exportMoMLContents, _finishedAddEntity, _removeEntity, _removeRelation, _validateSettables, allAtomicEntityList, allowLevelCrossingConnect, classDefinitionList, clone, connect, connect, containedObjectsIterator, deepCompositeEntityList, deepEntityList, deepGetEntities, deepNamedObjList, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, isOpaque, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyAllCompositeTransparentAndOpaqueEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, setContainer, statistics, uniqueName
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, newPort, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
_addPort, _removePort, connectedPortList, connectedPorts, connectionsChanged, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getDisplayName, getFullName, getName, getName
-
-
-
-
Field Detail
-
_graph
protected ConceptGraph _graph
The cached graph.
-
_graphVersion
protected long _graphVersion
The workspace version at which the cached graph was valid.
-
-
Constructor Detail
-
Ontology
public Ontology(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
Create a new Ontology with the specified container and the specified name.- Parameters:
container
- The container.name
- The name for the ontology.- Throws:
NameDuplicationException
- If the container already contains an ontology with the specified name.IllegalActionException
- If the base class throws it.
-
Ontology
public Ontology(Workspace workspace) throws IllegalActionException
Create a new Ontology with no container or name.- Parameters:
workspace
- The workspace into which to put it.- Throws:
IllegalActionException
- If the base class throws it.
-
-
Method Detail
-
getConceptByString
public Concept getConceptByString(java.lang.String conceptString) throws IllegalActionException
Return the concept in the ontology represented by the given string, or null if no such concept exists.- Parameters:
conceptString
- The string of the concept to look for, which would be what is returned by the concept's toString() method. This is not necessarily the PtolemyNamedObj
name of the concept. For example,InfiniteConcepts
have automatically generated unique names that are not the same as what is returned by their toString() method.- Returns:
- The concept that is represented by the given string, or null if no such concept exists.
- Throws:
IllegalActionException
- Thrown if there is an error getting the concept.
-
getConceptGraph
public ConceptGraph getConceptGraph()
Return the graph represented by this ontology. Graph is weighted by Concepts on the nodes and ConceptRelations on the edges. Currently we only have ontologies that are lattices, but in general, an ontology can represent more general relationships that might have a graph structure that is not a lattice. So we provide the getGraph() method in the base class for any future ontology subclasses that are not lattices.- Returns:
- The concept graph.
-
getUnacceptableConcepts
public java.util.Set<FiniteConcept> getUnacceptableConcepts()
Return a set of finite concepts which are unacceptable solutions in all situations. Here these concepts are undesirable for any user of this ontology, for example, "Top" may indicate a conflict for all models using this ontology. Ontologies may not contain duplicate concepts, so the collection of unacceptable finite concepts is always a set.- Returns:
- The set of unacceptable finite concepts in this ontology.
-
isLattice
public boolean isLattice()
Return true if the ontology graph is a lattice, false otherwise.- Returns:
- True if the graph is a lattice, false otherwise.
-
newRelation
public ComponentRelation newRelation(java.lang.String name) throws IllegalActionException, NameDuplicationException
Create a new relation with the specified name, add it to the relation list, and return it. This method is write-synchronized on the workspace and increments its version number. This overridesCompositeEntity.newRelation(java.lang.String)
of CompositeEntity.- Overrides:
newRelation
in classCompositeEntity
- Parameters:
name
- The name of the new relation.- Returns:
- The new relation.
- Throws:
IllegalActionException
- If name argument is null.NameDuplicationException
- If name collides with a name already in the container.
-
_buildConceptGraph
protected ConceptGraph _buildConceptGraph()
Return the graph represented by this ontology. Graph is weighted by FiniteConcepts on the nodes and ConceptRelations on the edges.- Returns:
- The concept graph.
-
-