SysMLConnector
Commit
commit change set to the SysML server
Calling Sequence
Parameters
Returns
Description
Examples
Commit(s, cs)
s
-
string; commit message
cs
(optional) change set; default: the internally cached change set
sequence b, r of two elements, where
b : truefalse; flag indicating whether the commit was successful.
r : posint; new revision number
If the change set is empty, then b=true and r is the current revision.
The Commit(s,cs) calling sequence commits all changes in the change set cs to the SysML server in one atomic transaction. If cs is not specified, the internally cached change set is used. It returns a truefalse flag indicating success, and the new revision number on the server.
Currently the supported changes are for the numeric values of Value Properties or Slots (see PutValue), or the constraint relations for Constraint Blocks (see PutConstraint).
The commit is successful if all elements of the change set contain valid changes (e.g., none of the model elements to be changed has been deleted on the server) and the revision on the server has not changed since the initial Connect call, i.e., no other changes were committed since then. In this case, the internally stored revision number will be updated to the new revision, and cs will be reset to the empty change set.
An error is raised if the head revision on the server is different from the one that was obtained with the initial Connect call. This can happen for two reasons: either the Connect was deliberately made to an older revision, or another commit, typically by a different user, has happened since the initial Connect.
In order to preserve the change set in cases when another commit may have happened on the server since the initial Connect, it is recommended to record all changes not in the internal change set but in an explicitly specified change set that is maintained by the user, since the internal change set is cleared automatically by a Connect call to a newer revision. It is the responsiblity of the user in that case to verify that the change set is still valid for the newer revision, e.g., there were no changes in the newer revision that conflict with ones from the user's change set.
If the commit is successful and no other commits were detected, the changes from cs will be applied to all locally cached model elements as well. Otherwise, if another commit has happened shortly before or after this Commit call, then the internal cache will be cleared.
If the commit is not successful, then upon return cs contains all changes that were not committed, e.g., corresponding to model elements that do not exist on the server.
Use of this command requires an active server connection, using the Connect command. If such a connection does not exist, an error will be raised.
with⁡SysMLConnector
ClearChangeSet,Commit,Connect,GetBinding,GetChildren,GetConstraint,GetInstances,GetSlots,GetValue,Login,Logout,PrintChangeSet,PrintElement,PutConstraint,PutValue,QualifiedNameOf,QueryModel,Warnlevel
Login⁡https://twc.mycompany.com:8111/,user=alice,password=a%5Wr^Xt0p@2
Connect⁡JMPTWCSysML:
Query the current value of the Value Property PR_fan in the Analysis Block.
PR_fan≔QueryModel⁡Model-Turbofan::System Breakdown::System Structure::Analysis Block::PR_fan
PR_fan≔d478980a-4ab8-4693-b4af-c1d136b33423,uml:Property,ValueProperty,PR_fan
GetValue⁡PR_fan3
PR_fan=1.5,1
Change the value of PR_fan, using a user-specified change set.
cs≔table⁡:
PutValue⁡PR_fan3,1.2,cs
Query the current equation of the Temperature at exit Constraint Block in the Constraints package.
GetConstraint⁡Model-Turbofan::Constraints::Temperature at exit
Temperature at exit=T0tt=T0t+deltaT
Set a new value for this constraint equation.
PutConstraint⁡Model-Turbofan::Constraints::Temperature at exit,T0tt=T0t,cs
Review the current changes.
PrintChangeSet⁡cs
502a4da2-d9c3-4585-908e-484772a0051f (Temperature at exit): body = ["T0tt = T0t"] (["T0tt = T0t + deltaT"])
c5bf0b87-1c3f-42db-8862-ab4155b05e5d (PR_fan): value = "1.2" ("1.5")
Commit the change set.
Commit⁡Updated PR_fan and Temperature at exit,cs
true,31
Note that the change set has been cleared.
Also, the internally cached model elements have been updated.
PrintElement⁡502a4da2-d9c3-4585-908e-484772a0051f
"ID" = "_19_0_3_8970276_1591124299670_346644_24803" "body" = [1 = "T0tt = T0t"] "name" = "" "owner" = [1 = {"@id" = "ad7c35e5-ed4a-43a3-bb6e-dd40720e8768"}] "owningConstraint" = {"@id" = "ad7c35e5-ed4a-43a3-bb6e-dd40720e8768"} "visibility__from_PackageableElement" = "public"
Logout⁡
See Also
Connect
PrintChangeSet
PutConstraint
PutValue
QueryModel
Download Help Document