Title: Issue 134: Specification of Constraints
1Issue 134 Specification of Constraints
- There is no standard way of specifying
constraints - Constraints in MDR metamodel
- OCL expressions can be provided for metaclass and
its instance - Target Data Element Concept and Conceptual
Domain, Value Domain and Data Element and so on. - Constraints of registered data elements (user
should be defined) - Target Conceptual Domain or Value Domain
- Representation, Dimensionality and Classification
are a kind of constraints - User defined matadata should enable to be defined
as extension mechanism, such as ebXML Registry
and Repository - Constraint should be described using such user
defined slots - Need formal description language such as OCL, CL
- We should allow OCL or other specification
languages to be used by users of the registry
2Constraints in Data Element Concept
- 4.11.1.3 Data Element Concept
- (1) A Data Element Concept is a concept that can
be represented in the form of a data element,
described independently of any particular
representation. - (2) A Data Element Concept may have zero or one
Object Class and zero or one Property. - (3) The union of a Property and an Object Class
provides significance beyond either that of the
Property or the Object Class. - (4) A Data Element Concept thus has a Definition
independent from the Definition of the Object
Class or the Property. - (5) As an Administered Item, a Data Element
Concept carries its own Administration Record
information, allowing it to be identified, named,
defined and optionally classified within a
Classification Scheme. IdentifiedandOptionallyClas
sified - (6) A Data Element Concept may be associated with
other Data Element Concepts, via the Data Element
Concept Relationship. - (7) The nature of the relationship is described
using the data element concept relationship type
description. IsDescribedUsing - (8) A Data Element Concept may be registered as
an Administered Item without necessarily being
associated with any Data Element, but a Data
Element Concept shall be associated with exactly
one Conceptual Domain, as represented by the
"data element concept-conceptual domain
relationship" in Figure 8. MustBeRegistered,
ShallBeAssociatedWith - (9) The Conceptual Domain specifies all valid
Value Meanings of a Data Element Concept. The
Conceptual Domain is described in
4.12.1.1.MustBeContained
3Examples of OCL expression
- MustBeContainedUnless.
- .AttributesCannotBeChanged
- .CannotBeDeleted
- .DependenciesCannotBeChanged
- .NamesMustNotCollide
- .MustNotBeSelf
- .MustBeSame
- .MustNotCollideWith.
- .RuleMustBeObeyed
- No.AllowedFor..
4Examples of Constraints (form MOF1.4)
- A ModelElement that is not a Package must have a
container. C-1 - The attribute values of a ModelElement which is
frozen cannot be changed. C-2 - A frozen ModelElement which is in a frozen
Namespace can only be deleted, by deleting the
Namespace. C-3 - The link sets that express dependencies of a
frozen Element on other Elements cannot be
explicitly changed. C-4 - The names of the contents of a Namespace must
not collide. C-5 - A Generalizable Element cannot be its own direct
or indirect supertype. C-6 - A supertypes of a GeneralizableElement must be
of the same kind as the GeneralizableElement
itself. C-7 - The names of the contents of a
GeneralizableElement should not collide with the
names of the contents of any direct or indirect
supertype. C-8 - Multiple inheritance must obey the Diamond
Rule. C-9 - If a Generalizable Element is marked as a
root, it cannot have any supertypes. C-10 - A GeneralizableElements immediate supertypes
must all be visible to it. C-11 - A GeneralizableElement cannot inherit from a
GeneralizableElement defined as a leaf. C-12
5C-1 MustBeContainedUnlessPackage
- format1 MUST_BE_CONTAINED_UNLESS_PACKAGE
- format2 must_be_contained_unless_package
- evaluation policy deferred
- description A ModelElement that is not a Package
must have a container.
context ModelElement inv not self.oclIsTypeOf(Pac
kage) implies self.container -gt size 1
6C-2 FrozenAttributesCannotBeChanged
- format1 FROZEN_ATTRIBUTES_CANNOT_BE_CHANGED
- format2 frozen_attributes_cannot_be_changed
- evaluation policy immediate
- description The attribute values of a
ModelElement which is frozen cannot be changed.
context ModelElement inv self.isFrozen()
implies let myTypes self.oclType() -gt
allSupertypes() -gt includes(self.oclType()
) in let myAttrs Set(Attribute)
self.RefBaseObjectrefMetaObject()
-gtasOclType(Class) -gt findElementsByTypeExten
ded(Attribute) in myAttrs -gt forAll(a
self.RefObjectrefValue_at_pre(a)
self.RefObjectrefValue(a))
7C-3 FrozenElementsCannotBeDeleted
- format1 FROZEN_ELEMENTS_CANNOT_BE_DELETED
- format2 frozen_elements_cannot_be_deleted
- evaluation policy immediate
- description A frozen ModelElement which is in a
frozen Namespace can only be deleted, by deleting
the Namespace. - context ModelElement
- post
- (self.isFrozen_at_pre() and
- self.container_at_pre -gt notEmpty and
- self.container.isFrozen_at_pre()) implies
(self.container.Objectnon_existent() or not
self.Objectnon_existent())
8C-4 FrozenDependenciesCannotBeChanged
- format1 FROZEN_DEPENDENCIES_CANNOT_BE_CHANGED
- format2 frozen_dependencies_cannot_be_changed
- evaluation policy immediate
- description The link sets that express
dependencies of a frozen Element on other
Elements cannot be explicitly changed. - context ModelElement
- post
- self.isFrozen() implies
- let myClasses self.oclType() -gt allSupertypes()
-gt includes(self.oclType()) in - let myRefs Set(Reference)
- self.RefBaseObjectrefMetaObject() -gt
asOclType(Class) -gt - findElementsByTypeExtended(Reference) in
- let myDepRefs myRefs -gt
- select(r Setcontents, constraints,
supertypes, type, referencedEnd,
exceptions, importedNamespace, elements -gt
includes(r.name)) in - myDepRefs -gt forAll(r self.RefObjectrefValue_at_p
re(r) -
self.RefObjectrefVa
lue(r))
9C-5 ContentNamesMustNotCollide
- format1 CONTENT_NAMES_MUST_NOT_COLLIDE
- format2 content_names_must_not_collide
- evaluation policy immediate
- description The names of the contents of a
Namespace must not collide. - context Namespace
- inv self.contents.forAll( e1, e2 e1.name
e2.name implies r1 r2)
10C-6 SupertypeMustNotBeSelf
- format1 SUPERTYPE_MUST_NOT_BE_SELF
- format2 supertype_must_not_be_self
- evaluation policy immediate
- description A Generalizable Element cannot be
its own direct or indirect - supertype.
- context GeneralizableElement
- inv self.allSupertypes() -gt forAll(s s ltgt
self)
11C-7 SupertypeKindMustBeSame
- format1 SUPERTYPE_KIND_MUST_BE_SAME
- format2 supertype_kind_must_be_same
- evaluation policy immediate
- description A supertypes of a GeneralizableElemen
t must be of the same kind as the
GeneralizableElement itself. - context GeneralizableElement
- inv self.supertypes -gt forAll(s s.oclType()
self.oclType())
12C-8 ContentsMustNotCollideWithSupertypes
- format1 CONTENTS_MUST_NOT_COLLIDE_WITH_SUPERTYPES
- format2 contents_must_not_collide_with_supertypes
- evaluation policy immediate
- description The names of the contents of a
GeneralizableElement should not - collide with the names of the contents of any
direct or indirect - supertype.
- context GeneralizableElement
- inv
- let superContents self.allSupertypes() -gt
collect(s s.contents) in - self.contents -gt forAll(m1 superContents -gt
forAll(m2 m1.name m2.name implies m1 m2))
13C-9 DiamondRuleMustBeObeyed
- format1 DIAMOND_RULE_MUST_BE_OBEYED
- format2 diamond_rule_must_be_obeyed
- evaluation policy immediate
- description Multiple inheritance must obey the
Diamond Rule. - context GeneralizableElement
- inv
- let superNamespaces
- self.supertypes -gt collect(s s.extendedNamespace
) in superNamespaces -gt asSet -gt isUnique(s
s.name)
14C-10 NoSupertypesAllowedForRoot
- format1 NO_SUPERTYPES_ALLOWED_FOR_ROOT
- format2 no_supertypes_allowed_for_root
- evaluation policy immediate
- description If a Generalizable Element is marked
as a root, it cannot have any supertypes. - context GeneralizableElement
- inv self.isRoot implies self.supertypes -gt
isEmpty
15(No Transcript)
16(No Transcript)
17(No Transcript)
18(No Transcript)
19(No Transcript)
20(No Transcript)
21(No Transcript)