public void ExclusionSubsetContra_1b(Store store) { myTestServices.LogValidationErrors("ExclusionContradictsSubsetError exists"); ORMModel model = store.ElementDirectory.FindElements <ORMModel>()[0]; SubsetConstraint constraint = (SubsetConstraint)model.ConstraintsDictionary.GetElement("SubsetConstraint1").FirstElement; myTestServices.LogValidationErrors("Removing Subset Constraint"); using (Transaction t = store.TransactionManager.BeginTransaction("Remove subset Constraint")) { constraint.Delete(); t.Commit(); } myTestServices.LogValidationErrors("Error Removed"); }
/// <summary> /// Validator callback for mixed subset constraint. Validates that a subset involving /// a supertype role is single-column and from a subtype to a normal role. /// </summary> private static void DelayValidateSupertypeSubsetPattern(ModelElement element) { SubsetConstraint constraint = (SubsetConstraint)element; if (!constraint.IsDeleted) { bool seenSupertypeMetaRole = false; int maxArity = 0; bool firstSequence = true; foreach (SetComparisonConstraintRoleSequence sequence in constraint.RoleSequenceCollection) { LinkedElementCollection <Role> constrainedRoles = sequence.RoleCollection; int roleCount = constrainedRoles.Count; if (roleCount > 1 && seenSupertypeMetaRole) { ThrowInvalidSupertypeMetaRoleConstraint(); } if (roleCount > maxArity) { maxArity = roleCount; } for (int i = 0; i < roleCount; ++i) { if (constrainedRoles[i] is SupertypeMetaRole) { if (roleCount > 1 || !firstSequence) { ThrowInvalidSupertypeMetaRoleConstraint(); } seenSupertypeMetaRole = true; } } firstSequence = false; } } }