WIP on NLPCRAFT-384
diff --git a/nlpcraft-examples/cargps/src/main/java/org/apache/nlpcraft/examples/alarm/CarGpsModel.scala b/nlpcraft-examples/cargps/src/main/java/org/apache/nlpcraft/examples/alarm/CarGpsModel.scala
deleted file mode 100644
index e72058d..0000000
--- a/nlpcraft-examples/cargps/src/main/java/org/apache/nlpcraft/examples/alarm/CarGpsModel.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.nlpcraft.examples.alarm
-
-import org.apache.nlpcraft.model.NCModelFileAdapter
-
-/**
- * See 'README.md' file in the same folder for running and testing instructions.
- */
-class CarGpsModel extends NCModelFileAdapter("cargps_model.yaml") {
-
-}
diff --git a/nlpcraft-examples/cargps/src/main/java/org/apache/nlpcraft/examples/cargps/CarGpsModel.scala b/nlpcraft-examples/cargps/src/main/java/org/apache/nlpcraft/examples/cargps/CarGpsModel.scala
new file mode 100644
index 0000000..9b6cf41
--- /dev/null
+++ b/nlpcraft-examples/cargps/src/main/java/org/apache/nlpcraft/examples/cargps/CarGpsModel.scala
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nlpcraft.examples.cargps
+
+import org.apache.nlpcraft.model._
+
+/**
+ * See 'README.md' file in the same folder for running and testing instructions.
+ */
+class CarGpsModel extends NCModelFileAdapter("cargps_model.yaml") {
+    /**
+     *
+     * @return
+     */
+    @NCIntentRef("int:navigate")
+    @NCIntentSampleRef("samples/cargps_navigate_samples.txt")
+    def onNavigation(): NCResult = {
+        NCResult.text(s"")
+    }
+
+    /**
+     *
+     * @return
+     */
+    @NCIntentRef("int:cancel")
+    @NCIntentSampleRef("samples/cargps_cancel_samples.txt")
+    def onCancel(): NCResult = {
+        NCResult.text(s"")
+    }
+
+    /**
+     *
+     * @return
+     */
+    @NCIntentRef("int:add:waypoint")
+    @NCIntentSampleRef("samples/cargps_add_waypoint_samples.txt")
+    def onAddWaypoint(): NCResult = {
+        NCResult.text(s"")
+    }
+
+    /**
+     *
+     * @return
+     */
+    @NCIntentRef("int:remove:waypoint")
+    @NCIntentSampleRef("samples/cargps_remove_waypoint_samples.txt")
+    def onRemoveWaypoint(): NCResult = {
+        NCResult.text(s"")
+    }
+}
diff --git a/nlpcraft-examples/cargps/src/main/resources/cargps_intents.idl b/nlpcraft-examples/cargps/src/main/resources/cargps_intents.idl
index ae6f28c..9d3f43f 100644
--- a/nlpcraft-examples/cargps/src/main/resources/cargps_intents.idl
+++ b/nlpcraft-examples/cargps/src/main/resources/cargps_intents.idl
@@ -14,3 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
+// Reusable fragments.
+fragment=hey term={tok_id() == "x:hey" && tok_is_first()}
+
+// Intents.
+intent=int:cancel fragment(hey) term={tok_id() == "x:cancel"}
+intent=int:navigate fragment(hey)
+intent=int:add:waypoint fragment(hey)
+intent=int:remove:waypoint fragment(hey)
\ No newline at end of file
diff --git a/nlpcraft-examples/cargps/src/main/resources/cargps_model.json b/nlpcraft-examples/cargps/src/main/resources/cargps_model.json
deleted file mode 100644
index c5fec53..0000000
--- a/nlpcraft-examples/cargps/src/main/resources/cargps_model.json
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-{
-    "id": "nlpcraft.cargps.ex",
-    "name": "Car GPS Example Model",
-    "version": "1.0",
-    "description": "Car GPS example model.",
-    "elements": []
-}
\ No newline at end of file
diff --git a/nlpcraft-examples/cargps/src/main/resources/cargps_model.yaml b/nlpcraft-examples/cargps/src/main/resources/cargps_model.yaml
new file mode 100644
index 0000000..7258d37
--- /dev/null
+++ b/nlpcraft-examples/cargps/src/main/resources/cargps_model.yaml
@@ -0,0 +1,53 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+id: "nlpcraft.cargps.ex"
+name: "Car GPS Example Model"
+version: "1.0"
+description: "NLI-powered car GPS-based navigation example model."
+enabledBuiltInTokens: [] # This example doesn't use any built-in tokens.
+
+macros:
+  - name: "<HEY>"
+    macro: "{hey|hi|howdy}"
+  - name: "<NAVIGATE>"
+    macro: "{navigate|pilot|plot|drive|route|plan|find|head|ride|direct|steer|operate|sail} {out|*} {course|route|destination|drive|*}"
+  - name: "<CANCEL>"
+    macro: "{cancel|stop|abort|finish|cease|quit} {off|*}"
+
+#
+# Allows for multi-word synonyms in this entire model
+# to be sparse and permutate them for better detection.
+# These two properties generally enable a free-form
+# natural language comprehension.
+#
+permutateSynonyms: true
+sparse: true
+
+elements:
+  - id: "x:hey"
+    description: "NLI prompt"
+    synonyms:
+      - "<HEY> {car|vehicle|truck}"
+
+  - id: "x:cancel"
+    description: "Cancel action."
+    synonyms:
+      - "<CANCEL>"
+
+intents:
+  - "import('cargps_intents.idl')"
\ No newline at end of file
diff --git a/nlpcraft-examples/cargps/src/main/resources/cargps_samples.txt b/nlpcraft-examples/cargps/src/main/resources/samples/cargps_add_waypoint_samples.txt
similarity index 99%
copy from nlpcraft-examples/cargps/src/main/resources/cargps_samples.txt
copy to nlpcraft-examples/cargps/src/main/resources/samples/cargps_add_waypoint_samples.txt
index 564f630..4c3f520 100644
--- a/nlpcraft-examples/cargps/src/main/resources/cargps_samples.txt
+++ b/nlpcraft-examples/cargps/src/main/resources/samples/cargps_add_waypoint_samples.txt
@@ -19,4 +19,3 @@
 # Set of samples (corpus) for automatic unit and regression testing.
 #
 
-
diff --git a/nlpcraft-examples/cargps/src/main/resources/cargps_samples.txt b/nlpcraft-examples/cargps/src/main/resources/samples/cargps_cancel_samples.txt
similarity index 95%
copy from nlpcraft-examples/cargps/src/main/resources/cargps_samples.txt
copy to nlpcraft-examples/cargps/src/main/resources/samples/cargps_cancel_samples.txt
index 564f630..80c6568 100644
--- a/nlpcraft-examples/cargps/src/main/resources/cargps_samples.txt
+++ b/nlpcraft-examples/cargps/src/main/resources/samples/cargps_cancel_samples.txt
@@ -19,4 +19,4 @@
 # Set of samples (corpus) for automatic unit and regression testing.
 #
 
-
+Hey truck - stop the navigation!
\ No newline at end of file
diff --git a/nlpcraft-examples/cargps/src/main/resources/cargps_samples.txt b/nlpcraft-examples/cargps/src/main/resources/samples/cargps_navigate_samples.txt
similarity index 99%
rename from nlpcraft-examples/cargps/src/main/resources/cargps_samples.txt
rename to nlpcraft-examples/cargps/src/main/resources/samples/cargps_navigate_samples.txt
index 564f630..329393e 100644
--- a/nlpcraft-examples/cargps/src/main/resources/cargps_samples.txt
+++ b/nlpcraft-examples/cargps/src/main/resources/samples/cargps_navigate_samples.txt
@@ -18,5 +18,3 @@
 #
 # Set of samples (corpus) for automatic unit and regression testing.
 #
-
-
diff --git a/nlpcraft-examples/cargps/src/main/resources/cargps_samples.txt b/nlpcraft-examples/cargps/src/main/resources/samples/cargps_remove_waypoint_samples.txt
similarity index 99%
copy from nlpcraft-examples/cargps/src/main/resources/cargps_samples.txt
copy to nlpcraft-examples/cargps/src/main/resources/samples/cargps_remove_waypoint_samples.txt
index 564f630..4c3f520 100644
--- a/nlpcraft-examples/cargps/src/main/resources/cargps_samples.txt
+++ b/nlpcraft-examples/cargps/src/main/resources/samples/cargps_remove_waypoint_samples.txt
@@ -19,4 +19,3 @@
 # Set of samples (corpus) for automatic unit and regression testing.
 #
 
-
diff --git a/nlpcraft-examples/cargps/src/test/java/org/apache/nlpcraft/examples/alarm/NCModelValidationSpec.scala b/nlpcraft-examples/cargps/src/test/java/org/apache/nlpcraft/examples/cargps/NCModelValidationSpec.scala
similarity index 96%
rename from nlpcraft-examples/cargps/src/test/java/org/apache/nlpcraft/examples/alarm/NCModelValidationSpec.scala
rename to nlpcraft-examples/cargps/src/test/java/org/apache/nlpcraft/examples/cargps/NCModelValidationSpec.scala
index c08b430..e46e10a 100644
--- a/nlpcraft-examples/cargps/src/test/java/org/apache/nlpcraft/examples/alarm/NCModelValidationSpec.scala
+++ b/nlpcraft-examples/cargps/src/test/java/org/apache/nlpcraft/examples/cargps/NCModelValidationSpec.scala
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.nlpcraft.examples.alarm
+package org.apache.nlpcraft.examples.cargps
 
 import org.apache.nlpcraft.model.tools.test.NCTestAutoModelValidator
 import org.junit.jupiter.api.{Assertions, Test}