Repository: ikmdev/komet
Pull request #391: Feature/finished/iia 1396 create semantic submit capture ref component
Author: login: dholubek
Created: 2025-04-21T15:35:26Z | Merged: 2025-04-21T20:58:28Z

This doesn't fully address submit, as their is a bug in tinkar-core (we believe) that prevents changing the reference component during uncommitted (and also committed) saves.

What this does address is consolidating the ViewModel into one shared viewModel...

(still a bug in tinkar-core that the ref component isn't updated here on save)
![image](https://github.com/user-attachments/assets/6fb0b8a7-3f7f-4ac9-ae75-fedb94168451)

(outside of the ref component, the submit does work)
![image](https://github.com/user-attachments/assets/b954c7bf-0d98-4b78-b53b-dccde4cec015)

(and this shows in classic Komet)
![image](https://github.com/user-attachments/assets/b687a78c-7e18-47c2-8322-054e4b4e994e)

(real change here  -to unblock other tickets- is to consolidate the viewModel)
![image](https://github.com/user-attachments/assets/616f6524-97c7-4b15-9e12-8bc21ab57834)





Diff:
diff --git a/kview/src/main/java/dev/ikm/komet/kview/mvvm/model/DataModelHelper.java b/kview/src/main/java/dev/ikm/komet/kview/mvvm/model/DataModelHelper.java
index 867dbd0e1..bd5dfbbed 100644
--- a/kview/src/main/java/dev/ikm/komet/kview/mvvm/model/DataModelHelper.java
+++ b/kview/src/main/java/dev/ikm/komet/kview/mvvm/model/DataModelHelper.java
@@ -32,7 +32,6 @@
 import static dev.ikm.tinkar.terms.TinkarTerm.INSTANT_LITERAL;
 import static dev.ikm.tinkar.terms.TinkarTerm.INTEGER_FIELD;
 import static dev.ikm.tinkar.terms.TinkarTerm.LONG;
-import static dev.ikm.tinkar.terms.TinkarTerm.PREFERRED;
 import static dev.ikm.tinkar.terms.TinkarTerm.REGULAR_NAME_DESCRIPTION_TYPE;
 import static dev.ikm.tinkar.terms.TinkarTerm.SEMANTIC_FIELD_TYPE;
 import static dev.ikm.tinkar.terms.TinkarTerm.STRING;
@@ -46,6 +45,7 @@
 import dev.ikm.komet.framework.observable.ObservableSemanticVersion;
 import dev.ikm.komet.framework.view.ViewProperties;
 import dev.ikm.komet.kview.events.pattern.PatternCreationEvent;
+import dev.ikm.komet.kview.klfields.KlFieldHelper;
 import dev.ikm.tinkar.common.id.IntIdSet;
 import dev.ikm.tinkar.common.id.IntIds;
 import dev.ikm.tinkar.common.id.PublicId;
@@ -55,7 +55,6 @@
 import dev.ikm.tinkar.composer.Composer;
 import dev.ikm.tinkar.composer.Session;
 import dev.ikm.tinkar.composer.assembler.SemanticAssembler;
-import dev.ikm.tinkar.composer.template.USDialect;
 import dev.ikm.tinkar.coordinate.Calculators;
 import dev.ikm.tinkar.coordinate.edit.EditCoordinate;
 import dev.ikm.tinkar.coordinate.edit.EditCoordinateRecord;
@@ -353,24 +352,14 @@ public static ObservableField<?> obtainObservableField(ViewProperties viewProper
      * @param pattern existing pattern
      * @return a default, empty semantic
      */
-    public static EntityFacade createEmptySemantic(ViewProperties viewProperties, EntityFacade pattern) {
+    public static EntityFacade createEmptySemantic(ViewProperties viewProperties, EntityFacade pattern, Session session) {
+
         EntityFacade semantic;
-        // set up defaults for the initial STAMP on a new Semantic
-        State status = State.ACTIVE;
-        EntityProxy.Concept author = TinkarTerm.USER;
-        EntityProxy.Concept module = TinkarTerm.DEVELOPMENT_MODULE;
-        EntityProxy.Concept path = TinkarTerm.DEVELOPMENT_PATH;
         EntityProxy patternProxy = pattern.toProxy();
 
-
         ViewCalculator viewCalculator = viewProperties.calculator();
         PatternVersionRecord patternVersionRecord = (PatternVersionRecord) viewCalculator.latest(pattern).get();
 
-        // create empty semantic using the Composer API
-        EntityService.get().beginLoadPhase();
-        Composer composer = new Composer("Semantic for %s".formatted(pattern.description()));
-        Session session = composer.open(status, author, module, path);
-
         EntityProxy.Semantic defaultSemantic = EntityProxy.Semantic.make(PublicIds.newRandom());
         session.compose((SemanticAssembler semanticAssembler) -> {
             semanticAssembler
@@ -397,13 +386,45 @@ public static EntityFacade createEmptySemantic(ViewProperties viewProperties, En
                                 fieldValues.with(IntIds.set.empty());
                             }
                         });
-                    }).attach((USDialect dialect) -> dialect
-                            .acceptability(PREFERRED));
+                    });
         });
         // don't commit yet; only commit once the user is ready to submit and not change the reference component
-        EntityService.get().endLoadPhase();
         semantic = defaultSemantic.toProxy();
         return semantic;
     }
 
+    /**
+     * write the semantic
+     * @param viewProperties viewProperties
+     * @param pattern pattern
+     * @param semantic the semantic
+     * @param refComponent the semantic's reference component
+     * @param composer shared composer
+     * @return
+     */
+    public static EntityFacade saveSemantic(ViewProperties viewProperties, EntityFacade pattern,
+                                            EntityFacade semantic,
+                                            EntityProxy refComponent,
+                                            Composer composer,
+                                            Session session,
+                                            boolean commitFlag) {
+        EntityProxy patternProxy = pattern.toProxy();
+        Latest<SemanticEntityVersion> semanticEntityVersionLatest = KlFieldHelper.retrieveCommittedLatestVersion(semantic, viewProperties);
+        session.compose((SemanticAssembler semanticAssembler) -> {
+                    semanticAssembler
+                            .semantic(semantic.toProxy())
+                            // assign the reference component
+                            .reference(refComponent)
+                            .pattern((EntityProxy.Pattern) patternProxy)
+                            .fieldValues((fields) -> {
+                                        fields.clear();
+                                        semanticEntityVersionLatest.get().fieldValues().forEach(field -> fields.add(field));
+                            });
+                });
+        if (commitFlag) {
+            composer.commitSession(session);
+        }
+        return semantic;
+    }
+
 }
diff --git a/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/GenEditingDetailsController.java b/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/GenEditingDetailsController.java
index 8ffc8e6c0..30fe46ad5 100644
--- a/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/GenEditingDetailsController.java
+++ b/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/GenEditingDetailsController.java
@@ -33,9 +33,12 @@
 import static dev.ikm.komet.kview.mvvm.viewmodel.FormViewModel.EDIT;
 import static dev.ikm.komet.kview.mvvm.viewmodel.FormViewModel.MODE;
 import static dev.ikm.komet.kview.mvvm.viewmodel.FormViewModel.VIEW_PROPERTIES;
+import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.COMPOSER;
 import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.PATTERN;
 import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.REF_COMPONENT;
 import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.SEMANTIC;
+import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.SESSION;
+import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.STAMP_VIEW_MODEL;
 import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.WINDOW_TOPIC;
 import static dev.ikm.komet.kview.mvvm.viewmodel.StampViewModel.PATHS_PROPERTY;
 import static dev.ikm.tinkar.coordinate.stamp.StampFields.AUTHOR;
@@ -59,6 +62,8 @@
 import dev.ikm.komet.kview.mvvm.view.stamp.StampEditController;
 import dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel;
 import dev.ikm.komet.kview.mvvm.viewmodel.StampViewModel;
+import dev.ikm.tinkar.composer.Composer;
+import dev.ikm.tinkar.composer.Session;
 import dev.ikm.tinkar.coordinate.language.calculator.LanguageCalculator;
 import dev.ikm.tinkar.coordinate.stamp.calculator.Latest;
 import dev.ikm.tinkar.coordinate.stamp.calculator.StampCalculator;
@@ -67,7 +72,6 @@
 import dev.ikm.tinkar.entity.EntityVersion;
 import dev.ikm.tinkar.entity.PatternEntityVersion;
 import dev.ikm.tinkar.entity.PatternVersionRecord;
-import dev.ikm.tinkar.entity.SemanticEntity;
 import dev.ikm.tinkar.entity.SemanticEntityVersion;
 import dev.ikm.tinkar.entity.StampEntity;
 import dev.ikm.tinkar.terms.ConceptFacade;
@@ -75,6 +79,7 @@
 import dev.ikm.tinkar.terms.PatternFacade;
 import dev.ikm.tinkar.terms.SemanticFacade;
 import dev.ikm.tinkar.terms.State;
+import dev.ikm.tinkar.terms.TinkarTerm;
 import javafx.beans.property.ObjectProperty;
 import javafx.event.ActionEvent;
 import javafx.fxml.FXML;
@@ -209,14 +214,28 @@ private void initialize() {
         // clear all semantic details.
         semanticDetailsVBox.getChildren().clear();
         EntityFacade semantic = genEditingViewModel.getPropertyValue(SEMANTIC);
+        Composer composer = new Composer("Semantic composer");
+        genEditingViewModel.setPropertyValue(COMPOSER, composer);
 
         // if the semantic is null, then we generate a default one
         if (semantic == null) {
             genEditingViewModel.setPropertyValue(MODE, CREATE);
             EntityFacade pattern = genEditingViewModel.getPropertyValue(PATTERN);
 
+            StampViewModel defaultStampViewModel = new StampViewModel();
+            defaultStampViewModel.setPropertyValue(STATUS, State.ACTIVE);
+            defaultStampViewModel.setPropertyValue(AUTHOR, TinkarTerm.USER);
+            defaultStampViewModel.setPropertyValue(MODULE, TinkarTerm.DEVELOPMENT_MODULE);
+            defaultStampViewModel.setPropertyValue(PATH, TinkarTerm.DEVELOPMENT_PATH);
+            Session session = composer.open(State.ACTIVE, TinkarTerm.USER, TinkarTerm.DEVELOPMENT_MODULE, TinkarTerm.DEVELOPMENT_PATH);
+            defaultStampViewModel.save();
+
+            genEditingViewModel.setPropertyValue(STAMP_VIEW_MODEL, defaultStampViewModel);
+
             // create empty semantic for the pattern and set it in the view model
-            semantic = DataModelHelper.createEmptySemantic(getViewProperties(), pattern);
+            genEditingViewModel.setPropertyValue(SESSION, session);
+            semantic = DataModelHelper.createEmptySemantic(getViewProperties(), pattern,session);
+
             genEditingViewModel.setPropertyValue(SEMANTIC, semantic);
         } else {
             genEditingViewModel.setPropertyValue(MODE, EDIT);
@@ -297,7 +316,9 @@ private void initialize() {
                         //}
                     }
                 }
-            }
+            } /*else if (evt.getEventType() == REFERENCE_COMPONENT_CHANGED_EVENT) {
+                setupReferenceComponentUI(semanticEntityVersionLatest);
+            }*/
         };
         EvtBusFactory.getDefaultEvtBus().subscribe(genEditingViewModel.getPropertyValue(CURRENT_JOURNAL_WINDOW_TOPIC),
                 GenEditingEvent.class, refreshSubscriber);
@@ -404,8 +425,12 @@ private void setupReferenceComponentUI(Latest<SemanticEntityVersion> semanticEnt
         addReferenceButton.setDisable(refComponent != null);
 
         Consumer<EntityFacade> updateRefComponentInfo = (refComponent2) -> {
+            if (refComponent2 == null) {
+                return;
+            }
+            EntityFacade entityFacade = EntityService.get().getEntityFast(refComponent2.nid());
             // update items
-            String refType = switch (refComponent2) {
+            String refType = switch (entityFacade) {
                 case ConceptFacade ignored -> "Concept";
                 case SemanticFacade ignored -> "Semantic";
                 case PatternFacade ignored -> "Pattern";
@@ -427,7 +452,7 @@ private void setupReferenceComponentUI(Latest<SemanticEntityVersion> semanticEnt
         if (refComponent == null) {
             if (semanticEntityVersionLatest != null) {
                 semanticEntityVersionLatest.ifPresent(semanticEntityVersion -> {
-                    refComponentProp.set(semanticEntityVersion.referencedComponent());
+                    refComponentProp.set(semanticEntityVersion.referencedComponent().toProxy());
                 });
             }
         } else {
@@ -442,14 +467,7 @@ private void setupProperties() {
         // Setup Property screen bump out
         // Load Concept Properties View Panel (FXML & Controller)
         Config config = new Config(GENEDITING_PROPERTIES_VIEW_FXML_URL)
-                .updateViewModel("propertiesViewModel", (propertiesViewModel) -> propertiesViewModel
-                        .setPropertyValue(CURRENT_JOURNAL_WINDOW_TOPIC, genEditingViewModel.getPropertyValue(CURRENT_JOURNAL_WINDOW_TOPIC))
-                        .setPropertyValue(WINDOW_TOPIC, genEditingViewModel.getPropertyValue(WINDOW_TOPIC))
-                        .setPropertyValue(VIEW_PROPERTIES, genEditingViewModel.getPropertyValue(VIEW_PROPERTIES))
-                        .setPropertyValue(SEMANTIC, genEditingViewModel.getPropertyValue(SEMANTIC))
-                        .setPropertyValue(REF_COMPONENT, genEditingViewModel.getPropertyValue(REF_COMPONENT))
-
-                );
+                .addNamedViewModel(new NamedVm("genEditingViewModel", genEditingViewModel));
 
         JFXNode<BorderPane, PropertiesController> propsFXMLLoader = FXMLMvvmLoader.make(config);
         this.propertiesBorderPane = propsFXMLLoader.node();
diff --git a/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/PropertiesController.java b/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/PropertiesController.java
index 113bfb61f..bfd2f6f5a 100644
--- a/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/PropertiesController.java
+++ b/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/PropertiesController.java
@@ -76,7 +76,8 @@ public enum PaneProperties {
     private ClosePropertiesController closePropertiesController;
 
     @InjectViewModel
-    private SimpleViewModel propertiesViewModel;
+    private GenEditingViewModel genEditingViewModel;
+
 
     Subscriber<PropertyPanelEvent> showPanelSubscriber;
 
@@ -95,34 +96,20 @@ private void initialize() {
 
     //Refers to Add Reference Component
     private void setupShowReferencePanelHandlers() {
-        Config addReferenceConfig = new Config(this.getClass().getResource("reference-component.fxml"));
-        addReferenceConfig.updateViewModel("referenceComponentViewModel", (referenceComponentViewModel) -> {
-            referenceComponentViewModel
-                    .addProperty(CURRENT_JOURNAL_WINDOW_TOPIC, propertiesViewModel.getObjectProperty(CURRENT_JOURNAL_WINDOW_TOPIC))
-                    .addProperty(WINDOW_TOPIC, propertiesViewModel.getObjectProperty(WINDOW_TOPIC))
-                    .addProperty(VIEW_PROPERTIES, propertiesViewModel.getObjectProperty(VIEW_PROPERTIES))
-                    .addProperty(SEMANTIC, propertiesViewModel.getObjectProperty(SEMANTIC))
-                    .addProperty(REF_COMPONENT, propertiesViewModel.getObjectProperty(REF_COMPONENT))
-                    .addProperty(FIELD_INDEX, -1);
-        });
+        Config addReferenceConfig = new Config(this.getClass().getResource("reference-component.fxml"))
+                .addNamedViewModel(new NamedVm("genEditingViewModel", genEditingViewModel));
         referenceComponentJfxNode = FXMLMvvmLoader.make(addReferenceConfig);
     }
 
     private void setupShowingPanelHandlers() {
-        Config config = new Config(this.getClass().getResource("semantic-edit-fields.fxml"));
-        config.updateViewModel("semanticFieldsViewModel", (semanticFieldsViewModel) -> {
-            semanticFieldsViewModel
-                    .addProperty(CURRENT_JOURNAL_WINDOW_TOPIC, propertiesViewModel.getObjectProperty(CURRENT_JOURNAL_WINDOW_TOPIC))
-                    .addProperty(WINDOW_TOPIC, propertiesViewModel.getObjectProperty(WINDOW_TOPIC))
-                    .addProperty(VIEW_PROPERTIES, propertiesViewModel.getObjectProperty(VIEW_PROPERTIES))
-                    .addProperty(SEMANTIC, propertiesViewModel.getObjectProperty(SEMANTIC))
-                    .addProperty(REF_COMPONENT, propertiesViewModel.getObjectProperty(REF_COMPONENT))
-                    .addProperty(FIELD_INDEX, -1);
-        });
+        Config config = new Config(this.getClass().getResource("semantic-edit-fields.fxml"))
+            .addNamedViewModel(new NamedVm("genEditingViewModel", genEditingViewModel));
+
         editFieldsJfxNode = FXMLMvvmLoader.make(config);
 
         Config closePropertiesConfig = new Config(this.getClass().getResource("close-properties.fxml"))
-                .addNamedViewModel(new NamedVm("propertiesViewModel", propertiesViewModel));
+                .addNamedViewModel(new NamedVm("genEditingViewModel", genEditingViewModel));
+
 
         JFXNode<Pane, ClosePropertiesController> closePropsJfxNode = FXMLMvvmLoader.make(closePropertiesConfig);
 
@@ -132,7 +119,7 @@ private void setupShowingPanelHandlers() {
             LOG.info("Publish event type: " + evt.getEventType());
             contentBorderPane.setCenter(closePropsJfxNode.node());
         };
-        EvtBusFactory.getDefaultEvtBus().subscribe(propertiesViewModel.getPropertyValue(CURRENT_JOURNAL_WINDOW_TOPIC),
+        EvtBusFactory.getDefaultEvtBus().subscribe(genEditingViewModel.getPropertyValue(CURRENT_JOURNAL_WINDOW_TOPIC),
                 GenEditingEvent.class, genEditingEventSubscriber);
 
         showPanelSubscriber = evt -> {
@@ -140,15 +127,15 @@ private void setupShowingPanelHandlers() {
             propertyToggleButtonGroup.selectToggle(addEditButton);
 
             ValidationViewModel semanticFieldsViewModel = (ValidationViewModel) editFieldsJfxNode
-                    .getViewModel("semanticFieldsViewModel").get();
+                    .getViewModel("genEditingViewModel").get();
             if (evt.getEventType() == PropertyPanelEvent.SHOW_EDIT_SEMANTIC_FIELDS) {
-                semanticFieldsViewModel.setPropertyValue(FIELD_INDEX, -1);
+                genEditingViewModel.setPropertyValue(FIELD_INDEX, -1);
                 contentBorderPane.setCenter(editFieldsJfxNode.node());
             } else if (evt.getEventType() == PropertyPanelEvent.SHOW_EDIT_SINGLE_SEMANTIC_FIELD) {
-                semanticFieldsViewModel.setPropertyValue(FIELD_INDEX, evt.getObservableFieldIndex());
+                genEditingViewModel.setPropertyValue(FIELD_INDEX, evt.getObservableFieldIndex());
                 contentBorderPane.setCenter(editFieldsJfxNode.node());
             } else if (evt.getEventType() == PropertyPanelEvent.SHOW_ADD_REFERENCE_SEMANTIC_FIELD) {
-                semanticFieldsViewModel.setPropertyValue(FIELD_INDEX, evt.getObservableFieldIndex());
+                genEditingViewModel.setPropertyValue(FIELD_INDEX, evt.getObservableFieldIndex());
                 contentBorderPane.setCenter(referenceComponentJfxNode.node());
             } else if (evt.getEventType() == PropertyPanelEvent.NO_SELECTION_MADE_PANEL) {
                 // change the heading on the top of the panel
@@ -157,7 +144,8 @@ private void setupShowingPanelHandlers() {
                 contentBorderPane.setCenter(closePropsPane);
             }
         };
-        EvtBusFactory.getDefaultEvtBus().subscribe(propertiesViewModel.getPropertyValue(WINDOW_TOPIC), PropertyPanelEvent.class, showPanelSubscriber);
+        EvtBusFactory.getDefaultEvtBus().subscribe(genEditingViewModel.getPropertyValue(WINDOW_TOPIC),
+                PropertyPanelEvent.class, showPanelSubscriber);
 
 
     }
diff --git a/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/ReferenceComponentController.java b/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/ReferenceComponentController.java
index cb12287de..ccbf49489 100644
--- a/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/ReferenceComponentController.java
+++ b/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/ReferenceComponentController.java
@@ -1,9 +1,22 @@
 package dev.ikm.komet.kview.mvvm.view.genediting;
 
 import static dev.ikm.komet.kview.mvvm.viewmodel.FormViewModel.VIEW_PROPERTIES;
+import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.COMPOSER;
+import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.PATTERN;
 import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.REF_COMPONENT;
+import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.SEMANTIC;
+import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.SESSION;
+import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.STAMP_VIEW_MODEL;
+import static dev.ikm.tinkar.coordinate.stamp.StampFields.AUTHOR;
+import static dev.ikm.tinkar.coordinate.stamp.StampFields.MODULE;
+import static dev.ikm.tinkar.coordinate.stamp.StampFields.PATH;
+import static dev.ikm.tinkar.coordinate.stamp.StampFields.STATUS;
 import dev.ikm.komet.framework.view.ViewProperties;
 import dev.ikm.komet.kview.controls.KLComponentControl;
+import dev.ikm.komet.kview.mvvm.model.DataModelHelper;
+import dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel;
+import dev.ikm.komet.kview.mvvm.viewmodel.StampViewModel;
+import dev.ikm.tinkar.terms.EntityFacade;
 import dev.ikm.tinkar.terms.EntityProxy;
 import javafx.beans.property.ObjectProperty;
 import javafx.event.ActionEvent;
@@ -11,7 +24,6 @@
 import javafx.scene.control.Button;
 import javafx.scene.layout.VBox;
 import org.carlfx.cognitive.loader.InjectViewModel;
-import org.carlfx.cognitive.viewmodel.ValidationViewModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -31,7 +43,7 @@ public class ReferenceComponentController {
     private Button submitButton;
 
     @InjectViewModel
-    private ValidationViewModel referenceComponentViewModel;
+    private GenEditingViewModel genEditingViewModel;
 
     @FXML
     private void initialize() {
@@ -41,14 +53,16 @@ private void initialize() {
         submitButton.setDisable(false);
         KLComponentControl componentControl = new KLComponentControl();
         componentControl.setTitle("Reference component");
-        ObjectProperty<EntityProxy> refComponentProperty = referenceComponentViewModel.getProperty(REF_COMPONENT);
-        refComponentProperty.bind(componentControl.entityProperty());
-        componentControl.setEntity(refComponentProperty.getValue());
+        ObjectProperty<EntityProxy> refComponentProperty = genEditingViewModel.getProperty(REF_COMPONENT);
+        //refComponentProperty.bind(componentControl.entityProperty());
+        componentControl.entityProperty().bindBidirectional(refComponentProperty);
+        //EntityProxy entityProxy = refComponentProperty.get().toProxy();
+        //componentControl.setEntity(entityProxy);
         referenceComponentVBox.getChildren().add(componentControl);
     }
 
     public ViewProperties getViewProperties() {
-        return referenceComponentViewModel.getPropertyValue(VIEW_PROPERTIES);
+        return genEditingViewModel.getPropertyValue(VIEW_PROPERTIES);
     }
 
     @FXML
@@ -65,6 +79,24 @@ private void clearForm(ActionEvent actionEvent) {
 
     @FXML
     public void submit(ActionEvent actionEvent) {
+        actionEvent.consume();
+        if (genEditingViewModel.getPropertyValue(REF_COMPONENT) != null) {
+            EntityFacade refComponent = genEditingViewModel.getPropertyValue(REF_COMPONENT);
+            EntityFacade semantic = genEditingViewModel.getPropertyValue(SEMANTIC);
+            EntityFacade pattern = genEditingViewModel.getPropertyValue(PATTERN);
+            StampViewModel stampViewModel = genEditingViewModel.getPropertyValue(STAMP_VIEW_MODEL);
+
+            semantic = DataModelHelper.saveSemantic(getViewProperties(),
+                    pattern,
+                    semantic, refComponent.toProxy(),
+                    genEditingViewModel.getPropertyValue(COMPOSER),
+                    genEditingViewModel.getPropertyValue(SESSION),
+                    false);
+            // replacing the semantic
+            genEditingViewModel.setPropertyValue(SEMANTIC, semantic.toProxy());
 
+            //TODO override call create method
+            genEditingViewModel.save();
+        }
     }
 }
diff --git a/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/SemanticFieldsController.java b/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/SemanticFieldsController.java
index 35edeaa81..068ea327b 100644
--- a/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/SemanticFieldsController.java
+++ b/kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/SemanticFieldsController.java
@@ -24,7 +24,16 @@
 import static dev.ikm.komet.kview.klfields.KlFieldHelper.retrieveCommittedLatestVersion;
 import static dev.ikm.komet.kview.mvvm.viewmodel.FormViewModel.CURRENT_JOURNAL_WINDOW_TOPIC;
 import static dev.ikm.komet.kview.mvvm.viewmodel.FormViewModel.VIEW_PROPERTIES;
+import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.COMPOSER;
+import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.PATTERN;
+import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.REF_COMPONENT;
 import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.SEMANTIC;
+import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.SESSION;
+import static dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel.STAMP_VIEW_MODEL;
+import static dev.ikm.tinkar.coordinate.stamp.StampFields.AUTHOR;
+import static dev.ikm.tinkar.coordinate.stamp.StampFields.MODULE;
+import static dev.ikm.tinkar.coordinate.stamp.StampFields.PATH;
+import static dev.ikm.tinkar.coordinate.stamp.StampFields.STATUS;
 import static dev.ikm.tinkar.provider.search.Indexer.FIELD_INDEX;
 import dev.ikm.komet.framework.events.EvtBusFactory;
 import dev.ikm.komet.framework.observable.ObservableField;
@@ -32,26 +41,23 @@
 import dev.ikm.komet.kview.events.genediting.GenEditingEvent;
 import dev.ikm.komet.kview.events.pattern.PatternCreationEvent;
 import dev.ikm.komet.kview.klfields.KlFieldHelper;
+import dev.ikm.komet.kview.mvvm.model.DataModelHelper;
+import dev.ikm.komet.kview.mvvm.viewmodel.GenEditingViewModel;
+import dev.ikm.komet.kview.mvvm.viewmodel.StampViewModel;
 import dev.ikm.tinkar.common.service.TinkExecutor;
 import dev.ikm.tinkar.coordinate.stamp.calculator.Latest;
 import dev.ikm.tinkar.coordinate.stamp.calculator.StampCalculator;
-import dev.ikm.tinkar.entity.Entity;
 import dev.ikm.tinkar.entity.SemanticEntityVersion;
-import dev.ikm.tinkar.entity.SemanticVersionRecord;
-import dev.ikm.tinkar.entity.StampRecord;
 import dev.ikm.tinkar.entity.transaction.CommitTransactionTask;
 import dev.ikm.tinkar.entity.transaction.Transaction;
 import dev.ikm.tinkar.terms.EntityFacade;
 import javafx.event.ActionEvent;
 import javafx.fxml.FXML;
 import javafx.scene.Node;
-import javafx.scene.control.Alert;
 import javafx.scene.control.Button;
-import javafx.scene.control.ButtonType;
 import javafx.scene.control.Separator;
 import javafx.scene.layout.VBox;
 import org.carlfx.cognitive.loader.InjectViewModel;
-import org.carlfx.cognitive.viewmodel.ValidationViewModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -75,7 +81,7 @@ public class SemanticFieldsController {
     private Button submitButton;
 
     @InjectViewModel
-    private ValidationViewModel semanticFieldsViewModel;
+    private GenEditingViewModel genEditingViewModel;
 
     private List<ObservableField<?>> observableFields = new ArrayList<>();
 
@@ -118,7 +124,7 @@ private boolean checkForEmptyFields() {
     }
 
     private void processCommittedValues() {
-        EntityFacade semantic = semanticFieldsViewModel.getPropertyValue(SEMANTIC);
+        EntityFacade semantic = genEditingViewModel.getPropertyValue(SEMANTIC);
         Latest<SemanticEntityVersion> semanticEntityVersionLatest = retrieveCommittedLatestVersion(semantic,getViewProperties());
         committedHash = generateHashValue(semanticEntityVersionLatest, getViewProperties());
     }
@@ -139,7 +145,8 @@ private void initialize() {
         editFieldsVBox.getChildren().clear();
         updateStampVersions = true;
         submitButton.setDisable(true);
-        EntityFacade semantic = semanticFieldsViewModel.getPropertyValue(SEMANTIC);
+        genEditingViewModel.save();
+        EntityFacade semantic = genEditingViewModel.getPropertyValue(SEMANTIC);
         if (semantic != null) {
             StampCalculator stampCalculator = getViewProperties().calculator().stampCalculator();
             Latest<SemanticEntityVersion> semanticEntityVersionLatest = stampCalculator.latest(semantic.nid());
@@ -175,7 +182,7 @@ private void initialize() {
         //  pencil icon and wants to edit all the fields
         // if the FIELD_INDEX is >= 0 then the user chose the context menu of a single field
         //  to edit that field
-        semanticFieldsViewModel.getObjectProperty(FIELD_INDEX).subscribe(fieldIndex -> {
+        genEditingViewModel.getObjectProperty(FIELD_INDEX).subscribe(fieldIndex -> {
             int fieldIdx = (int)fieldIndex;
             editFieldsVBox.getChildren().clear();
 
@@ -200,7 +207,7 @@ private void initialize() {
      * for each field and pick up the latest value for each contradiction?
      */
     private void updateStampVersionsNidsForAllFields() {
-        EntityFacade semantic = semanticFieldsViewModel.getPropertyValue(SEMANTIC);
+        EntityFacade semantic = genEditingViewModel.getPropertyValue(SEMANTIC);
         StampCalculator stampCalculator = getViewProperties().calculator().stampCalculator();
         Latest<SemanticEntityVersion> semanticEntityVersionLatest = stampCalculator.latest(semantic.nid());
         updateStampVersions = false;
@@ -221,7 +228,7 @@ private static Separator createSeparator() {
     }
 
     public ViewProperties getViewProperties() {
-        return semanticFieldsViewModel.getPropertyValue(VIEW_PROPERTIES);
+        return genEditingViewModel.getPropertyValue(VIEW_PROPERTIES);
     }
 
     @FXML
@@ -243,28 +250,27 @@ public void submit(ActionEvent actionEvent) {
         List<ObservableField<?>> list = new ArrayList<>(observableFields);
 
         //Get the semantic need to pass along with event for loading values across Opened Semantics.
-        EntityFacade semantic = semanticFieldsViewModel.getPropertyValue(SEMANTIC);
-        StampCalculator stampCalculator = getViewProperties().calculator().stampCalculator();
-        Latest<SemanticEntityVersion> semanticEntityVersionLatest = stampCalculator.latest(semantic.nid());
-        semanticEntityVersionLatest.ifPresent(semanticEntityVersion -> {
-            StampRecord stamp = Entity.getStamp(semanticEntityVersion.stampNid());
-            SemanticVersionRecord version = Entity.getVersionFast(semantic.nid(), stamp.nid());
-            Transaction.forVersion(version).ifPresentOrElse(transaction -> {
-                commitTransactionTask(transaction);
-                // EventBus implementation changes to refresh the details area if commit successful
-                EvtBusFactory.getDefaultEvtBus().publish(semanticFieldsViewModel.getPropertyValue(CURRENT_JOURNAL_WINDOW_TOPIC),
-                        new GenEditingEvent(actionEvent.getSource(), PUBLISH, list, semantic.nid()));
-                // refesh the pattern navigation
-                EvtBusFactory.getDefaultEvtBus().publish(SAVE_PATTERN_TOPIC,
-                        new PatternCreationEvent(actionEvent.getSource(), PATTERN_CREATION_EVENT));
-            }, () -> {
-                //TODO this is a temp alert / workaround till we figure how to reload transactions across multiple restarts of app.
-                LOG.error("Unable to commit: Transaction for the given version does not exist.");
-                Alert alert = new Alert(Alert.AlertType.ERROR, "Transaction for current changes does not exist.", ButtonType.OK);
-                alert.setHeaderText("Unable to Commit transaction.");
-                alert.showAndWait();
-            });
-        });
+        EntityFacade semantic = genEditingViewModel.getPropertyValue(SEMANTIC);
+
+        EntityFacade referenceComponent = genEditingViewModel.getPropertyValue(REF_COMPONENT);
+
+        EntityFacade pattern = genEditingViewModel.getPropertyValue(PATTERN);
+
+        // write the semantic
+        semantic = DataModelHelper.saveSemantic(getViewProperties(),
+                pattern,
+                semantic, referenceComponent.toProxy(),
+                genEditingViewModel.getPropertyValue(COMPOSER),
+                genEditingViewModel.getPropertyValue(SESSION),
+                true);
+
+        // EventBus implementation changes to refresh the details area if commit successful
+        EvtBusFactory.getDefaultEvtBus().publish(genEditingViewModel.getPropertyValue(CURRENT_JOURNAL_WINDOW_TOPIC),
+                new GenEditingEvent(actionEvent.getSource(), PUBLISH, list, semantic.nid()));
+        // refresh the pattern navigation
+        EvtBusFactory.getDefaultEvtBus().publish(SAVE_PATTERN_TOPIC,
+                new PatternCreationEvent(actionEvent.getSource(), PATTERN_CREATION_EVENT));
+
         processCommittedValues();
         enableDisableSubmitButton();
     }
diff --git a/kview/src/main/java/dev/ikm/komet/kview/mvvm/viewmodel/GenEditingViewModel.java b/kview/src/main/java/dev/ikm/komet/kview/mvvm/viewmodel/GenEditingViewModel.java
index 3d77b3f34..4ff9e7510 100644
--- a/kview/src/main/java/dev/ikm/komet/kview/mvvm/viewmodel/GenEditingViewModel.java
+++ b/kview/src/main/java/dev/ikm/komet/kview/mvvm/viewmodel/GenEditingViewModel.java
@@ -15,6 +15,7 @@
  */
 package dev.ikm.komet.kview.mvvm.viewmodel;
 
+import static dev.ikm.tinkar.provider.search.Indexer.FIELD_INDEX;
 import static dev.ikm.tinkar.terms.TinkarTerm.PREFERRED;
 import dev.ikm.komet.framework.view.ViewProperties;
 import dev.ikm.tinkar.common.id.IntIds;
@@ -57,6 +58,10 @@ public class GenEditingViewModel extends FormViewModel {
     // for single semantic editing
     public static String FIELD = "field";
 
+    // share the composer
+    public static String COMPOSER = "composer";
+    public static String SESSION = "session";
+
     public GenEditingViewModel() {
         super();
         addProperty(VIEW_PROPERTIES, (ViewProperties) null)
@@ -66,7 +71,11 @@ public GenEditingViewModel() {
                 .addProperty(FIELDS_COLLECTION, new ArrayList<FieldRecord<Object>>()) // Ordered collection of Fields
                 .addProperty(REF_COMPONENT, (EntityFacade) null)
                 .addProperty(SEMANTIC, (EntityFacade) null)
-                .addProperty(PATTERN, (EntityFacade) null);
+                .addProperty(PATTERN, (EntityFacade) null)
+                .addProperty(FIELD_INDEX, Integer.valueOf(-1))
+                .addProperty(COMPOSER, (Composer) null)
+                .addProperty(SESSION, (Session) null)
+        ;
     }
 
     public void loadPatternValues(){


Reviews:
user: login: carldea
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-21T18:42:35Z
user: login: carldea
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-21T18:50:11Z
user: login: carldea
body: Looks good to me.
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-21T20:39:15Z
user: login: dholubek
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-21T20:52:21Z
user: login: dholubek
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-21T20:52:30Z
user: login: dholubek
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-21T20:52:36Z
user: login: dholubek
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-21T20:54:06Z
user: login: dholubek
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-21T20:56:34Z

Review comments:
diff_hunk: @@ -397,13 +394,53 @@ public static EntityFacade createEmptySemantic(ViewProperties viewProperties, En
                                 fieldValues.with(IntIds.set.empty());
                             }
                         });
-                    }).attach((USDialect dialect) -> dialect
-                            .acceptability(PREFERRED));
+                    });
         });
         // don't commit yet; only commit once the user is ready to submit and not change the reference component
-        EntityService.get().endLoadPhase();
+        //EntityService.get().endLoadPhase();
path: kview/src/main/java/dev/ikm/komet/kview/mvvm/model/DataModelHelper.java
user: login: carldea
body: Can this line be removed?
created_at: 2025-04-21T18:42:35Z
author_association: CONTRIBUTOR
diff_hunk: @@ -31,7 +43,8 @@ public class ReferenceComponentController {
     private Button submitButton;
 
     @InjectViewModel
-    private ValidationViewModel referenceComponentViewModel;
+    //private ValidationViewModel referenceComponentViewModel;
path: kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/ReferenceComponentController.java
user: login: carldea
body: Can this line be removed?
created_at: 2025-04-21T18:50:11Z
author_association: CONTRIBUTOR
diff_hunk: @@ -65,6 +79,32 @@ private void clearForm(ActionEvent actionEvent) {
 
     @FXML
     public void submit(ActionEvent actionEvent) {
+        actionEvent.consume();
+        if (genEditingViewModel.getPropertyValue(REF_COMPONENT) != null) {
+            EntityFacade refComponent = genEditingViewModel.getPropertyValue(REF_COMPONENT);
+            EntityFacade semantic = genEditingViewModel.getPropertyValue(SEMANTIC);
+            EntityFacade pattern = genEditingViewModel.getPropertyValue(PATTERN);
+            StampViewModel stampViewModel = genEditingViewModel.getPropertyValue(STAMP_VIEW_MODEL);
+
+            semantic = DataModelHelper.commitSemantic(getViewProperties(),
+                    pattern,
+                    stampViewModel.getValue(STATUS),
+                    stampViewModel.getValue(AUTHOR),
+                    stampViewModel.getValue(MODULE),
+                    stampViewModel.getValue(PATH),
+                    semantic, refComponent.toProxy(),
+                    genEditingViewModel.getPropertyValue(COMPOSER),
+                    genEditingViewModel.getPropertyValue(SESSION),
+                    false);
+            // replacing the semantic
+            genEditingViewModel.setPropertyValue(SEMANTIC, semantic.toProxy());
 
+            //TODO override call create method
+            genEditingViewModel.save();
+/*
+            EvtBusFactory.getDefaultEvtBus().publish(genEditingViewModel.getPropertyValue(CURRENT_JOURNAL_WINDOW_TOPIC),
+                    new GenEditingEvent(actionEvent.getSource(), REFERENCE_COMPONENT_CHANGED_EVENT));
+*/
path: kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/ReferenceComponentController.java
user: login: carldea
body: Can we remove the unused code line?
created_at: 2025-04-21T18:57:24Z
author_association: CONTRIBUTOR
diff_hunk: @@ -397,13 +394,52 @@ public static EntityFacade createEmptySemantic(ViewProperties viewProperties, En
                                 fieldValues.with(IntIds.set.empty());
                             }
                         });
-                    }).attach((USDialect dialect) -> dialect
-                            .acceptability(PREFERRED));
+                    });
         });
         // don't commit yet; only commit once the user is ready to submit and not change the reference component
-        EntityService.get().endLoadPhase();
         semantic = defaultSemantic.toProxy();
         return semantic;
     }
 
+    /**
+     * write the semantic
+     * @param viewProperties viewProperties
+     * @param pattern pattern
+     * @param status STAMP status
+     * @param author STAMP author
+     * @param module STAMP module
+     * @param path STAMP path
+     * @param semantic the semantic
+     * @param refComponent the semantic's reference component
+     * @param composer shared composer
+     * @return
+     */
+    public static EntityFacade commitSemantic(ViewProperties viewProperties, EntityFacade pattern, State status,
path: kview/src/main/java/dev/ikm/komet/kview/mvvm/model/DataModelHelper.java
user: login: carldea
body: Could we change the name of the method to be something like `saveSemantic()`. The boolean flag of commitFlag determines whether it's 'committed' or 'uncomitted'.
created_at: 2025-04-21T19:06:59Z
author_association: CONTRIBUTOR
diff_hunk: @@ -397,13 +394,52 @@ public static EntityFacade createEmptySemantic(ViewProperties viewProperties, En
                                 fieldValues.with(IntIds.set.empty());
                             }
                         });
-                    }).attach((USDialect dialect) -> dialect
-                            .acceptability(PREFERRED));
+                    });
         });
         // don't commit yet; only commit once the user is ready to submit and not change the reference component
-        EntityService.get().endLoadPhase();
         semantic = defaultSemantic.toProxy();
         return semantic;
     }
 
+    /**
+     * write the semantic
+     * @param viewProperties viewProperties
+     * @param pattern pattern
+     * @param status STAMP status
+     * @param author STAMP author
+     * @param module STAMP module
+     * @param path STAMP path
+     * @param semantic the semantic
+     * @param refComponent the semantic's reference component
+     * @param composer shared composer
+     * @return
+     */
+    public static EntityFacade commitSemantic(ViewProperties viewProperties, EntityFacade pattern, State status,
+                                              EntityProxy.Concept author,
+                                              EntityProxy.Concept module,
+                                              EntityProxy.Concept path,
+                                              EntityFacade semantic,
+                                              EntityProxy refComponent,
+                                              Composer composer,
+                                              Session session,
path: kview/src/main/java/dev/ikm/komet/kview/mvvm/model/DataModelHelper.java
user: login: carldea
body: Does the composer own or have a method to obtain the session?
If so, we can remove the session parameter.
created_at: 2025-04-21T19:08:28Z
author_association: CONTRIBUTOR
diff_hunk: @@ -209,14 +214,35 @@ private void initialize() {
         // clear all semantic details.
         semanticDetailsVBox.getChildren().clear();
         EntityFacade semantic = genEditingViewModel.getPropertyValue(SEMANTIC);
+        Composer composer = new Composer("Semantic composer");
+        genEditingViewModel.setPropertyValue(COMPOSER, composer);
 
         // if the semantic is null, then we generate a default one
         if (semantic == null) {
             genEditingViewModel.setPropertyValue(MODE, CREATE);
             EntityFacade pattern = genEditingViewModel.getPropertyValue(PATTERN);
 
+            StampViewModel defaultStampViewModel = new StampViewModel();
+            defaultStampViewModel.setPropertyValue(STATUS, State.ACTIVE);
+            defaultStampViewModel.setPropertyValue(AUTHOR, TinkarTerm.USER);
+            defaultStampViewModel.setPropertyValue(MODULE, TinkarTerm.DEVELOPMENT_MODULE);
+            defaultStampViewModel.setPropertyValue(PATH, TinkarTerm.DEVELOPMENT_PATH);
+            Session session = composer.open(State.ACTIVE, TinkarTerm.USER, TinkarTerm.DEVELOPMENT_MODULE, TinkarTerm.DEVELOPMENT_PATH);
+            defaultStampViewModel.save();
+
+            genEditingViewModel.setPropertyValue(STAMP_VIEW_MODEL, defaultStampViewModel);
+
             // create empty semantic for the pattern and set it in the view model
-            semantic = DataModelHelper.createEmptySemantic(getViewProperties(), pattern);
+            //genEditingViewModel.setPropertyValue(REF_COMPONENT, ANONYMOUS_CONCEPT);
path: kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/GenEditingDetailsController.java
user: login: carldea
body: Can this line be removed?
created_at: 2025-04-21T19:09:33Z
author_association: CONTRIBUTOR
diff_hunk: @@ -65,6 +79,32 @@ private void clearForm(ActionEvent actionEvent) {
 
     @FXML
     public void submit(ActionEvent actionEvent) {
+        actionEvent.consume();
+        if (genEditingViewModel.getPropertyValue(REF_COMPONENT) != null) {
+            EntityFacade refComponent = genEditingViewModel.getPropertyValue(REF_COMPONENT);
+            EntityFacade semantic = genEditingViewModel.getPropertyValue(SEMANTIC);
+            EntityFacade pattern = genEditingViewModel.getPropertyValue(PATTERN);
+            StampViewModel stampViewModel = genEditingViewModel.getPropertyValue(STAMP_VIEW_MODEL);
+
+            semantic = DataModelHelper.commitSemantic(getViewProperties(),
+                    pattern,
+                    stampViewModel.getValue(STATUS),
+                    stampViewModel.getValue(AUTHOR),
+                    stampViewModel.getValue(MODULE),
+                    stampViewModel.getValue(PATH),
+                    semantic, refComponent.toProxy(),
+                    genEditingViewModel.getPropertyValue(COMPOSER),
+                    genEditingViewModel.getPropertyValue(SESSION),
+                    false);
+            // replacing the semantic
+            genEditingViewModel.setPropertyValue(SEMANTIC, semantic.toProxy());
 
+            //TODO override call create method
+            genEditingViewModel.save();
path: kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/ReferenceComponentController.java
user: login: carldea
body: Can you roll this up into the overridden `save()` method?
The code from line 83-98 is identical to `SemanticFieldsController.java` 256-272. The only difference is the boolean commit flag.
created_at: 2025-04-21T19:17:55Z
author_association: CONTRIBUTOR
diff_hunk: @@ -65,6 +79,32 @@ private void clearForm(ActionEvent actionEvent) {
 
     @FXML
     public void submit(ActionEvent actionEvent) {
+        actionEvent.consume();
+        if (genEditingViewModel.getPropertyValue(REF_COMPONENT) != null) {
+            EntityFacade refComponent = genEditingViewModel.getPropertyValue(REF_COMPONENT);
+            EntityFacade semantic = genEditingViewModel.getPropertyValue(SEMANTIC);
+            EntityFacade pattern = genEditingViewModel.getPropertyValue(PATTERN);
+            StampViewModel stampViewModel = genEditingViewModel.getPropertyValue(STAMP_VIEW_MODEL);
+
+            semantic = DataModelHelper.commitSemantic(getViewProperties(),
+                    pattern,
+                    stampViewModel.getValue(STATUS),
+                    stampViewModel.getValue(AUTHOR),
+                    stampViewModel.getValue(MODULE),
+                    stampViewModel.getValue(PATH),
+                    semantic, refComponent.toProxy(),
+                    genEditingViewModel.getPropertyValue(COMPOSER),
+                    genEditingViewModel.getPropertyValue(SESSION),
+                    false);
+            // replacing the semantic
+            genEditingViewModel.setPropertyValue(SEMANTIC, semantic.toProxy());
 
+            //TODO override call create method
+            genEditingViewModel.save();
+/*
+            EvtBusFactory.getDefaultEvtBus().publish(genEditingViewModel.getPropertyValue(CURRENT_JOURNAL_WINDOW_TOPIC),
+                    new GenEditingEvent(actionEvent.getSource(), REFERENCE_COMPONENT_CHANGED_EVENT));
+*/
path: kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/ReferenceComponentController.java
user: login: dholubek
body: fixed
created_at: 2025-04-21T20:52:21Z
author_association: CONTRIBUTOR
diff_hunk: @@ -397,13 +394,52 @@ public static EntityFacade createEmptySemantic(ViewProperties viewProperties, En
                                 fieldValues.with(IntIds.set.empty());
                             }
                         });
-                    }).attach((USDialect dialect) -> dialect
-                            .acceptability(PREFERRED));
+                    });
         });
         // don't commit yet; only commit once the user is ready to submit and not change the reference component
-        EntityService.get().endLoadPhase();
         semantic = defaultSemantic.toProxy();
         return semantic;
     }
 
+    /**
+     * write the semantic
+     * @param viewProperties viewProperties
+     * @param pattern pattern
+     * @param status STAMP status
+     * @param author STAMP author
+     * @param module STAMP module
+     * @param path STAMP path
+     * @param semantic the semantic
+     * @param refComponent the semantic's reference component
+     * @param composer shared composer
+     * @return
+     */
+    public static EntityFacade commitSemantic(ViewProperties viewProperties, EntityFacade pattern, State status,
path: kview/src/main/java/dev/ikm/komet/kview/mvvm/model/DataModelHelper.java
user: login: dholubek
body: fixed
created_at: 2025-04-21T20:52:29Z
author_association: CONTRIBUTOR
diff_hunk: @@ -209,14 +214,35 @@ private void initialize() {
         // clear all semantic details.
         semanticDetailsVBox.getChildren().clear();
         EntityFacade semantic = genEditingViewModel.getPropertyValue(SEMANTIC);
+        Composer composer = new Composer("Semantic composer");
+        genEditingViewModel.setPropertyValue(COMPOSER, composer);
 
         // if the semantic is null, then we generate a default one
         if (semantic == null) {
             genEditingViewModel.setPropertyValue(MODE, CREATE);
             EntityFacade pattern = genEditingViewModel.getPropertyValue(PATTERN);
 
+            StampViewModel defaultStampViewModel = new StampViewModel();
+            defaultStampViewModel.setPropertyValue(STATUS, State.ACTIVE);
+            defaultStampViewModel.setPropertyValue(AUTHOR, TinkarTerm.USER);
+            defaultStampViewModel.setPropertyValue(MODULE, TinkarTerm.DEVELOPMENT_MODULE);
+            defaultStampViewModel.setPropertyValue(PATH, TinkarTerm.DEVELOPMENT_PATH);
+            Session session = composer.open(State.ACTIVE, TinkarTerm.USER, TinkarTerm.DEVELOPMENT_MODULE, TinkarTerm.DEVELOPMENT_PATH);
+            defaultStampViewModel.save();
+
+            genEditingViewModel.setPropertyValue(STAMP_VIEW_MODEL, defaultStampViewModel);
+
             // create empty semantic for the pattern and set it in the view model
-            semantic = DataModelHelper.createEmptySemantic(getViewProperties(), pattern);
+            //genEditingViewModel.setPropertyValue(REF_COMPONENT, ANONYMOUS_CONCEPT);
path: kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/GenEditingDetailsController.java
user: login: dholubek
body: fixed
created_at: 2025-04-21T20:52:36Z
author_association: CONTRIBUTOR
diff_hunk: @@ -397,13 +394,52 @@ public static EntityFacade createEmptySemantic(ViewProperties viewProperties, En
                                 fieldValues.with(IntIds.set.empty());
                             }
                         });
-                    }).attach((USDialect dialect) -> dialect
-                            .acceptability(PREFERRED));
+                    });
         });
         // don't commit yet; only commit once the user is ready to submit and not change the reference component
-        EntityService.get().endLoadPhase();
         semantic = defaultSemantic.toProxy();
         return semantic;
     }
 
+    /**
+     * write the semantic
+     * @param viewProperties viewProperties
+     * @param pattern pattern
+     * @param status STAMP status
+     * @param author STAMP author
+     * @param module STAMP module
+     * @param path STAMP path
+     * @param semantic the semantic
+     * @param refComponent the semantic's reference component
+     * @param composer shared composer
+     * @return
+     */
+    public static EntityFacade commitSemantic(ViewProperties viewProperties, EntityFacade pattern, State status,
+                                              EntityProxy.Concept author,
+                                              EntityProxy.Concept module,
+                                              EntityProxy.Concept path,
+                                              EntityFacade semantic,
+                                              EntityProxy refComponent,
+                                              Composer composer,
+                                              Session session,
path: kview/src/main/java/dev/ikm/komet/kview/mvvm/model/DataModelHelper.java
user: login: dholubek
body: it doesn't
created_at: 2025-04-21T20:54:05Z
author_association: CONTRIBUTOR
diff_hunk: @@ -65,6 +79,32 @@ private void clearForm(ActionEvent actionEvent) {
 
     @FXML
     public void submit(ActionEvent actionEvent) {
+        actionEvent.consume();
+        if (genEditingViewModel.getPropertyValue(REF_COMPONENT) != null) {
+            EntityFacade refComponent = genEditingViewModel.getPropertyValue(REF_COMPONENT);
+            EntityFacade semantic = genEditingViewModel.getPropertyValue(SEMANTIC);
+            EntityFacade pattern = genEditingViewModel.getPropertyValue(PATTERN);
+            StampViewModel stampViewModel = genEditingViewModel.getPropertyValue(STAMP_VIEW_MODEL);
+
+            semantic = DataModelHelper.commitSemantic(getViewProperties(),
+                    pattern,
+                    stampViewModel.getValue(STATUS),
+                    stampViewModel.getValue(AUTHOR),
+                    stampViewModel.getValue(MODULE),
+                    stampViewModel.getValue(PATH),
+                    semantic, refComponent.toProxy(),
+                    genEditingViewModel.getPropertyValue(COMPOSER),
+                    genEditingViewModel.getPropertyValue(SESSION),
+                    false);
+            // replacing the semantic
+            genEditingViewModel.setPropertyValue(SEMANTIC, semantic.toProxy());
 
+            //TODO override call create method
+            genEditingViewModel.save();
path: kview/src/main/java/dev/ikm/komet/kview/mvvm/view/genediting/ReferenceComponentController.java
user: login: dholubek
body: I'm not sure what you mean... those line numbers are out of sync from my last changes...we should talk one on one so I understand what you are asking.
created_at: 2025-04-21T20:56:34Z
author_association: CONTRIBUTOR

PR comments:
user: login: carldea
created_at: 2025-04-21T19:03:33Z
body: After refactoring controllers to share the same view model (GenEditingViewModel) did view models used prior get removed? 
 This assumes some might have had a subclasses of FormViewModel or ValidationViewModel. If not, then it should be fine.
author_association: CONTRIBUTOR
user: login: dholubek
created_at: 2025-04-21T19:05:39Z
body: > After refactoring controllers to share the same view model (GenEditingViewModel) did view models used prior get removed? This assumes some might have had a subclasses of FormViewModel or ValidationViewModel. If not, then it should be fine.

We didn't create subclasses for the viewModels used, they used SimpleViewModel or ValidationViewModel
author_association: CONTRIBUTOR