-
Notifications
You must be signed in to change notification settings - Fork 0
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
Import UVL File #5
Conversation
Import still missing
If it is just the root that is missing its instance cardinality, then I would add [1,1] as its instance cardinality since it is defined to always be that. |
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.
Impressive set of changes. Here's a few general suggestions upfront:
- I'd recomment following the python naming convention. i.e. snake_case for all functions, methods, and variables
- In case you have an assignment expression like
a: A = A()
, the type ofa
can already be inferred and does not need a type annotation (i.e.a = A()
is fully sufficient, but less verbose)
Yes you are right @DoctorJohn i tried changing as much as possible, but unfortunately i cannot change the Listener and the Error class, because they inherit from the classes inside of the uvlparser/antlr4 package. And for whatever reason, they are in the Java style, because antlr4 created them, even though it is not the typical Python naming scheme:( |
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.
I just noticed I had a pending review with some minor suggestions.
self.constraints.append( | ||
Constraint( | ||
True, | ||
self.feature_map[ref_1], | ||
Cardinality([Interval(1, None)]), | ||
self.feature_map[ref_2], | ||
Cardinality([Interval(1, None)]), | ||
) | ||
) | ||
self.constraints.append( | ||
Constraint( | ||
True, | ||
self.feature_map[ref_2], | ||
Cardinality([Interval(1, None)]), | ||
self.feature_map[ref_1], | ||
Cardinality([Interval(1, None)]), | ||
) | ||
) |
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.
self.constraints.append( | |
Constraint( | |
True, | |
self.feature_map[ref_1], | |
Cardinality([Interval(1, None)]), | |
self.feature_map[ref_2], | |
Cardinality([Interval(1, None)]), | |
) | |
) | |
self.constraints.append( | |
Constraint( | |
True, | |
self.feature_map[ref_2], | |
Cardinality([Interval(1, None)]), | |
self.feature_map[ref_1], | |
Cardinality([Interval(1, None)]), | |
) | |
) | |
self.constraints.extend([ | |
Constraint( | |
True, | |
self.feature_map[ref_1], | |
Cardinality([Interval(1, None)]), | |
self.feature_map[ref_2], | |
Cardinality([Interval(1, None)]), | |
), | |
Constraint( | |
True, | |
self.feature_map[ref_2], | |
Cardinality([Interval(1, None)]), | |
self.feature_map[ref_1], | |
Cardinality([Interval(1, None)]), | |
) | |
]) |
if len(self.features) > 0: | ||
self.features[0].instance_cardinality = Cardinality([Interval(1, 1)]) | ||
|
||
def exitFeature(self, ctx: UVLPythonParser.FeatureContext): |
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.
This method is currently overly complex, but we can work on it in a separate PR. For now it'll most useful to merge these changes so that they can serve as a basis for the UVL export.
Ability to import .uvl files
@DanielZhangDP it seems like the random-sampling option throws an error when i try to run it with my example. The created model does not have an instance_cardinality on the top level, so your code throws an IndexError. We need to talk about that, if you need to change something or if I need to change something:)