-
-
Notifications
You must be signed in to change notification settings - Fork 216
Save model namespace #3531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Save model namespace #3531
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2dfc9af
to
b04d22c
Compare
257c238
to
35fad9d
Compare
f90880a
to
7a4a7a4
Compare
23fea7e
to
6fe65ef
Compare
This gives us the opportunity to derive the modeling language from the stored element name (with NS).
It makes little sense to implement the SAX ContentHandler interface for writing. Instead let's use a small Pythonic interface based on with-blocks.
This makes it easier to look up the modeling language from a class.
Use dunder syntax, since it kind of meta data for the class.
Also introduced extra syntax to tell which modeling language an element is coming from.
3464df6
to
3fa6ac1
Compare
ed6294c
to
d8fa658
Compare
abad84a
to
529f8d5
Compare
Now it's no longer mixed with the UML model, which is, I think, more clean.
529f8d5
to
8bf4626
Compare
Shortly describe the new property.
Presentations have no name of their own.
danyeaw
approved these changes
Oct 20, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @amolenaar, this is fantastic, I really like the split of the namespaces like this!
Revert KerML changes
Presentation class inherits directly from Base
6 tasks
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Type
What kind of change does this PR introduce?
What is the current behavior?
All model elements are stored in a flat namespace. Hence we cannot have elements with the same name in different models.
In the application we have the concept of ModelingLanguages. This concept should be extended to file storage.
Issue Number: #1399, #2584
What is the new behavior?
Gaphor can check beforehand (based on XML namespaces) if the required modeling language is available.Container
(notC4Container
) andDependency
(notC4Dependency
).Optional: models use aliases for all imported types: e.g.separate PR, see TODO's.from core import Element as _Element
Dependency
->UML.Dependency
,C4Dependency
->C4Model:Dependency
, and rename other C4 elements.__modeling_language__
convention.Does this PR introduce a breaking change?
Other information
To make it work, at the modeling language toplevel, I added a special property
__modeling_language__
. This property should match the name of the modeling language as defined inpyproject.toml
.Replaced
Base.umlproperties()
byBase.__properties__
. That looks more in line with our__modeling_language__
meta property.I introduced new namespaces for the new model feature:
https://gaphor.org/model
, andhttps://gaphor.org/modelinglanguage/{modeling_language}
.The general diagram items (comment, line, etc.) now have their own modeling language object.
The XML writer has been modernized.