Systems-Modeling / SysML-v2-Pilot-Implementation

Proof-of-concept pilot implementation of the SysML v2 textual notation and visualization
GNU Lesser General Public License v3.0
114 stars 23 forks source link

Package distributed in multiple files #510

Closed LorenzoL94 closed 7 months ago

LorenzoL94 commented 7 months ago

SysMLv2 Pilot Implementation version: 2023-08

I am currently studying the SysML v2 language and experimenting its features leveraging the eclipse pilot implementation.

I was trying to create a package whose content is distributed on several files but it seems that this is not allowed by the tool (the content of only one file is found, in particular the file that comes first in the tree). The possibility of distributing package content in multiple files would help me in handling for example separation of ownership, version control and IP protection for selective artifacts sharing.

You can find below a simple example of the use case.

Iron Man.sysml

package 'Marvel Films' {
    package 'The Infinity Saga' {
        package 'Phase One' {
            part def 'Iron Man';
            part def 'Iron Man 2';
        }
        package 'Phase Two' {
            part def 'Iron Man 3';
        }
    }
}

Thor.sysml

package 'Marvel Films' {
    package 'The Infinity Saga' {
        package 'Phase One' {
            part def 'Thor';
        }
        package 'Phase Two' {
            part def 'Thor: The Dark World';
        }
    }
}

Must see films.sysml

package must_see_films {
    import 'Marvel Films'::'The Infinity Saga'::'Phase One'::'Iron Man';
    import 'Marvel Films'::'The Infinity Saga'::'Phase One'::Thor; //  THIS WILL GIVE ERROR
}

I was not able to understand if such use case is allowed by the standard and this behavior is only a current limitation of the pilot implementation or if the standard itself does not allow this.

seidewitz commented 7 months ago

It is not possible to actually distribute a package over two files. Technically, what you end up with is two different packages that happen to have the same name. According to the KerML specification (end of 8.2.3.5.4),

It is possible that there will be more than one Membership in the global Namespace that resolves a given simple name. In this case, one of these Memberships is chosen for the resolution of the name, but which one is chosen is not otherwise determined by this specification.

That is, when you have two packages named Marvel Films in the global scope, the name will resolve to just one of the packages, but which one is not determined by the specification.

If you would like to start further discussion of this, or any other topic on using SysML v2, please post to the SysML v2 Release Google Group, rather than creating a GitHub issue. If you would like to request a change in the specification, please submit an issue on the OMG site.

Thanks.