lutaml / lutaml-uml

UML module for LutaML
2 stars 2 forks source link

UML syntax: Instance specification #18

Open ronaldtse opened 4 years ago

ronaldtse commented 4 years ago

Instance specification

Instance specification-Notation

Screen Shot 2020-08-05 at 12 55 16 AM

Proposal:

1 & 2 are equivalent.

# 1.
instance "license Plate":String {
  "HH-OO 42"
}

# 2. (alternative)
instance "license Plate":String =  "HH-OO 42"

3.

# InstanceSpecification
instance :Circle {
  name: String = "oott.mx"
  street: String = "Obregon 53"
  city: String = "Culiacan,MX"
  phone: String = "7134567"
}
w00lf commented 4 years ago

@ronaldtse second example denotes shorthand syntax?

Does the third example have values in it as described in #16 or does it a separate type of object?

ronaldtse commented 4 years ago

@ronaldtse second example denotes shorthand syntax?

Screen Shot 2020-08-06 at 11 02 26 PM

Both of these specify an attribute value without a class (maybe an anonymous class). I was just trying to represent them. Now I notice they are not very correct.

Maybe the correct notation is:

// No Class
// of the pattern: "instance {LutaML reference name}:{Class name}" since there is no ":" there is no class,
// identical to:
// instance MyInstance: {
instance MyInstance {
  "license Plate":String = "HH-OO 42"
}

// Has Class
// of the pattern: "instance {LutaML reference name}:{Class name}" 
instance MyInstance:MyClass {
  "license Plate":String = "HH-OO 42"
}

?

Does the third example have values in it as described in #16 or does it a separate type of object?

Same as #16, except that these are typed elements (contains attribute name + attribute type + attribute value).

In #16 there was not attribute type:

From #16:

instance :Expression {
  myvalue=1   // no value type here
}

instance :Expression {
  myvalue: Number = 1   // has value type here
}