public class LatticeOntologySolver extends OntologySolver
This class is based on the PropertyConstraintSolver in the properties package by Man-Kit Leung.
Red (mankit) |
Red (mankit) |
Modifier and Type | Class and Description |
---|---|
static class |
LatticeOntologySolver.ConstraintType
An enumeration type to represent the types of constraints for
default constraint settings for actor inputs and outputs, connections
and finite state machine transitions.
|
NamedObj.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected java.util.List<Inequality> |
_initialConstraintList
The list of constraints collected from the model, before resolution.
|
protected java.util.List<Inequality> |
_resolvedConstraintList
The list of constraints after the ontology resolution algorithm has executed.
|
protected java.util.List<InequalityTerm> |
_resolvedUnacceptableList
The list of InequalityTerms that have resolved to an unacceptable concept value.
|
static java.lang.String |
ADD_FUNCTION_NAME
The string name of the attribute that defines the arithmetic add
concept function for this ontology solver.
|
static java.lang.String |
AND_FUNCTION_NAME
The string name of the attribute that defines the logical and
concept function for this ontology solver.
|
static java.lang.String |
DIVIDE_FUNCTION_NAME
The string name of the attribute that defines the arithmetic divide
concept function for this ontology solver.
|
static java.lang.String |
MULTIPLY_FUNCTION_NAME
The string name of the attribute that defines the arithmetic multiply
concept function for this ontology solver.
|
static java.lang.String |
NEGATE_FUNCTION_NAME
The string name of the attribute that defines the arithmetic negation
concept function for this ontology solver.
|
static java.lang.String |
NOT_FUNCTION_NAME
The string name of the attribute that defines the logical not
concept function for this ontology solver.
|
static java.lang.String |
OR_FUNCTION_NAME
The string name of the attribute that defines the logical or
concept function for this ontology solver.
|
static java.lang.String |
RECIPROCAL_FUNCTION_NAME
The string name of the attribute that defines the arithmetic negation
concept function for this ontology solver.
|
StringParameter |
solverStrategy
A single parameter for quickly selecting common solving strategies,
plus a "custom" option to allow a user-defined strategy.
|
StringParameter |
solvingFixedPoint
Indicate whether to compute the least or greatest fixed point solution.
|
static java.lang.String |
SUBTRACT_FUNCTION_NAME
The string name of the attribute that defines the arithmetic subtract
concept function for this ontology solver.
|
_eol, _momlHandler
_adapterStore, _nonSettables, _ontologySolverUtilities, _resolvedProperties, ontologySolverUtilitiesWrapper
_model, modelURL
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
Constructor and Description |
---|
LatticeOntologySolver(NamedObj container,
java.lang.String name)
Constructor for the OntologySolver.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_clearLists()
Set the resolved constraint list and the list of unacceptable
inequality terms to null.
|
protected OntologyAdapter |
_getAdapter(java.lang.Object component)
Return the LatticeOntologyAdapter for the specified
component.
|
protected ConceptTermManager |
_getConceptTermManager()
Return a new concept term manager.
|
protected LatticeOntologySolver.ConstraintType |
_getConstraintType()
Return the constraint type based on the solver strategy and the
type of the fixed point.
|
protected void |
_resolveConcepts(NamedObj toplevel,
java.util.List<Inequality> constraintList)
Resolve the concepts for the given top-level container,
subject to the given constraint list.
|
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace.
|
LatticeOntologyASTNodeAdapter |
getAdapter(ASTPtRootNode node)
Returns the adapter that contains concept information for the given AST
node.
|
OntologyAdapter |
getAdapter(NamedObj component)
Returns the adapter that contains concept information for the given
component.
|
OntologyAdapter |
getAdapter(java.lang.Object object)
Return the concept constraint adapter associated with the given object.
|
java.util.List<InequalityTerm> |
getAffectedTerms(InequalityTerm updateTerm)
Get the list of affected InequalityTerms from the OntologySolver's
ConceptTermManager.
|
InequalityTerm |
getConceptTerm(java.lang.Object object)
Return the concept term from the given object.
|
ConceptTermFactory |
getConceptTermManager()
Return the concept term manager that collects and maintains a hash map
that maps all model objects to their the inequality terms for the OntologySolver.
|
ConstraintManager |
getConstraintManager()
Get the ConstraintManager that collects and maintains all the inequality
constraints for the OntologySolver.
|
java.util.Hashtable<java.lang.String,java.lang.String> |
getInitialSolverInformation()
Initialize the solver and get the initial statistics for the
Lattice OntologySolver.
|
java.util.Hashtable<java.lang.String,java.lang.String> |
getResolvedSolverInformation()
Get the statistics for the Lattice OntologySolver after the
model has been resolved.
|
protected java.util.List<InequalityTerm> |
getUnacceptableTerms()
Return the list of inequality terms that resolved to unacceptable
concepts.
|
protected java.lang.String |
getUnacceptableTermsAsString()
Return a string representing the list of terms that resolved to
unacceptable concepts.
|
boolean |
hasUnacceptableTerms()
Returns true if one or more terms resolved to unacceptable concepts,
false otherwise (if the solver has not run, or if all terms have
acceptable resolved concepts.
|
void |
initialize()
Initialize the solver: Reset the solver (superclass) and then collect
all of the initial constraints from the model.
|
boolean |
isAnnotatedTerm(java.lang.Object object)
Return true if the given model object has been annotated with a
manual annotation constraint.
|
boolean |
isLeastFixedPoint()
Return true if the solver is finding a least fixed point, and
false if the solver is finding a greatest fixed point.
|
void |
reset()
Reset the solver.
|
void |
resolveConcepts()
Resolve the concept values for the toplevel entity that contains this
solver, given the model analyzer that invokes this.
|
void |
test()
Run concept inference and check the values match those trained.
|
void |
train()
Run concept inference and save the inferred concept values.
|
checkErrors, checkResolutionErrors, configure, displayConcepts, getMoMLHandler, invokeSolver, invokeSolver, isSettable
_getAdapter, _getPackageName, _toplevel, cleanConstants, clearResolvedConcept, getAllAdapters, getAllConceptableNamedObjs, getAllContainedOntologies, getAllPropertyables, getAllSolvers, getAttribute, getConcept, getOntology, getOntologySolverUtilities, getParser, getParseTree, markAsNonSettable, resetAll, setConcept, setOntologySolverUtilities
_exportMoMLContents, attributeChanged, getConfigureSource, getConfigureText, getContainedModel
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent
_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
public StringParameter solvingFixedPoint
public StringParameter solverStrategy
public static final java.lang.String ADD_FUNCTION_NAME
public static final java.lang.String SUBTRACT_FUNCTION_NAME
public static final java.lang.String MULTIPLY_FUNCTION_NAME
public static final java.lang.String DIVIDE_FUNCTION_NAME
public static final java.lang.String NEGATE_FUNCTION_NAME
public static final java.lang.String RECIPROCAL_FUNCTION_NAME
public static final java.lang.String NOT_FUNCTION_NAME
public static final java.lang.String AND_FUNCTION_NAME
public static final java.lang.String OR_FUNCTION_NAME
protected java.util.List<Inequality> _initialConstraintList
protected java.util.List<Inequality> _resolvedConstraintList
protected java.util.List<InequalityTerm> _resolvedUnacceptableList
public LatticeOntologySolver(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The model that contains the OntologySolvername
- The name of the OntologySolverIllegalActionException
- If there is any problem creating the
OntologySolver object.NameDuplicationException
- If there is already a component
in the container with the same namepublic java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class OntologySolver
workspace
- The workspace for the cloned object.java.lang.CloneNotSupportedException
- Not thrown in this base classNamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public java.util.List<InequalityTerm> getAffectedTerms(InequalityTerm updateTerm) throws IllegalActionException
updateTerm
- This parameter doesn't appear to be usedIllegalActionException
- If an exception is thrownpublic ConstraintManager getConstraintManager()
public java.util.Hashtable<java.lang.String,java.lang.String> getInitialSolverInformation() throws IllegalActionException
IllegalActionException
- If an exception occurs when
collecting the constraints.public java.util.Hashtable<java.lang.String,java.lang.String> getResolvedSolverInformation() throws IllegalActionException
IllegalActionException
- If an exception occurs when
collecting the constraints.public LatticeOntologyASTNodeAdapter getAdapter(ASTPtRootNode node) throws IllegalActionException
node
- The given ASTPtRootNode.IllegalActionException
- If an exception is thrown in the private
_getAdapter methodpublic OntologyAdapter getAdapter(NamedObj component) throws IllegalActionException
component
- The given componentIllegalActionException
- If an exception is thrown in the private
_getAdapter methodpublic OntologyAdapter getAdapter(java.lang.Object object) throws IllegalActionException
getAdapter
in class OntologySolverBase
object
- The given object.IllegalActionException
- If an exception is thrown in the private
_getAdapter methodpublic InequalityTerm getConceptTerm(java.lang.Object object)
object
- The given object.public ConceptTermFactory getConceptTermManager()
public boolean hasUnacceptableTerms()
public void initialize() throws IllegalActionException
initialize
in class OntologySolverBase
IllegalActionException
- If an exception occurs when
collecting the constraints.public boolean isAnnotatedTerm(java.lang.Object object)
object
- The model object to be checked to see if it is annotatedpublic boolean isLeastFixedPoint() throws IllegalActionException
IllegalActionException
- If the solvingFixedPoint parameter
contains an invalid value.public void reset()
reset
in class OntologySolver
public void resolveConcepts() throws IllegalActionException
resolveConcepts
in class OntologySolverBase
IllegalActionException
- If there is an exception thrown during the OntologySolver
resolution.public void test() throws IllegalActionException
IllegalActionException
- If inference fails or the test
resolves to the wrong values.public void train() throws IllegalActionException
IllegalActionException
- If inference fails..protected java.lang.String getUnacceptableTermsAsString() throws IllegalActionException
IllegalActionException
- If the string cannot be formed from the
list of inequality termsprotected java.util.List<InequalityTerm> getUnacceptableTerms()
protected void _clearLists()
protected OntologyAdapter _getAdapter(java.lang.Object component) throws IllegalActionException
component
- The specified component.IllegalActionException
- Thrown if the LatticeOntologyAdapter
cannot be instantiated.protected ConceptTermManager _getConceptTermManager()
protected void _resolveConcepts(NamedObj toplevel, java.util.List<Inequality> constraintList) throws OntologyResolutionException
toplevel
- The top-level containerconstraintList
- The constraint list that we are solvingOntologyResolutionException
- If constraints are unsatisfiableprotected LatticeOntologySolver.ConstraintType _getConstraintType() throws IllegalActionException
IllegalActionException
- If solver strategy or fixed point
type cannot be understood.