MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - Object property
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Object property

 Post Reply Post Reply
Author
Message
Saivignesh View Drop Down
Contributor
Contributor


Joined: 01.May.2017
Location: Netherlands
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Saivignesh Quote  Post ReplyReply Direct Link To This Post Topic: Object property
    Posted: 06.May.2017 at 16:26
I will explain my question with an example.

I have the UML class. The class object has operations and attributes (class be engine and attribute be engine capacity). I want to create a new object (say engine specs) and i want a property for engine specs where I want to choose engine capacity via engine class. That is first I must select the UML class (engine) and then it should show all the attributes inside the engine and I should choose engine capacity. Is it possible?
Back to Top
jpt View Drop Down
MetaCase
MetaCase
Avatar

Joined: 25.Mar.2008
Points: 239
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpt Quote  Post ReplyReply Direct Link To This Post Posted: 08.May.2017 at 08:08
The usual pattern is that engine is the element of the metamodel (language definition) which is then instantiated while modeling (language use). When modeling an engine its properties (like capacity) can be specified. Depending on the metamodel you may have also additional engine capacity related constraints like it must be specified or it must be within a certain range etc.

An extended and more advanced approach is creating the modeling language while modeling with another modeling language. For example, you could have language to specify what kind of engine characteristics there can be (like capacity) and then another language to specify those engines and entering capacity etc. Here the former actually created the metamodel and extends the currently used metamodel. An example of this is Graphical GOPRR. I personally would not start with this as the first case but investigate first the planned use process of the language and create sample models with language users first.

Finally, and if you want to stick with UML, you may naturally have check in UML Object Diagram that created objects include only those properties the class (defined in UML Class Diagram) the object refers to has defined. A MERL script would first navigate from Object to its Class (and its supertypes) and get data from its Attributes and then crosscheck that the Variables of the Object refer to the same attributes.
Back to Top
Saivignesh View Drop Down
Contributor
Contributor


Joined: 01.May.2017
Location: Netherlands
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Saivignesh Quote  Post ReplyReply Direct Link To This Post Posted: 08.May.2017 at 11:58
Suppose if I have an attribute. How do I write a generator to find the class of the attribute?
Back to Top
jpt View Drop Down
MetaCase
MetaCase
Avatar

Joined: 25.Mar.2008
Points: 239
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpt Quote  Post ReplyReply Direct Link To This Post Posted: 08.May.2017 at 13:01
This is then the 3rd option. As generator relies on the metamodel and since UML was already mentioned I'll follow it below. In Object Diagram of UML objects are specified. The Object has a property that refers to its Class. Accessing that Class for the given Object with MERL is ‘do :Classs {}’ and the check can be adjusted how it checks and reports the outcome. Below is one example:

CheckAttributes()

_translators()
local 'attTypes' write
    ' '
    do :Class {
      do :Attributes { id%var ' ' }
    }
close

do :Variables {
    do :Attribute {
      if not @attTypes =~ id%var%wildsp then
        'Error: ' :Value;1 ' is not based on class definition' newline
      endif
    }
}

Comparison could be made based on name (:Name in MERL) only, but with id it also checks other parts of the attribute definition such as datatype and visibility. Most accurate comparison would be when based on the same attribute definition and then comparison would be directly to oid (internal unique identifier). You can also extend the generator to collect to attribute types variable also the possible supertypes of the class with: do ~Spezialization~SuperClass.() {} etc.

You can place the above generator to the symbol of Object and then check result as variables are given, or run it in live check generator so the checks are run for each modeling operation, or put it as own check generator that developer can run when needed. Often these checks are also called during code generation but here having instance objects that might not be the case – all depends on your metamodel and use case.


Edited by jpt - 08.May.2017 at 13:27
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.05
Copyright ©2001-2022 Web Wiz Ltd.

This page was generated in 0.047 seconds.