Package ptolemy.data.ontologies
Class OntologySolver
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.moml.MoMLModelAttribute
-
- ptolemy.data.ontologies.OntologySolverBase
-
- ptolemy.data.ontologies.OntologySolver
-
- All Implemented Interfaces:
java.lang.Cloneable
,Testable
,Changeable
,Configurable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
- Direct Known Subclasses:
LatticeOntologySolver
public abstract class OntologySolver extends OntologySolverBase implements Testable
An extended base abstract class for an ontology solver.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Man-Kit Leung
- Pt.AcceptedRating:
- Red (mankit)
- Pt.ProposedRating:
- Red (mankit)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
_eol
The system-specific end-of-line character.protected OntologyMoMLHandler
_momlHandler
The handler that issues MoML requests and makes model changes.-
Fields inherited from class ptolemy.data.ontologies.OntologySolverBase
_adapterStore, _nonSettables, _ontologySolverUtilities, _resolvedProperties, ontologySolverUtilitiesWrapper
-
Fields inherited from class ptolemy.moml.MoMLModelAttribute
_model, modelURL
-
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 OntologySolver(NamedObj container, java.lang.String name)
Construct an OntologySolver with the specified container and name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkErrors()
Check whether there are any regression testing errors after resolving properties.void
checkResolutionErrors()
Check whether there are any OntologySolver resolution errors after resolving properties.java.lang.Object
clone(Workspace workspace)
Clone the object into the specified workspace.void
configure(java.net.URL base, java.lang.String source, java.lang.String text)
Construct and configure the contained model with the specified source and text.void
displayConcepts()
If the value of the highlight parameter is set to true, highlight the given property-able object with the specified color associated with the given property, if there exists any.OntologyMoMLHandler
getMoMLHandler()
Return the PropertyMoMLHandler for this OntologySolver.void
invokeSolver()
Invoke the solver directly, and display any concepts resolved by this solver.void
invokeSolver(boolean displayProperties)
Invoke the solver directly, with a choice as to whether or not this solver should display its resolved concepts.boolean
isSettable(java.lang.Object object)
Return true if the specified property-able object is settable; otherwise false which means that its concept has been set by OntologyAdapter.setEquals().void
reset()
Reset the solver.-
Methods inherited from class ptolemy.data.ontologies.OntologySolverBase
_getAdapter, _getPackageName, _toplevel, cleanConstants, clearResolvedConcept, getAdapter, getAllAdapters, getAllConceptableNamedObjs, getAllContainedOntologies, getAllPropertyables, getAllSolvers, getAttribute, getConcept, getOntology, getOntologySolverUtilities, getParser, getParseTree, initialize, markAsNonSettable, resetAll, resolveConcepts, setConcept, setOntologySolverUtilities
-
Methods inherited from class ptolemy.moml.MoMLModelAttribute
_exportMoMLContents, attributeChanged, getConfigureSource, getConfigureText, getContainedModel
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
-
-
-
-
Field Detail
-
_momlHandler
protected OntologyMoMLHandler _momlHandler
The handler that issues MoML requests and makes model changes.
-
_eol
protected static final java.lang.String _eol
The system-specific end-of-line character.
-
-
Constructor Detail
-
OntologySolver
public OntologySolver(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct an OntologySolver with the specified container and name. If this is the first OntologySolver created in the model, the shared utility object will also be created.- Parameters:
container
- The specified container.name
- The specified name.- Throws:
IllegalActionException
- If the PropertySolver is not of an acceptable attribute for the container.NameDuplicationException
- If the name coincides with an attribute already in the container.
-
-
Method Detail
-
checkErrors
public void checkErrors() throws OntologyResolutionException
Check whether there are any regression testing errors after resolving properties. If so, throw a new PropertyResolutionException with an error message that includes all the properties that does not match the regression test values.- Throws:
OntologyResolutionException
- Thrown if there are any errors from running the OntologySolver in the regression test.
-
checkResolutionErrors
public void checkResolutionErrors() throws IllegalActionException
Check whether there are any OntologySolver resolution errors after resolving properties. If so, throw an IllegalActionException.- Throws:
IllegalActionException
- If an exception is thrown by calling checkErrors()
-
clone
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
Clone the object into the specified workspace.- Overrides:
clone
in classOntologySolverBase
- Parameters:
workspace
- The workspace for the new object.- Returns:
- A new NamedObj.
- Throws:
java.lang.CloneNotSupportedException
- If any of the attributes cannot be cloned.- See Also:
NamedObj.exportMoML(Writer, int, String)
,NamedObj.setDeferringChangeRequests(boolean)
-
configure
public void configure(java.net.URL base, java.lang.String source, java.lang.String text) throws java.lang.Exception
Construct and configure the contained model with the specified source and text. This parses the specified MoML text. Also set the container solver for the contained model to be the ontology solver.- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classMoMLModelAttribute
- Parameters:
base
- The base URL for relative references, or null if not known.source
- The URI of a document providing source, which is ignored in this class.text
- The MoML description.- Throws:
java.lang.Exception
- If the parsing fails.
-
displayConcepts
public void displayConcepts() throws IllegalActionException
If the value of the highlight parameter is set to true, highlight the given property-able object with the specified color associated with the given property, if there exists any. If the value of the showText parameter is true, show the given property value for the given property-able object. If the property is not null, this looks for the _showInfo parameter in the property-able object. Create a new _showInfo StringParameter if one does not already exist. Set its value to the given property value. If the given property is null, this removes the _showInfo parameter from the property-able object.- Throws:
IllegalActionException
- Thrown if an error occurs when creating or setting the value for the _showInfo parameter in the property-able object. Thrown if an error occurs when creating or setting the value for the highlightColor attribute in the property-able object.
-
getMoMLHandler
public OntologyMoMLHandler getMoMLHandler()
Return the PropertyMoMLHandler for this OntologySolver.- Returns:
- The PropertyMoMLHandler for the OntologySolver
-
invokeSolver
public void invokeSolver() throws IllegalActionException
Invoke the solver directly, and display any concepts resolved by this solver.- Throws:
IllegalActionException
- If there is no ontology.
-
invokeSolver
public void invokeSolver(boolean displayProperties) throws IllegalActionException
Invoke the solver directly, with a choice as to whether or not this solver should display its resolved concepts.- Parameters:
displayProperties
- True if the solver should display its properties; false otherwise (for example, if it is called from another solver)- Throws:
IllegalActionException
- If there is no ontology.
-
isSettable
public boolean isSettable(java.lang.Object object)
Return true if the specified property-able object is settable; otherwise false which means that its concept has been set by OntologyAdapter.setEquals().- Parameters:
object
- The specified property-able object.- Returns:
- True if the specified property-able object is settable, otherwise false.
-
reset
public void reset()
Reset the solver. This removes the internal states of the solver (e.g. previously recorded properties, statistics, etc.). It also removes this solver from the list of ran solvers.- Overrides:
reset
in classOntologySolverBase
-
-