Issue 7889: Inconsistent use of 'Element' between MOF and UML (uml2-rtf) Source: Adaptive (Mr. Pete Rivett, pete.rivett(at)adaptive.com) Nature: Uncategorized Issue Severity: Summary: UML uses Element to mean any Element in a Model, which is inherently something that has an identity separate from its value: this even includes elements such as ValueSpecification. MOF uses Object for such a thing, and uses Element to represent any value: specifically when used to declare parameters in Reflection then Element is used to represent both 'Objects' and plain data values (such as integers or strings) used as property or parameter values. Object inherits from Element. Proposed resolution: MOF should swap the names of Object and Element: this makes it consistent with UML and with languages such as Java where java.lang.object can represent data values. Resolution: Revised Text: Resolution: In MOF Core, Element and Object will have their names swapped as proposed. There is no effect on Infrastructure: MOF is in effect merging in Object as a new superclass to Element. Figure 2 · Replace class name "Element (from Elements)" by "Object" · Replace class name "Object" by "Element" · Replace the 7 operations for the Object (now Element) class by the following: getMetaClass() : Class container() : Element equals(object : Object) : Boolean get(property : Property) : Object set(property : Property, object: Object) isSet(property : Property) : Boolean unset(property : Property) · Replace the 3 operations for the Factory class by the following: createFromString(dataType : DataType, string : String) : Object convertToString(dataType : DataType, object: Object) : String create(metaClass : Class) : Element Section 9.1 · Change section name from Object to Element · Replace the first para by the following: Every Element has a Class which describes its properties and operations. The Element is an Instance of this Class. Element extends Abstraction::Elements::Element. All model elements that specialize Reflection::Element inherit reflective capabilities. In particular, this includes all model elements from UML2 Infrastructure. · Replace the Operations section by the following text: getMetaClass() : Class Returns the Class that describes this element. container(): Element Returns the parent container of this element if any. Return Null if there is no containing element. equals(object: Object): Boolean Determines if the object equals this Element instance. For instances of Class, returns true if the object and this Element instance are references to the same Object. For instances of DataType, returns true if the object has the same value as this Element instance. Returns false for all other cases. get(property: Property) : Object Gets the value of the given property. If the Property has multiplicity upper bound of 1, get() returns the value of the Property. If Property has multiplicity upper bound >1, get() returns a ReflectiveSequence containing the values of the Property. If there are no values, the ReflectiveSequence returned is empty. ReflectiveSequence is defined in section "MOF::Common" on page 24. Exception: throws IllegalArgumentException if Property is not a member of the Class from class(). set(property: Property, object: Object) If the Property has multiplicity upper bound = 1, set() atomically updates the value of the Property to the object parameter. If Property has multiplicity upper bound >1, the Object may be either a ReflectiveCollection or a ReflectiveSequence. The behavior is identical to the following operations performed atomically: ReflectiveSequence list = element.get(property); list.clear(); list.addAll((ReflectiveSequence) object); There is no return value. Exception: throws IllegalArgumentException if Property is not a member of the Class from getMeta-Class(). Exception: throws ClassCastException if the Property's type isInstance(object) returns false and Property has multiplicity upper bound = 1 Exception: throws ClassCastException if Object is not a ReflectiveSequence and Property has multiplicity upper bound > 1 Exception: throws IllegalArgumentException if object is null, Property is of type Class, and the multiplicity upper bound > 1. isSet(property: Property): Boolean If the Property has multiplicity upper bound of 1, isSet() returns true if the value of the Property is different than the default value of that property. If Property has multiplicity upper bound >1, isSet() returns true if the number of objects in the list is > 0. Exception: throws IllegalArgumentException if Property is not a member of the Class from class(). unset(property: Property) If the Property has multiplicity upper bound of 1, unset() atomically sets the value of the Property to its default value for DataType type properties and null for Class type properties. If Property has multiplicity upper bound >1, unset() clears the ReflectiveSequence of values of the Property. The behavior is identical to the following operations performed atomically: ReflectiveSequence list = element.get(property); list.clear(); There is no return value. After unset() is called, element.isSet(property) == false. Exception: throws IllegalArgumentException if Property is not a member of the Class from getMetaClass(). Constraints No additional constraints. Semantics Class Element is the superclass of all model elements in MOF, and is the superclass of all instances of MOF model elements. Each element can access its metaClass in order to obtain a Class that provides a reflective description of that element. By having both MOF and instances of MOF be rooted in class Object, MOF supports any number of meta layers as described in Chapter 1, "MOF Architecture". The following describes the interaction between default values, null, isSet, and unSet. Single-valued properties: If a single-valued property has a default: o It is set to that default value when the element is created. isSet=false o If the value of that property is later explicitly set, even to the default value, isSet=true o If the property is unSet, then the value of the property returns to the default, and isSet=false If a single-valued property does not have a default: o At creation, its value is null. isSet=false o If the value of that property is later explicitly set, even to null, isSet=true o If the property is unSet, then the value of the property returns to null, and isSet=false Multi-valued properties: o When the element is created, it is an empty list. isSet=false o If the list is modified in any way (except unSet), isSet=true o If the list is unSet, it is cleared and becomes an empty list. isSet=false. The implementation of isSet is up to the implementer. In the worst case it can be implemented by having an additional boolean, but usually for a particular implementation it can be implemented more efficiently (e.g. by having an internal distinguished value used to represent "no value set"). For default values, implementations are not required to access stored metadata at runtime. It is adequate to generate a constant in the implementation class for the default. Rationale Element is introduced in package Reflection so that it can be combined with Core::Basic to produce EMOF which can then be merged into CMOF to provide reflective capability to MOF and all instances of MOF. Section 9.2 Replace Operations section by the following text Operations createFromString(dataType: DataType, string: String): Object Creates an Object initialized from the value of the String. Returns null if the creation cannot be performed. The format of the String is defined by the XML Schema SimpleType corresponding to that datatype. Exception: NullPointerException if datatype is null. Exception: IllegalArgumentException if datatype is not a member of the package returned by getPackage(). convertToString(datatype: DataType, object: Object): String Creates a String representation of the Object. Returns null if the creation cannot be performed. The format of the String is defined by the XML Schema SimpleType corresponding to that dataType. Exception: IllegalArgumentException if datatype is not a member of the package returned by getPackage(). create(metaClass: Class): Element Creates an element that is an instance of the metaClass. Element::metaClass == metaClass and metaClass.isInstance(element) == true. All properties of the element are considered unset. The values are the same as if element.unset(property) was invoked for every property. Returns null if the creation cannot be performed. Classes with abstract = true always return null. The created element's metaClass == metaClass. Exception: NullPointerException if class is null. Exception: IllegalArgumentException if class is not a member of the package returned by getPackage(). Add new section 9.3 as follows: 9.3 Object Reflection introduces Object as a supertype of Element in order to be able to have a Type that represent both elements and data values. Object represents 'any' value and is the equivalent of java.lang.object in Java. Section 10 · Replace the first sentence by: An element has an identifier in the context of an extent that distinguishes it unambiguously from other elements. Figure 3 · Replace "Element( (from Elements)" by "Object" · In class Extent, replace objects(): ReflectiveSequence by elements(): ReflectiveSequence · In class URIExtent, replace uri(object:Object): String by uri(element:Element): String · And replace object(uri:String): Object by element (uri:String): Element Section 10.1 · Replace first para by: An Extent is a context in which an Element in a set of Elements in a set can be identified. An element may be a member of zero or more extents. An Extent is not an Element, it is part of a MOF capability. · Replace Operations section by: useContainment(): Boolean When true, recursively include all elements contained by members of the element(). elements(): ReflectiveSequence Returns a ReflectiveSequence of the elements directly referenced by this extent. If exclusive()==true, these elements must have container()==null. Extent.elements() is a reflective operation, not a reference between Extent and Element. See Chapter 4, "Reflection" for a definition of ReflectiveSequence · Replace Rationale section by: Extents provide a context in which MOF Elements can be identified independent of any value in the Element. Section 10.3 · Replace first sentence by: Identity extends Basic::Property with the ability to designate a property as an identifier for the containing element. · Replace Rationale by: Objects must have identity. The Property isID formalizes this capability in the metadata describing the object.. Section 10.4 · Replace first sentence by: An extent that provides URI identity. A URIExtent can have a URI that establishes a context that may be used in determining identifiers for elements identified in the extent. Implementations may also use values of properties with isID==true in determining the identifier of the element. · Replace Operations section by contextURI(): String Specifies an identity for the extent that establishes a URI context for identifying elements in the extent. An extent has an identity if a URI is assigned. URI is defined in IETF RFC-2396 available at http://www.ietf.org/rfc/rfc2396.txt. uri(element: Element): String Returns the URI of the given element in the extent. Returns Null if the element is not in the extent. element(uri: String): Element Returns the Element identified by the given URI in the extent. Returns Null if there is no element in the extent with the given URI. Note the Object does not (necessarily) contain a property corresponding to the URI. The URI identifies the element in the context of the extent. The same element may have a different identifier in another extent. · Replace Rationale by URIs are the defacto standard identity mechanism for the Web and are therefore useful for identifying MOF elements and navigating links between them. Figure 5 · Replace operations in ReflectiveCollection with: add(object : Object) : Boolean addAll(elements : ReflectiveSequence) : Boolean clear() remove(object : Object) : Boolean size() : Integer · Replace operations in ReflectiveSequence with: add(index : Integer, object : Object) get(index : Integer) : Object remove(index : Integer) : Object set(index : Integer, object : Object) : Object Section 10.5.1 · Replace entire section with the following: 10.5.1 ReflectiveCollection RefelectiveCollection is a reflective class for accessing properties with more than one possible value. It is defined in package MOF::Common in order to facilitate reuse in many other MOF capabilities. For ordered properties, ReflectiveSequence (see below) must be returned. Modifications made to the ReflectiveCollection update the Element's values for that property atomically. Exception: throws ClassCastException if the Property's type isInstance(Element) returns false. add(object : Object): Boolean Adds object to the last position in the collection. Returns true if the object was added. addAll(objects: ReflectiveSequence): Boolean Adds the objects to the end of the collection. Returns true if any objects were added. clear() Removes all objects from the collection. remove(object : Object): Object Removes the specified object from the collection. Returns true if the object was removed. size(): Integer Returns the number of objects in the colleciton. Section 10.5.2 · Replace entire section with the following: 10.5.2 ReflectiveSequence ReflectiveSequence is a subclass of ReflectiveCollection that is used for accessing ordered properties with more than one possible value. Modifications made to ReflectiveSequence update the Element's values for that property atomically. Modifications made to the ReflectiveSequence update the Element's values for that property atomically. Exception: throws IllegalArgumentException if a duplicate would be added to the collection and Property.isUnique()==true. Exception: throws IndexOutOfBoundsException if an index out of the range of 0 <= index < size() is used. Exception: throws IllegalArgumentException if a duplicate would be added to the list and Property is of type Class or Property.isUnique()==true. add(index: Integer, object : Object) Adds object to the specified index in the sequence, shifting later objects. get(index: Integer): Object Returns the object at the given index in the sequence. remove(index: Integer): Object Removes the object at the specified index from the sequence. Returns the object removed. set(index: Integer, object: Object): Object Replaces the object at the specified index with the new object. The removed object is returned. Behavior of particular operations defined in ReflectiveCollection is the following when applied to a ReflectiveSequence: add(object: Object): Boolean Adds object to the end of the sequence. Returns true if the object was added. addAll(objects: ReflectiveSequence): Boolean Adds the objects to the end of the sequence. Returns true if any objects were added. remove(,object: Object): Boolean Removes the first occurence of the specified object from the sequence. Figure 5 · Replace the Object superclass with Element Figure 13 · Replace the Element (from Elements) superclass with Object · Replace the class Object with Element · Replace the following operation on Object (now Element): invoke(op : Operation, arguments : Argument) : Element with: invoke(op : Operation, arguments : Argument) : Object · Replace the 3 operations on Factory with: name : String createElement (class : Class, arguments : Argument) : Element createLink(association : Association, firstElement : Element, secondElement: Element) : Link · Replace the 4 operations on Extent with: elementsOfType(type : Class, includeSubtypes : Boolean) : Element linksOfType(type : Association) : Link linkedElements(association : Association, endObject : Element, end1ToEnd2Direction : Boolean) : Element linkExists(association : Association, firstElement : Element, secondElement : Element) : Boolean · Replace the 2nd property of Argument with: value: Object · Replace the association ends firstObject and secondObject with firstElement and secondElement. Section 13.1 · Replace entire section with the following text: 13.1 Link This is a new class that represents an instance of an Association, in the same way that Element represents an instance of a Class. Properties association: Association This is the Association of which the Link is an instance. firstElement: Element This is the Element associated with the first end of the Association. secondElement: Element This is the Element associated with the second end of the Association. Operations equals(otherLink:Link): Boolean Returns True iff the otherLink has association, firstElement, secondElement all equal to those on this Link. delete() Deletes the Link. This may leave the same elements associated by other links for this Association. Constraints The firstElement must conform to the type of the first memberEnd of the association. The secondElement must conform to the type of the second memberEnd of the association. The set of Links as a whole must not break the multiplicity constraints of the association member ends. Semantics When the link is created, it is not assigned to any Extent. Rationale Since MOF 2.0 allows the same pair of elements to be linked more than once in the same Association (if isUnique=false for the association ends), then Link needs to be more a simple tuple value, though not as heavyweight as a first class Element. Changes from MOF 1.4 None. The MOF 1.4 navigation capabilities are retained. Section 13.2, Argument · Replace entire section with the following: 13.2 Argument This is a new datatype that is used to represent named arguments to open-ended reflective operations. It is open-ended and allows both Elements and data values to be supplied. Properties name: String The name of the argument. value: Object The value of the argument. Constraints None: constrains will be dependent on the context of where the Argument is supplied. Semantics None. Rationale Since MOF 2.0 allows Operation parameters and Properties to have defaults, it is necessary to explicitly identify the values supplied. Changes from MOF 1.4 Values supplied to constructors are now identified rather than being deduced through the ordering. Section 13.3 · Introduce new section for Element that was previously called Element and not given a section number but 'lost' in 13.2 13.3 Element CMOF Reflection adds the following extra operations. Operations delete() Deletes the Element. invoke(op:Operation, arguments : Argument[0..*]) : Object[0..*] Calls the supplied Operation on the element, passing the supplied Arguments and returning the result. The Operation must be defined on the Class of the Element, and the arguments must refer to Parameters of the Operation. If an Argument is not supplied for a Parameter its default value, if any, will be used. isInstanceOfType(type : Class, includeSubtypes : Boolean) : Boolean Returns true if this element is an instance of the supplied Class, or if includeSubtypes is true, any of its subclasses. Rationale Adds the equivalent of MOF 1.4 capabilities. Changes from MOF 1.4 Parameters to operations are now identified by name. Section 13.3, Factory Renumber to 13.4 (due to reinstatement of Object - see previous change) and replace test with the following: 13.4 Factory CMOF Reflection adds two extra operations. Operations createElement(class:Class, arguments : Argument[0..*]) : Element Unlike the simple create() operation this allows arguments to be provided for use as the initial values of properties. The arguments must refer to DataType Properties of the Class. If an Argument is not supplied for a Property its default value, if any, will be used. createLink(association : Association, firstElement : Element, secondElement : Element) : Link This creates a Link from 2 supplied Elements that is an instance of the supplied Association. The first Element is associated with the first end (the properties comprising the association ends are ordered) and must conform to its type. And correspondingly for the second Element. Rationale Adds the equivalent of MOF 1.4 capabilities. Changes from MOF 1.4 Names have changed. Section 13.4, Factory Renumber to 13.5 (due to reinstatement of Object - see previous change) and replace test with the following: 13.5 Extent CMOF Reflection adds four extra operations. Operations elementsOfType(type : Class, includeSubtypes : Boolean) : Element [0..*] This returns those elements in the extent that are instances of the supplied Class. If includeSubtypes is true, then instances of any subclasses are also returned. linksOfType(type : Association) : Link[0..*] This returns those links in the extent that are instances of the supplied Association. linkedElements(association : Association, endElement : Element, end1ToEnd2Direction : Boolean) : Element [0..*] This navigates the supplied Association from the supplied Element. The direction of navigation is given by the end1ToEnd2Direction parameter: if true, then the supplied Element is treated as the first end of the Association. linkExists(association : Association, firstElement : Element, second Element : Element): Boolean This returns true if there exists at least one link for the association between the supplied elements at their respective ends. Rationale Adds the equivalent of MOF 1.4 capabilities. Changes from MOF 1.4 Names have changed. Disposition: Resolved Actions taken: November 1, 2004: received issue February 18, 2005: moved from infrastructure August 23, 2006: closed issue Discussion: End of Annotations:===== ubject: MOF/Infra FTF - help please Date: Mon, 1 Nov 2004 00:48:34 -0500 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: MOF/Infra FTF - help please Thread-Index: AcS/1myMwUJxdodlTQOQ0TjZ99KuVQ== Priority: Urgent From: "Pete Rivett" To: Cc: , X-Virus-Scanned: by amavisd-new at sentraliant.com X-MIME-Autoconverted: from base64 to 8bit by amethyst.omg.org id iA15vH1U015196 HI Juergen, I'm just finishing up the FTF report (eventually!) and need help with the following please: a) My Outlook folder seems to have lost many of the votes for the Infra Ballot 3 (between 11-25 June) - I only seem to have received 6 votes which I'm sure is not true. b) Please raise the following as a MU2I issue (we have a proposed resolution which we are going to ballot imminently but need an issue number) ------ Issue: Inconsistent use of 'Element' between MOF and UML UML uses Element to mean any Element in a Model, which is inherently something that has an identity separate from its value: this even includes elements such as ValueSpecification. MOF uses Object for such a thing, and uses Element to represent any value: specifically when used to declare parameters in Reflection then Element is used to represent both 'Objects' and plain data values (such as integers or strings) used as property or parameter values. Object inherits from Element. Proposed resolution: MOF should swap the names of Object and Element: this makes it consistent with UML and with languages such as Java where java.lang.object can represent data values. ---------- Pete Rivett (mailto:pete.rivett@adaptive.com) CTO, Adaptive Inc. Dean Park House, 8-10 Dean Park Crescent, Bournemouth, BH1 1HL, UK Tel: +44 (0)1202 449419 Fax: +44 (0)1202 449448 To: Branislav Selic Cc: uml2-rtf@omg.org Subject: Re: Draft ballot 1 X-Mailer: Lotus Notes Release 6.0.2CF2 July 23, 2003 From: Jim Amsden Date: Thu, 14 Apr 2005 16:34:47 -0400 X-MIMETrack: Serialize by Router on D03NM119/03/M/IBM(Release 6.53HF294 | January 28, 2005) at 04/14/2005 14:34:49, Serialize complete at 04/14/2005 14:34:49 Issue 7889: Inconsistent use of 'Element' between MOF and UML MOF2 has already made this change. Branislav Selic 04/11/2005 12:19 PM To uml2-rtf@omg.org cc Subject Draft ballot 1 Here is the consolidated set of resolution proposals for ballot 1 consisting of 5 resolutions from Eran 25 from Conrad 51 from Bran So far, I've received feedback from Conrad and Joaquin on some of the proposed resolutions. Please review these. I will make the final call on which of these will actually be in the final ballot depending on the feedback. If no one objects to a particular issue, I will assume that everyone is happy with the resolution that is proposed and include it by default. Regards, Bran [attachment "Ballot1Draft.050411.doc" deleted by Jim Amsden/Raleigh/IBM] http://www.adaptive.com