Conversation
- Also moved clearing of caches to ElementUtil.transformAll.
- Changed messages in APIS_transfer_interface into flows, because messages between interface end ports was semantically incorrect and now violated validateSubsettingConstantConformance.
- Also updated for proper KerML and SysML keywords. - Results in no actual change to SysML.sysml over updates already done for ST6RI-827.
- Removes need to clear caches for distinguishibility check.
|
I started my review and I found the example below got an error of "Cannot override a binding feature value." Is that correct validation? Note that the error disappeared when |
|
Also I felt strange that the example below was not marked as an error: while gets an error of "Initialized feature must be variable." |
This is correct. This is an existing validation that is not actually changed by this PR: A non-default feature value cannot be overridden, whether it is initial or not. The validation check does check to see if the overriding value is consistent with the original value, because this would, in general, require arbitrary expression computation -- i.e., it could not generally be checked statically. |
This is also correct. A non-variable feature is not the same as a constant feature. Odd as it may seem, any feature with On the other hand, a feature that is not variable cannot have an "initial" value. This is because the semantics of "initial value" is that it is the value of the feature on the starting snapshot of its owning type. So, for this to make sense, the feature must have |
|
Thank you. So in my understanding, |
|
I think I tested most of the pattern. May I ask one more question? Currently we do not get an error with the example below. I think it is not semantically correct but the current validator does not check it. Is that a correct understanding? |
I am afraid I really don't understand your description of your understanding. Indeed, the temporal semantics of But, also by intent, this is all largely hidden for SysML modelers, for which temporal modeling remains intuitively much like it was in SysML v1 and UML. The compromise is that SysML modelers then have to largely use constructs formally specified at the KerML level to model temporal relationships (like succession, etc.). |
Yes, the current validation is simply that a default feature value can be overridden, but a non-default one cannot. Now, the time of the snapshot in your model is not given, it is possible that it is the start snapshot, in which case it would override the default without any semantic inconsistency. Or it could be generally deduced that the the declaration in the snapshot implies that the attribute has to have value 3 for all other snapshots, too, overriding the default. But, really, this is again something that probably will have to be detected at "run time". I think we will need to work it out as we complete the description of execution semantics. |
I think I understand your intent. I agree that KerML is a modeling language and more or less is designed to capture the meta level of execution semantics, in contrast, the typical programming languages represent executions themselves. Still,
I agree on this. Typical users do not need to care about these because they exist only in KerML. |
Thank you for your answer. That helps me a lot to understand it. |
TheKorpos
left a comment
There was a problem hiding this comment.
I've done some testing in Eclipse and everything seems to work as described. I've taken a glance at the code too. Apart from two super minor typos everything looks good.
org.omg.sysml/src/org/omg/sysml/adapter/SuccessionAsUsageAdapter.java
Outdated
Show resolved
Hide resolved
org.omg.sysml/src/org/omg/sysml/adapter/ElementAdapterFactory.java
Outdated
Show resolved
Hide resolved
|
@TheKorpos The problem is not with this branch, because I can't regenerate the SysML parser on master, either. The problem seems to come from the addition of the optional global qualification to qualified names on branch ST6RI-830. Commit c15a0d7 says that you "Re-generated sysml xtext infrastructure". But, if I check out that commit, I cannot reproduce the generation -- I get an out-of-memory error (and strange grammar warning messages). I have tried increasing the heap space considerably, with no luck. Did you have to do anything special to get the SysML parser generation to complete? Are you able to regenerate the parser on master? Note that the problem isn't the parser splitter, because your "count" update is in place (and, anyway, the error seems to happen before the splitting). |
@seidewitz Update: master works with 10gigs |
I had previously only tried up to 8G. Before I saw your update, I got it to work with 12G. This grammar is really getting out of hand, but w can go with this for now! |
This PR implements resolutions to the following issues, as approved in KerML FTF2 Ballot 5 and SysML v2 FTF 2 Ballot 7:
KerML
Semantics
The resolution to KERML_-57 introduces the concept of "variable features", which are features of occurrences whose values may vary over time. This is specified semantically by making the domain of a variable feature (i.e., its featuring type) the snapshots of its owning type, rather the owning type itself. Therefore, a variable feature can have different values on different snapshots of an occurrence, effectively "varying over time". The multiplicity of a variable feature is relative to each snapshot, rather than to the life of the occurrence.
Abstract Syntax
Updates to the abstract syntax to achieve these semantics include the following.
isVariabletoFeature. (isReadonlyis renamed toisConstant.)Featuringsuperclass ofFeatureMembershipandTypeFeaturing. Instead ofFeatureMembershipbeing a kind ofFeaturing, it impliesTypeFeaturingin two different cases.isVariable = false, thenFeatureMembershipimplies aTypeFeaturingrelationship from itsownedMemberFeatureto itsowningType. This duplicates the current semantics forFeatureMembership.isVariable = true, thenFeatureMembershipimplies aTypeFeaturingrelationship from itsownedMemberFeatureto aFeaturerepresenting thesnapshotsof itsowningType. ThisFeatureis anownedRelatedElementof the impliedTypeFeaturing, and it is constructed to redefineOccurrences::Occurrence::snapshotsand be featured by theowningTypeof theFeatureMembership. This achieves the semantics of variable features.isCompatibleWithtoTypeandFeature. For a non-FeatureType,isCompatibleWithis the same asspecializes. AFeature, however,isCompatibleWithanotherFeaturenot only if itspecializesthe otherFeature, but also if the twoFeatureshave a commonredefinedFeatureand the firstFeatureis accessible from afeaturingTypeof the otherFeature. This allows thesnapshotsfeaturingTypeof one variableFeatureto be considered to semantically specialize the similarfeaturingTypeof another variableFeature, for the purposes of validation, without there having to be an actualSpecializationrelationship between them.validateFeatureConstantIsVariable– A constant feature must be variable.validateFeatureEndIsConstant– A variable end feature must be constant.validateFeatureEndNoDirection– An end feature must have no direction.validateFeatureEndNotDerivedAbstractCompositeOrPortion- An end feature must not be derived, abstract, composite or a portion.validateFeatureIsVariable– A variable feature must be a feature of an occurrence type.validateFeaturePortionNotVariable– A portion feature must not be variable.validateSubsettingConstantConformance– A variable feature must be constant if it subsets a constant feature.validateFeatureValueIsInitial– A feature must be variable to have an initial feature value.Note
Problems found during implementation resulted in the following variations from the resolution to KERML_-57. These have been documented in issue KERML_-224, the resolution of which is currently under review by the KerML FTF2.
validateSubsettingConstantConformance– Implemented the validation to apply only if thesubsettedFeatureis constant and thesubsettingFeatureis variable.validateSubsettingPortionConformance– Did not implement the validation.validateRedefinitionDirectionConformance– Revised the implementation so that, if theredefiningFeatureis variable, itsowningTypeis used instead of itsfeaturingType.validateRedefinitionFeaturingType– Revised the implementation so that, if theredefiningTypeand/or theredefinedTypeare variable, then theirowningTypeis used instead of theirfeaturingTypes.Concrete Syntax
A variable feature is notated in the concrete syntax using the new keyword
var.A feature that is specified as variable can, nevertheless, be further specified as constant using the keyword
const(instead ofvar), meaning that it does not actually change its value over the duration of its featuring occurrence (this replaces the previous concept ofreadonly). This can be useful for asserting that a feature has values that are the same over only some of the time an occurrence exists, even though it could potentially vary at other times.The end features of an association structure may also be declared as constant features by placing the keyword
constbefore the keywordend. Whether or not an end feature is declared as constant, its value cannot change for the lifetime of an instance of the owning association structure. However, a constant end feature may subset or redefine a variable feature, while a regular end feature cannot.In addition, the required ordering of the prefix keywords on a feature is changed so that
derivedmust appear before any ofabstract,composite,portion,var, orconst(but after any direction keyword).Model Libraries
Semantic Model Library
readonly.Clocks– Addvarto the declarations ofClock::currentTimeandBasicClock::currentTime.Occurrences– Add a default value ofselftoOccurrence::portionOfLife.SysML
Semantics
In SysML models, it is already expected that features of occurrences can change over time, particularly for structural occurrences like items and parts. For example, if a
Vehicleis modeled as having anenginewith multiplicity1..1, then the expectation is that any individualVehiclehas exactly oneengineat any point in time, but may have differentenginesover time. Therefore, the resolution to SYSML2_-510 makes a feature of an occurrence definition or usage automatically able to vary in time, except for the following kinds of features, which, instead, have values relative to the entire duration of the featuring occurrence:Abstract Syntax
Updates to the SysML abstract syntax in order to formalize these expected semantics include:
mayTimeVarytoUsage, redefining the propertyFeature::isVariablefrom KerML to make it derived. In this way, owned features ofOccurrenceDefinitionsandOccurrencesUsageswill, when appropriate, automatically have the expected variable feature semantics, without it having to be explicitly declared by the modeler (as it is in KerML).checkUsageVariationUsageTypeFeaturingrequiring that a variant usage have the same featuring types as an owning variation usage, which is particularly important if the owning usage may time vary.validateAssignmentActionUsage, requiring the target of an assignment action to be time-varying.Concrete Syntax
Since whether a feature may time vary is determined automatically, there is no keyword in SysML corresponding to
varin KerML. However, a feature that would otherwise be allowed to vary in time may be declared to nevertheless have a constant value using theconstantkeyword (which replaces the previousreadonlykeyword). Such a feature must have the same value over the entire duration of a featuring occurrence.The
constantkeyword cannot be used on an end feature in SysML. However, any end feature that hasmayTimeVary = trueis also required to automatically haveisConstant = true.As for KerML, the required ordering of the prefix keywords on a usage is changed so that
derivedmust appear before any ofabstract,variation,constant, orref(but after any direction keyword).Note
There is an inconsistency in the Beta 3 specification in which the textual notation grammar does not allow both the
variationandconstantkeywords on a usage declaration, even though it is allowable in the abstract syntax and semantics for a usage to haveisVariation = trueandisConstant = true. This inconsistency is documented in issue SYSML2_-801, the resolution of which is currently under review by the SysML v2 FTF2. As proposed in this resolution, the implementation in this PR does allow a usage to be both avariationand aconstant.Model Libraries
Cause and Effect Domain Library
CausationConnections– Addabstract constantto the declarations ofMulticausation::causesandeffects.CausationConnections– Change the end features ofCausation(which are now automatically constant) to subset rather than redefinecausesandeffects.