-
Notifications
You must be signed in to change notification settings - Fork 2
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
TGG editor: Insufficient validation for node types for refined rules #73
Comments
Any progress? Have you been able to reproduce with a concrete example? |
For the GT part a check for this has been implemented:
|
I was unable to reproduce the problem. I've tested this using the BenchmarxFamiliesToPersons TGG test project: As far as I understand it, this refinement shouldn't be valid, but it appears to work fine regardless. Am I misunderstanding the issue? |
I should note that I had to add some max-rule-counts to the |
No not at all. |
Hmm... this is a difficult question/decision. I think the easiest answer is that Male should not be able to override Female in a refinement, as it is not a subclass. The argument for this is that arbitrary overriding would require checking all possible links attached to the node. Overriding only with subclasses is automatically safe in this regard. Allowing arbitrary overriding would be flexible, but also a bit "dirty": for example, it would work for some time, but suddenly stop working as soon as a forbidden link is added in the rule. So I would vote for forbidding this (even if it limits specification freedom a bit). What do you think? |
I agree that only subclasses should be allowed, especially since this conforms to the intuitive understanding of inheritance/refinement. This aside, the description of this issue mentions that transformations fail with a corresponding error output to the console. This was not the case for me, which leaves me somewhat uncertain as to whether I'm understanding correctly what the issue exactly is. |
Apparently some recent changes have made things more robust... so all that is needed here is a validation rule in the xtext editor with a useful error message. I’m sure enough that we understand the issue correctly. |
If I'm seeing this right, it should be sufficient to check each rule's source and target patterns against the patterns of the rule's supertypes (recursively, not just against the direct supertype). |
@LegionaryCohort Have you seen the tips provided by @patrickrobrecht above? You might be able to just adapt the code to the case of TGGs... |
Please also check if this issue is not very much related to: eMoflon/emoflon-ibex#369 |
I've already looked at the code in the GTValidator. I'm expecting the code for TGGs to end up looking very similar, but the GT code uses some utility methods that don't exist for TGGs as far as I can tell. As for the other issue, as far as I can tell they are certainly related, but still seperate issues. If I'm understanding the other Issue correctly, it's dealing with a diamond problem caused by being able to refine multiple rules. This Issue on the other hand is a much more basic type-checking problem. |
As far as I can tell the issues are one and the same - our refinement flattening Code first combines all super rules with the current rule, and then picks out a clear subtype from all candidates (with the same name). If this candidate is not unique, we should complain and list all conflicting candidates. I think the other issue would be solved by this as well. But just start somewhere and yell if you can’t make any progress. |
All right, given the additional knowledge about how the refinements are flattened, you've convinced me that they are indeed pretty much the same. As discussed in Slack, I'll put this issue on hold for now. |
Example:
Super rules: Declared node
p: Person
andp: Female
Refined rules:
p: Male
does not show an error in the editor (but transformations fail which is written on the console).The text was updated successfully, but these errors were encountered: