This is an automated email from the ASF dual-hosted git repository. sergeykamov pushed a commit to branch NLPCRAFT-235 in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
commit 15fd25b84306109b0d92dd97ccb6eafca81b9e7d Author: Sergey Kamov <[email protected]> AuthorDate: Sat Mar 27 10:52:57 2021 +0300 WIP. --- .../nlpcraft/probe/mgrs/deploy/NCDeployManager.scala | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala index 8357c6a..caef44f 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala @@ -83,6 +83,8 @@ object NCDeployManager extends NCService with DecorateAsScala { private final val SEPARATORS = Seq('?', ',', '.', '-', '!') + private final val SUSP_SYNS = Seq("?", "*", "+") + @volatile private var data: ArrayBuffer[NCProbeModel] = _ @volatile private var mdlFactory: NCModelFactory = _ @@ -214,6 +216,18 @@ object NCDeployManager extends NCService with DecorateAsScala { for (elm ← mdl.getElements.asScala) { val elmId = elm.getId + // Checks before macros processing. + val susp = elm.getSynonyms.asScala.filter(syn ⇒ SUSP_SYNS.exists(susp ⇒ syn.contains(susp))) + + if (susp.nonEmpty) + logger.warn( + s"Suspicious synonyms definition [" + + s"mdlId=$mdlId, " + + s"elementId=$elmId, " + + s"synonyms=[${susp.mkString(", ")}]" + + s"]" + ) + def addSynonym( isElementId: Boolean, isValueName: Boolean, @@ -461,7 +475,8 @@ object NCDeployManager extends NCService with DecorateAsScala { logger.warn(s"Duplicate synonyms found in '$mdlId' model - turn on TRACE logging to see them.") logger.warn(s" ${b("|--")} NOTE: ID of the model element is its default built-in synonym - you don't need to add it explicitly to the list of synonyms.") logger.warn(s" ${b("+--")} Model '$mdlId' allows duplicate synonyms but the large number may degrade the performance.") - } else + } + else throw new NCE(s"Duplicated synonyms found and not allowed [mdlId=$mdlId]") }
