lutaml / lutaml-uml

UML module for LutaML
2 stars 2 forks source link

UML syntax: Nested namespaces #12

Open ronaldtse opened 4 years ago

ronaldtse commented 4 years ago

Namespace

Namespaces Def.-A named element is an element that can have a name and a defined visibility (public, private, protected, package):

Screen Shot 2020-08-03 at 9 40 27 PM

Proposal

package Customers {
  package "Corporate customers" {
    class Insurance
  }
}

and/or (auto-define packages)

class Customers::"Corporate customers":Insurance

and/or (explicit definition of packages)

package Customers
package Customers::"Corporate customers"
class Customers::"Corporate customers":Insurance
w00lf commented 4 years ago

@ronaldtse first version looks like the right way to do it:

package Customers {
  package "Corporate customers" {
    class Insurance {}
  }
}

Visibility modifiers can be set by -, + or #:

package Customers {
  class Insurance {}
  - class PrivateInsurance {}
  # class ProtectedInsurance {}
}
class Insurance {}
class PrivateInsurance {}

package Customers {
   Insurance
   - PrivateInsurance
}
ronaldtse commented 4 years ago

Your examples look fine. We also need to take care of the case where the Package is defined outside of the current file (oh, we should support multiple files via include...)? Or not?

w00lf commented 4 years ago

Your examples look fine. We also need to take care of the case where the Package is defined outside of the current file (oh, we should support multiple files via include...)? Or not?

I think in that case we better to introduce import file possibility. It can look this way:

#! import path/to/file
ronaldtse commented 4 years ago

Good idea.

What syntax should we use for the syntax?

How about just:

include my_package.llu

class MyPackage::This {}

?

w00lf commented 4 years ago

Good idea.

What syntax should we use for the syntax?

How about just:

include my_package.llu

class MyPackage::This {}

?

I`d rather use hashbang, because its not display option and is type of a special command. This is an example how plantuml handles this:

@startuml

!import /path/to/customLibrary.zip
' This just adds "customLibrary.zip" in the search path

!include myFolder/myFile.iuml
' Assuming that myFolder/myFile.iuml is located somewhere
' either inside "customLibrary.zip" or on the local filesystem
ronaldtse commented 4 years ago

But hashbang is very shell-like.

I think we should:

?

Can we use just include for now without the ! and only change when we need to?

w00lf commented 4 years ago

But hashbang is very shell-like.

I think we should:

  • "include" a file or files under a directory
  • "import" a package

?

Can we use just include for now without the ! and only change when we need to?

Sure, we can, lets use notations without hashbang.

ronaldtse commented 4 years ago

Cool, thanks!