pyuseocl.evaluation

Model the result of the evaluation of a USE OCL state (a soil file) against a USE OCL model. This module represents the output of the evaluation while the module ‘evaluator’ actually perform the computation from a state (a ‘.soil’) and a model (a ‘.use’)) using a check command. Simply put this module represents the information contained in the output of this command which might look like:

checking invariant (NUM) `CLASS::INVARIANT': OK.

checking invariant (NUM) `CLASS::INVARIANT': FAILED.
  -> false : Boolean
Instances of CLASS violating the invariant:
  -> Set{@bedroom201,@bedroom202, ...} : Set(Bedroom)

The evaluation is modeled at two levels of granularity.

  • At the model level there are 3 classes:

    • ‘ModelEvaluation’ is the top-level result. This is an abstract class.
    • ‘ModelValidation’ is a ‘ModelEvaluation’ representing the fact that ALL invariants have been validated.
    • ‘ModelViolation’ is a ‘ModelEvaluation’ representing the fact that at least one invariant has not been validated.
  • At the feature level (e.g. ‘invariant’ or a ‘cardinality’) there are also 3 classes:

    • ‘InvariantEvaluation’ is an abstract class representing the outcome of the evaluation of an invariant against a state.
    • ‘InvariantValidation’ is a ‘InvariantEvaluation’ representing the fact that the invariant has been validated.
    • ‘InvariantViolation’ is a ‘InvariantEvaluation’ representing the fact that the invariant has been violated.
    • ‘CardinalityViolation’ represents the fact that a cardinality has been violated.

All these objects are created by the module ‘evaluator’.

Classes

CardinalityViolation(modelViolation, role, ...) Cardinality violation.
InvariantEvaluation(modelEvaluation, invariant) Result of the evaluation of an invariant.
InvariantValidation(modelEvaluation, invariant) Invariant validation.
InvariantViolation(modelViolation, ...) Invariant violation.
ModelEvaluation(model[, state]) Result of the evaluation of a USE OCL state against a USE OCL model.
ModelValidation(model, state) Result of the positive evaluation of a USE OCL state against a USE OCL model.
ModelViolation(model, state) Result of the negative evaluation of a USE OCL state against a USE OCL model.

CardinalityViolation

class pyuseocl.evaluation.CardinalityViolation(modelViolation, role, violatingObject, cardinalityFound)[source]

Cardinality violation.

Looks like this in USE OCL:

Multiplicity constraint violation in association `ASSOC':
  Object `OBJECT' of class `CLASS' is connected to NUM objects of class `CLASS'
  at association end `END' but the multiplicity is specified as `NUM'.

InvariantEvaluation

class pyuseocl.evaluation.InvariantEvaluation(modelEvaluation, invariant)[source]

Result of the evaluation of an invariant. This is an abstract class.

InvariantValidation

class pyuseocl.evaluation.InvariantValidation(modelEvaluation, invariant)[source]

Invariant validation.

Looks like this in USE OCL:

checking invariant (NUM) `CLASS::INVARIANT': OK.

InvariantViolation

class pyuseocl.evaluation.InvariantViolation(modelViolation, invariant, violatingObjects)[source]

Invariant violation.

Looks like this in USE OCL:

checking invariant (NUM) `CLASS::INVARIANT': FAILED.
  -> false : Boolean
Instances of CLASS violating the invariant:
  -> Set{@bedroom201,@bedroom202, ...} : Set(Bedroom)

ModelEvaluation

class pyuseocl.evaluation.ModelEvaluation(model, state=None)[source]

Result of the evaluation of a USE OCL state against a USE OCL model. This is an abstract class. In practice this could either be a ModelValidation if the state is valid, that is there is absolutely no errors. If there is at least one error, then this will be a ModelViolation. A ModelEvaluation contains a map of InvariantEvaluation as well as a map of CardinalityEvaluation.

state = None

str

invariantEvaluations = None

dict[Invariant, InvariantEvaluation]

cardinalityViolations = None

dict[Role, list[CardinalityViolation] ]

getInvariantEvaluation(classOrAssociationClassName, invariantName)[source]

ModelValidation

class pyuseocl.evaluation.ModelValidation(model, state)[source]

Result of the positive evaluation of a USE OCL state against a USE OCL model. Nothing particular to be stored as there is no error.

ModelViolation

class pyuseocl.evaluation.ModelViolation(model, state)[source]

Result of the negative evaluation of a USE OCL state against a USE OCL model. Store invariants violations and/or cardinality violations.