This is an automated email from the ASF dual-hosted git repository.

gitgabrio pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-drools.git


The following commit(s) were added to refs/heads/main by this push:
     new d55ce2d561 [incubator-kie-issues#852] DMN - Allow importing into the 
default namespace (#5684)
d55ce2d561 is described below

commit d55ce2d56183539ae8a850c34f07c6134f1844e3
Author: Gabriele Cardosi <[email protected]>
AuthorDate: Wed Feb 14 09:12:11 2024 +0100

    [incubator-kie-issues#852] DMN - Allow importing into the default namespace 
(#5684)
    
    * [private-bamoe-issues#253] WIP - working only ItemDefNode import
    
    * [incubator-kie-issues#852] WIP
    
    * [incubator-kie-issues#852] WIP - experimenting different approach
    
    * [incubator-kie-issues#852] WIP - Experimenting model merge.
    
    * [incubator-kie-issues#852] WIP - Working Imported model test
    
    * [incubator-kie-issues#852] Working state
    
    * [incubator-kie-issues#852] Add tests. Minor fixes
    
    * [incubator-kie-issues#852] Fixing UnnamedImportUtilsTest - using a unique 
name for imported model
    
    ---------
    
    Co-authored-by: BAMOE CI <[email protected]>
    Co-authored-by: Gabriele-Cardosi <[email protected]>
---
 .../org/kie/dmn/core/compiler/DMNCompilerImpl.java |  17 ++-
 .../org/kie/dmn/core/compiler/DMNTypeRegistry.java |   6 ++
 .../dmn/core/compiler/DMNTypeRegistryAbstract.java |   6 +-
 .../kie/dmn/core/compiler/DMNTypeRegistryV11.java  |   2 +-
 .../kie/dmn/core/compiler/DMNTypeRegistryV12.java  |   2 +-
 .../kie/dmn/core/compiler/DMNTypeRegistryV13.java  |   2 +-
 .../kie/dmn/core/compiler/DMNTypeRegistryV14.java  |   2 +-
 .../kie/dmn/core/compiler/DMNTypeRegistryV15.java  |   2 +-
 .../kie/dmn/core/compiler/DecisionCompiler.java    |   6 ++
 .../kie/dmn/core/compiler/UnnamedImportUtils.java  |  76 +++++++++++++
 .../java/org/kie/dmn/core/impl/DMNModelImpl.java   |   9 ++
 .../java/org/kie/dmn/core/impl/DMNRuntimeImpl.java |   4 +
 .../java/org/kie/dmn/core/DMNCompilerTest.java     |  92 ++++++++++++++++
 .../dmn/core/compiler/UnnamedImportUtilsTest.java  | 118 +++++++++++++++++++++
 .../java/org/kie/dmn/core/util/DMNRuntimeUtil.java |  17 +++
 .../org/kie/dmn/core/Imported_Model_Unamed.dmn     |  69 ++++++++++++
 .../kie/dmn/core/Importing_EmptyNamed_Model.dmn    |  79 ++++++++++++++
 .../org/kie/dmn/core/Importing_Named_Model.dmn     |  79 ++++++++++++++
 .../core/Importing_OverridingEmptyNamed_Model.dmn  |  93 ++++++++++++++++
 19 files changed, 672 insertions(+), 9 deletions(-)

diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNCompilerImpl.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNCompilerImpl.java
index 364b5933f8..a09a3fdd13 100644
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNCompilerImpl.java
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNCompilerImpl.java
@@ -42,6 +42,7 @@ import java.util.function.Function;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
+
 import javax.xml.XMLConstants;
 import javax.xml.namespace.QName;
 
@@ -106,6 +107,8 @@ import org.kie.internal.io.ResourceFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.kie.dmn.core.compiler.UnnamedImportUtils.processMergedModel;
+
 public class DMNCompilerImpl implements DMNCompiler {
 
     private static final Logger logger = LoggerFactory.getLogger( 
DMNCompilerImpl.class );
@@ -211,7 +214,7 @@ public class DMNCompilerImpl implements DMNCompiler {
         DMNFEELHelper feel = new DMNFEELHelper(cc.getRootClassLoader(), 
helperFEELProfiles);
         DMNCompilerContext ctx = new DMNCompilerContext(feel);
         ctx.setRelativeResolver(relativeResolver);
-
+        List<DMNModel> toMerge = new ArrayList<>();
         if (!dmndefs.getImport().isEmpty()) {
             for (Import i : dmndefs.getImport()) {
                 if (ImportDMNResolverUtil.whichImportType(i) == 
ImportType.DMN) {
@@ -230,8 +233,15 @@ public class DMNCompilerImpl implements DMNCompiler {
                     }, Function.identity());
                     if (located != null) {
                         String iAlias = 
Optional.ofNullable(i.getName()).orElse(located.getName());
-                        model.setImportAliasForNS(iAlias, 
located.getNamespace(), located.getName());
-                        importFromModel(model, located, iAlias);
+                        // incubator-kie-issues#852: The idea is to not treat 
the anonymous models as import, but to "merge" them
+                        //  with original one,
+                        // because otherwise we would have to deal with 
clashing name aliases, or similar issues
+                        if (iAlias != null && !iAlias.isEmpty()) {
+                            model.setImportAliasForNS(iAlias, 
located.getNamespace(), located.getName());
+                            importFromModel(model, located, iAlias);
+                        } else {
+                            toMerge.add(located);
+                        }
                     }
                 } else if (ImportDMNResolverUtil.whichImportType(i) == 
ImportType.PMML) {
                     processPMMLImport(model, i, relativeResolver);
@@ -249,6 +259,7 @@ public class DMNCompilerImpl implements DMNCompiler {
             }
         }
 
+        toMerge.forEach(mergedModel -> processMergedModel(model, 
(DMNModelImpl) mergedModel));
         processItemDefinitions(ctx, model, dmndefs);
         processDrgElements(ctx, model, dmndefs);
         return model;
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistry.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistry.java
index b422f98489..dc7e378f7c 100644
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistry.java
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistry.java
@@ -18,6 +18,8 @@
  */
 package org.kie.dmn.core.compiler;
 
+import java.util.Map;
+
 import org.kie.dmn.api.core.DMNType;
 import org.kie.dmn.feel.lang.types.FEELTypeRegistry;
 
@@ -25,8 +27,12 @@ public interface DMNTypeRegistry extends FEELTypeRegistry {
 
     DMNType unknown();
 
+    Map<String, Map<String, DMNType>> getTypes();
+
     DMNType registerType(DMNType type);
 
     DMNType resolveType(String namespace, String name);
 
+    String feelNS();
+
 }
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryAbstract.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryAbstract.java
index 18eeda7118..d46c995c96 100644
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryAbstract.java
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryAbstract.java
@@ -45,7 +45,6 @@ public abstract class DMNTypeRegistryAbstract implements 
DMNTypeRegistry, FEELTy
     protected ScopeImpl feelTypesScope = new ScopeImpl(); // no parent scope, 
intentional.
     protected Map<String, ScopeImpl> feelTypesScopeChildLU = new HashMap<>();
 
-    protected abstract String feelNS();
 
     public DMNTypeRegistryAbstract(Map<String, QName> aliases) {
         this.aliases = aliases;
@@ -93,6 +92,11 @@ public abstract class DMNTypeRegistryAbstract implements 
DMNTypeRegistry, FEELTy
         }
     }
 
+    @Override
+    public Map<String, Map<String, DMNType>> getTypes() {
+        return types;
+    }
+
     protected void registerAsFEELType(DMNType dmnType) {
         Optional<String> optAliasKey = keyfromNS(dmnType.getNamespace());
         Type feelType = ((BaseDMNTypeImpl) dmnType).getFeelType();
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV11.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV11.java
index c70b10c67e..51e0c30c96 100644
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV11.java
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV11.java
@@ -34,7 +34,7 @@ public class DMNTypeRegistryV11 extends 
DMNTypeRegistryAbstract {
     }
 
     @Override
-    protected String feelNS() {
+    public String feelNS() {
         return KieDMNModelInstrumentedBase.URI_FEEL;
     }
 
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV12.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV12.java
index e3c8dbdc62..3b76380a17 100644
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV12.java
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV12.java
@@ -67,7 +67,7 @@ public class DMNTypeRegistryV12 extends 
DMNTypeRegistryAbstract {
                                                                                
                                     BuiltInType.CONTEXT));
 
     @Override
-    protected String feelNS() {
+    public String feelNS() {
         return KieDMNModelInstrumentedBase.URI_FEEL;
     }
 
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV13.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV13.java
index efc927bd0d..ebad3d5b6e 100644
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV13.java
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV13.java
@@ -44,7 +44,7 @@ public class DMNTypeRegistryV13 extends 
DMNTypeRegistryAbstract {
     }
 
     @Override
-    protected String feelNS() {
+    public String feelNS() {
         return KieDMNModelInstrumentedBase.URI_FEEL;
     }
 }
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV14.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV14.java
index ba7d655b22..2fdbccefa0 100644
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV14.java
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV14.java
@@ -44,7 +44,7 @@ public class DMNTypeRegistryV14 extends 
DMNTypeRegistryAbstract {
     }
 
     @Override
-    protected String feelNS() {
+    public String feelNS() {
         return KieDMNModelInstrumentedBase.URI_FEEL;
     }
 }
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV15.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV15.java
index 9c17a47600..d67d28aebf 100644
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV15.java
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV15.java
@@ -43,7 +43,7 @@ public class DMNTypeRegistryV15 extends 
DMNTypeRegistryAbstract {
     }
 
     @Override
-    protected String feelNS() {
+    public String feelNS() {
         return KieDMNModelInstrumentedBase.URI_FEEL;
     }
 }
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DecisionCompiler.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DecisionCompiler.java
index 26bfc58b0b..62c68d5062 100644
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DecisionCompiler.java
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DecisionCompiler.java
@@ -38,6 +38,8 @@ import org.kie.dmn.core.util.Msg;
 import org.kie.dmn.model.api.DRGElement;
 import org.kie.dmn.model.api.Decision;
 
+import static org.kie.dmn.core.compiler.UnnamedImportUtils.isInUnnamedImport;
+
 public class DecisionCompiler implements DRGElementCompiler {
     @Override
     public boolean accept(DRGElement de) {
@@ -96,6 +98,9 @@ public class DecisionCompiler implements DRGElementCompiler {
             if (dep.getModelNamespace().equals(model.getNamespace())) {
                 // for BKMs might need to create a DMNType for "functions" and 
replace the type here by that
                 ctx.setVariable(dep.getName(), depType);
+            } else if (isInUnnamedImport(dep, model)) {
+                // the dependency is an unnamed import
+                ctx.setVariable(dep.getName(), depType);
             } else {
                 // then the dependency is an imported dependency.
                 Optional<String> alias = 
model.getImportAliasFor(dep.getModelNamespace(), dep.getModelName());
@@ -109,4 +114,5 @@ public class DecisionCompiler implements DRGElementCompiler 
{
             ctx.setVariable(importedType.getKey(), importedType.getValue());
         }
     }
+
 }
\ No newline at end of file
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/UnnamedImportUtils.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/UnnamedImportUtils.java
new file mode 100644
index 0000000000..3f22b334e0
--- /dev/null
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/UnnamedImportUtils.java
@@ -0,0 +1,76 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.kie.dmn.core.compiler;
+
+import java.util.Collection;
+import java.util.Objects;
+
+import org.kie.dmn.api.core.ast.DMNNode;
+import org.kie.dmn.core.impl.DMNModelImpl;
+import org.kie.dmn.model.api.Definitions;
+import org.kie.dmn.model.api.Import;
+import org.kie.dmn.model.api.NamedElement;
+
+/**
+ * Class meant to provide helper methods to deal with unnamed model imports
+ */
+public class UnnamedImportUtils {
+
+    private UnnamedImportUtils() {
+    }
+
+    public static boolean isInUnnamedImport(DMNNode node, DMNModelImpl model) {
+        for (Import imported : model.getDefinitions().getImport()) {
+            String importedName = imported.getName();
+            if ((node.getModelNamespace().equals(imported.getNamespace()) &&
+                    (importedName != null && importedName.isEmpty()))) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static void processMergedModel(DMNModelImpl parentModel, 
DMNModelImpl mergedModel) {
+        // incubator-kie-issues#852: The idea is to not treat the anonymous 
models as import, but to "merge" them with original opne,
+        // Here we try to put all the definitions from the "imported" model 
inside the parent one
+        Definitions parentDefinitions = parentModel.getDefinitions();
+        Definitions mergedDefinitions = mergedModel.getDefinitions();
+        
parentDefinitions.getArtifact().addAll(mergedDefinitions.getArtifact());
+
+        addIfNotPresent(parentDefinitions.getDecisionService(), 
mergedDefinitions.getDecisionService());
+        addIfNotPresent(parentDefinitions.getBusinessContextElement(), 
mergedDefinitions.getBusinessContextElement());
+        addIfNotPresent(parentDefinitions.getDrgElement(), 
mergedDefinitions.getDrgElement());
+        addIfNotPresent(parentDefinitions.getImport(), 
mergedDefinitions.getImport());
+        addIfNotPresent(parentDefinitions.getItemDefinition(), 
mergedDefinitions.getItemDefinition());
+        
mergedDefinitions.getChildren().forEach(parentDefinitions::addChildren);
+        mergedModel.getTypeRegistry().getTypes().forEach((s, stringDMNTypeMap) 
->
+                                                                 
stringDMNTypeMap.values().
+                                                                         
forEach(dmnType -> parentModel.getTypeRegistry().registerType(dmnType)));
+    }
+
+    static <T extends NamedElement> void addIfNotPresent(Collection<T> target, 
Collection<T> source) {
+        source.forEach(sourceElement -> addIfNotPresent(target, 
sourceElement));
+    }
+
+    static <T extends NamedElement> void addIfNotPresent(Collection<T> target, 
T source) {
+        if (target.stream().noneMatch(namedElement -> 
Objects.equals(namedElement.getName(), source.getName()))) {
+            target.add(source);
+        }
+    }
+}
\ No newline at end of file
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNModelImpl.java 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNModelImpl.java
index fafcb18b5d..f7a45a44d3 100644
--- a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNModelImpl.java
+++ b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNModelImpl.java
@@ -70,6 +70,8 @@ import org.kie.dmn.core.util.DefaultDMNMessagesManager;
 import org.kie.dmn.model.api.DMNModelInstrumentedBase;
 import org.kie.dmn.model.api.Definitions;
 
+import static org.kie.dmn.core.compiler.UnnamedImportUtils.isInUnnamedImport;
+
 public class DMNModelImpl
         implements DMNModel, DMNMessageManager, Externalizable {
     
@@ -205,13 +207,20 @@ public class DMNModelImpl
     }
 
     private String computeDRGElementModelLocalId(DMNNode node) {
+        // incubator-kie-issues#852: The idea is to not treat the anonymous 
models as import, but to "merge" them with original opne,
+        // Here, if the node comes from an unnamed imported model, then it is 
stored only with its id, to be looked for
+        // as if defined in the model itself
         if (node.getModelNamespace().equals(definitions.getNamespace())) {
             return node.getId();
+        } else if (isInUnnamedImport(node, this)) {
+            // the node is an unnamed import
+            return node.getId();
         } else {
             return node.getModelNamespace() + "#" + node.getId();
         }
     }
 
+
     @Override
     public DecisionNode getDecisionById(String id) {
         return this.decisions.get(id);
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNRuntimeImpl.java 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNRuntimeImpl.java
index a8f205084f..85ccf42b78 100644
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNRuntimeImpl.java
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNRuntimeImpl.java
@@ -65,6 +65,7 @@ import org.slf4j.LoggerFactory;
 import static 
org.kie.dmn.api.core.DMNDecisionResult.DecisionEvaluationStatus.EVALUATING;
 import static 
org.kie.dmn.api.core.DMNDecisionResult.DecisionEvaluationStatus.FAILED;
 import static 
org.kie.dmn.api.core.DMNDecisionResult.DecisionEvaluationStatus.SKIPPED;
+import static org.kie.dmn.core.compiler.UnnamedImportUtils.isInUnnamedImport;
 import static org.kie.dmn.core.util.CoerceUtil.coerceValue;
 
 public class DMNRuntimeImpl
@@ -501,6 +502,9 @@ public class DMNRuntimeImpl
         if (result.getContext().scopeNamespace().isEmpty()) {
             if 
(destinationNode.getModelNamespace().equals(result.getModel().getNamespace())) {
                 return false;
+            } else if (isInUnnamedImport(destinationNode, (DMNModelImpl) 
result.getModel())) {
+                // the destinationNode is an unnamed import
+                return false;
             } else {
                 Optional<String> importAlias = 
callerNode.getModelImportAliasFor(destinationNode.getModelNamespace(), 
destinationNode.getModelName());
                 if (importAlias.isPresent()) {
diff --git 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNCompilerTest.java 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNCompilerTest.java
index 71e63c9d83..4f4773bfc1 100644
--- a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNCompilerTest.java
+++ b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNCompilerTest.java
@@ -272,6 +272,98 @@ public class DMNCompilerTest extends BaseVariantTest {
         }
     }
 
+    @Test
+    public void testEmptyNamedModelImport() {
+        final DMNRuntime runtime = 
createRuntimeWithAdditionalResources("Importing_EmptyNamed_Model.dmn",
+                                                                        
this.getClass(),
+                                                                        
"Imported_Model_Unamed.dmn");
+
+        final DMNModel importedModel = 
runtime.getModel("http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f-9848-11ba35e0df36";,
+                                                        "Imported Model");
+        assertThat(importedModel).isNotNull();
+        for (final DMNMessage message : importedModel.getMessages()) {
+            LOG.debug("{}", message);
+        }
+
+        final DMNModel importingModel = 
runtime.getModel("http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc";,
+                                                   "Importing empty-named 
Model");
+        assertThat(importingModel).isNotNull();
+        for (final DMNMessage message : importingModel.getMessages()) {
+            LOG.debug("{}", message);
+        }
+
+        final DMNContext context = runtime.newContext();
+        context.set("A Person", mapOf(entry("name", "John"), entry("age", 
47)));
+
+        final DMNResult evaluateAll = evaluateModel(runtime, importingModel, 
context);
+        for (final DMNMessage message : evaluateAll.getMessages()) {
+            LOG.debug("{}", message);
+        }
+        LOG.debug("{}", evaluateAll);
+        // Verify locally-defined BusinessKnowledgeModel
+        assertThat(evaluateAll.getDecisionResultByName("Local 
Greeting").getResult()).isEqualTo("Local Hello John!");
+
+        if (isTypeSafe()) {
+            FEELPropertyAccessible outputSet = 
((DMNContextFPAImpl)evaluateAll.getContext()).getFpa();
+            Map<String, Object> allProperties = outputSet.allFEELProperties();
+            assertThat(allProperties).containsEntry("Local Greeting", "Local 
Hello John!");
+        }
+        // Verify unnamed-imported BusinessKnowledgeModel
+        assertThat(evaluateAll.getDecisionResultByName("Imported 
Greeting").getResult()).isEqualTo("Hello John!");
+
+        if (isTypeSafe()) {
+            FEELPropertyAccessible outputSet = 
((DMNContextFPAImpl)evaluateAll.getContext()).getFpa();
+            Map<String, Object> allProperties = outputSet.allFEELProperties();
+            assertThat(allProperties).containsEntry("Imported Greeting", 
"Hello John!");
+        }
+    }
+
+    @Test
+    public void testOverridingEmptyNamedModelImport() {
+        final DMNRuntime runtime = 
createRuntimeWithAdditionalResources("Importing_OverridingEmptyNamed_Model.dmn",
+                                                                        
this.getClass(),
+                                                                        
"Imported_Model_Unamed.dmn");
+
+        final DMNModel importedModel = 
runtime.getModel("http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f-9848-11ba35e0df36";,
+                                                        "Imported Model");
+        assertThat(importedModel).isNotNull();
+        for (final DMNMessage message : importedModel.getMessages()) {
+            LOG.debug("{}", message);
+        }
+
+        final DMNModel importingModel = 
runtime.getModel("http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc";,
+                                                         "Importing 
empty-named Model");
+        assertThat(importingModel).isNotNull();
+        for (final DMNMessage message : importingModel.getMessages()) {
+            LOG.debug("{}", message);
+        }
+
+        final DMNContext context = runtime.newContext();
+        context.set("A Person", mapOf(entry("name", "John"), entry("age", 
47)));
+
+        final DMNResult evaluateAll = evaluateModel(runtime, importingModel, 
context);
+        for (final DMNMessage message : evaluateAll.getMessages()) {
+            LOG.debug("{}", message);
+        }
+        LOG.debug("{}", evaluateAll);
+        // Verify locally-defined BusinessKnowledgeModel
+        assertThat(evaluateAll.getDecisionResultByName("Local 
Greeting").getResult()).isEqualTo("Local Hello John!");
+
+        if (isTypeSafe()) {
+            FEELPropertyAccessible outputSet = 
((DMNContextFPAImpl)evaluateAll.getContext()).getFpa();
+            Map<String, Object> allProperties = outputSet.allFEELProperties();
+            assertThat(allProperties).containsEntry("Local Greeting", "Local 
Hello John!");
+        }
+        // Verify unnamed-imported BusinessKnowledgeModel
+        assertThat(evaluateAll.getDecisionResultByName("Imported 
Greeting").getResult()).isEqualTo("Hello John!");
+
+        if (isTypeSafe()) {
+            FEELPropertyAccessible outputSet = 
((DMNContextFPAImpl)evaluateAll.getContext()).getFpa();
+            Map<String, Object> allProperties = outputSet.allFEELProperties();
+            assertThat(allProperties).containsEntry("Imported Greeting", 
"Hello John!");
+        }
+    }
+
     @Test
     public void testWrongComparisonOps() {
         final DMNRuntime runtime = createRuntime("WrongComparisonOps.dmn", 
this.getClass());
diff --git 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/UnnamedImportUtilsTest.java
 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/UnnamedImportUtilsTest.java
new file mode 100644
index 0000000000..f92c8a1c93
--- /dev/null
+++ 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/UnnamedImportUtilsTest.java
@@ -0,0 +1,118 @@
+package org.kie.dmn.core.compiler;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.drools.util.FileUtils;
+import org.junit.Test;
+import org.kie.dmn.api.core.DMNModel;
+import org.kie.dmn.api.core.DMNRuntime;
+import org.kie.dmn.backend.marshalling.v1x.DMNMarshallerFactory;
+import org.kie.dmn.core.impl.DMNModelImpl;
+import org.kie.dmn.core.util.DMNRuntimeUtil;
+import org.kie.dmn.model.api.Definitions;
+import org.kie.dmn.model.api.NamedElement;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.*;
+import static org.kie.dmn.core.compiler.UnnamedImportUtils.addIfNotPresent;
+import static org.kie.dmn.core.compiler.UnnamedImportUtils.isInUnnamedImport;
+
+public class UnnamedImportUtilsTest {
+
+    @Test
+    public void isInUnnamedImportTrue() {
+        File importingModelFile = 
FileUtils.getFile("Importing_EmptyNamed_Model.dmn");
+        assertThat(importingModelFile).isNotNull().exists();
+        File importedModelFile = 
FileUtils.getFile("Imported_Model_Unamed.dmn");
+        assertThat(importedModelFile).isNotNull().exists();
+        final DMNRuntime runtime = 
DMNRuntimeUtil.createRuntimeWithAdditionalResources(importingModelFile,
+                                                                               
        importedModelFile);
+
+        final DMNModel importedModel = 
runtime.getModel("http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f-9848-11ba35e0df36";,
+                                                        "Imported Model");
+        assertThat(importedModel).isNotNull();
+        final DMNModelImpl importingModel = 
(DMNModelImpl)runtime.getModel("http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc";,
+                                                             "Importing 
empty-named Model");
+        assertThat(importingModel).isNotNull();
+        importedModel.getDecisions().forEach(node -> 
assertTrue(isInUnnamedImport(node, importingModel)));
+        importedModel.getBusinessKnowledgeModels().forEach(node -> 
assertTrue(isInUnnamedImport(node, importingModel)));
+        importedModel.getDecisionServices().forEach(node -> 
assertTrue(isInUnnamedImport(node, importingModel)));
+        importedModel.getInputs().forEach(node -> 
assertTrue(isInUnnamedImport(node, importingModel)));
+        importedModel.getItemDefinitions().forEach(node -> 
assertTrue(isInUnnamedImport(node, importingModel)));
+    }
+
+    @Test
+    public void isInUnnamedImportFalse() {
+        File importingModelFile = 
FileUtils.getFile("Importing_Named_Model.dmn");
+        assertThat(importingModelFile).isNotNull().exists();
+        File importedModelFile = 
FileUtils.getFile("Imported_Model_Unamed.dmn");
+        assertThat(importedModelFile).isNotNull().exists();
+        final DMNRuntime runtime = 
DMNRuntimeUtil.createRuntimeWithAdditionalResources(importingModelFile,
+                                                                               
        importedModelFile);
+
+        final DMNModel importedModel = 
runtime.getModel("http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f-9848-11ba35e0df36";,
+                                                        "Imported Model");
+        assertThat(importedModel).isNotNull();
+        final DMNModelImpl importingModel = 
(DMNModelImpl)runtime.getModel("http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc";,
+                                                                           
"Importing named Model");
+        assertThat(importingModel).isNotNull();
+        importedModel.getDecisions().forEach(node -> 
assertFalse(isInUnnamedImport(node, importingModel)));
+        importedModel.getBusinessKnowledgeModels().forEach(node -> 
assertFalse(isInUnnamedImport(node, importingModel)));
+        importedModel.getDecisionServices().forEach(node -> 
assertFalse(isInUnnamedImport(node, importingModel)));
+        importedModel.getInputs().forEach(node -> 
assertFalse(isInUnnamedImport(node, importingModel)));
+        importedModel.getItemDefinitions().forEach(node -> 
assertFalse(isInUnnamedImport(node, importingModel)));
+    }
+
+    @Test
+    public void addIfNotPresentTrue() throws IOException {
+        File importedModelFile = 
FileUtils.getFile("Imported_Model_Unamed.dmn");
+        assertThat(importedModelFile).isNotNull().exists();
+
+        String xml = new 
String(Files.readAllBytes(Paths.get(importedModelFile.toURI())));
+        Definitions definitions = 
DMNMarshallerFactory.newDefaultMarshaller().unmarshal(xml);
+        definitions.getDecisionService().forEach(definition ->  
assertTrue(added(definition)));
+        definitions.getBusinessContextElement().forEach(definition ->  
assertTrue(added(definition)));
+        definitions.getDrgElement().forEach(definition ->  
assertTrue(added(definition)));
+        definitions.getImport().forEach(definition ->  
assertTrue(added(definition)));
+        definitions.getItemDefinition().forEach(definition ->  
assertTrue(added(definition)));
+    }
+
+    @Test
+    public void addIfNotPresentFalse() throws IOException {
+        File importingModelFile = 
FileUtils.getFile("Importing_OverridingEmptyNamed_Model.dmn");
+        assertThat(importingModelFile).isNotNull().exists();
+        File importedModelFile = 
FileUtils.getFile("Imported_Model_Unamed.dmn");
+        assertThat(importedModelFile).isNotNull().exists();
+        final DMNRuntime runtime = 
DMNRuntimeUtil.createRuntimeWithAdditionalResources(importingModelFile,
+                                                                               
        importedModelFile);
+
+        final DMNModelImpl importingModel = 
(DMNModelImpl)runtime.getModel("http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc";,
+                                                                           
"Importing empty-named Model");
+        assertThat(importingModel).isNotNull();
+
+        Definitions importingDefinitions = importingModel.getDefinitions();
+
+        String importedXml = new 
String(Files.readAllBytes(Paths.get(importedModelFile.toURI())));
+        Definitions importedDefinitions = 
DMNMarshallerFactory.newDefaultMarshaller().unmarshal(importedXml);
+        importedDefinitions.getDecisionService().forEach(definition ->  
assertFalse(added(importingDefinitions.getDecisionService(), definition)));
+        importedDefinitions.getBusinessContextElement().forEach(definition ->  
assertFalse(added(importingDefinitions.getBusinessContextElement(), 
definition)));
+        importedDefinitions.getDrgElement().forEach(definition -> 
assertFalse(added(importingDefinitions.getDrgElement(), definition)));
+        importedDefinitions.getImport().forEach(definition ->  
assertFalse(added(importingDefinitions.getImport(), definition)));
+        importedDefinitions.getItemDefinition().forEach(definition ->  
assertFalse(added(importingDefinitions.getItemDefinition(), definition)));
+    }
+
+    private  <T extends NamedElement> boolean added(T source) {
+        return added(new ArrayList<>(), source);
+    }
+
+    private  <T extends NamedElement> boolean added(Collection<T> target, T 
source) {
+        addIfNotPresent(target, source);
+        return target.contains(source);
+    }
+
+}
\ No newline at end of file
diff --git 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/util/DMNRuntimeUtil.java 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/util/DMNRuntimeUtil.java
index 102b8ba3de..90d8b37420 100644
--- 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/util/DMNRuntimeUtil.java
+++ 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/util/DMNRuntimeUtil.java
@@ -117,6 +117,23 @@ public final class DMNRuntimeUtil {
         return runtime;
     }
 
+    public static DMNRuntime createRuntimeWithAdditionalResources(final File 
resourceFile, final File... additionalResourceFiles) {
+        final KieServices ks = KieServices.Factory.get();
+        Resource mainResource = 
ks.getResources().newFileSystemResource(resourceFile);
+        List<Resource> totalResources = new ArrayList<>();
+        totalResources.add(mainResource);
+        for ( File add : additionalResourceFiles ) {
+            totalResources.add( ks.getResources().newFileSystemResource(add) );
+        }
+        final KieContainer kieContainer = KieHelper.getKieContainer(
+                ks.newReleaseId("org.kie", "dmn-test-"+UUID.randomUUID(), 
"1.0"),
+                totalResources.toArray(new Resource[] {}));
+
+        final DMNRuntime runtime = typeSafeGetKieRuntime(kieContainer);
+        assertThat(runtime).isNotNull();
+        return runtime;
+    }
+
     public static DMNRuntime typeSafeGetKieRuntime(final KieContainer 
kieContainer) {
         DMNRuntime dmnRuntime = 
kieContainer.newKieSession().getKieRuntime(DMNRuntime.class);
         ((DMNRuntimeImpl) dmnRuntime).setOption(new 
RuntimeTypeCheckOption(true));
diff --git 
a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Imported_Model_Unamed.dmn
 
b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Imported_Model_Unamed.dmn
new file mode 100644
index 0000000000..d32261f9d4
--- /dev/null
+++ 
b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Imported_Model_Unamed.dmn
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<semantic:definitions 
xmlns="http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f-9848-11ba35e0df36";
+                      xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/";
+                      xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/";
+                      
xmlns:dmndi="https://www.omg.org/spec/DMN/20230324/DMNDI/";
+                      xmlns:feel="https://www.omg.org/spec/DMN/20230324/FEEL/";
+                      
xmlns:semantic="https://www.omg.org/spec/DMN/20230324/MODEL/";
+                      xmlns:tc="http://www.omg.org/spec/DMN/20160719/testcase";
+                      xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+                      exporter="DMN Modeler"
+                      exporterVersion="6.0.3.201802231629"
+                      id="_f27bb64b-6fc7-4e1f-9848-11ba35e0df36"
+                      name="Imported Model"
+                      
namespace="http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f-9848-11ba35e0df36";>
+   <semantic:extensionElements>
+  </semantic:extensionElements>
+
+  <semantic:inputData id="_51190b90-924d-479b-872b-4c6f3486c2de" name="An 
Imported Person">
+    <semantic:variable id="_44a44de4-c0ab-408e-9ba9-983d8ec2f6c6"
+                       name="An Imported Person"
+                       typeRef="tPerson"/>
+  </semantic:inputData>
+  <semantic:decision id="_bf4a9628-15ae-4887-97f2-7099426cb61g" name="Remote 
Greeting">
+    <semantic:variable id="_ecc6e0bb-a0af-4e99-aac6-5b8bed09c549"
+                       name="Remote Greeting"
+                       typeRef="string"/>
+    <semantic:informationRequirement>
+      <semantic:requiredInput href="#_51190b90-924d-479b-872b-4c6f3486c2de"/>
+    </semantic:informationRequirement>
+    <semantic:knowledgeRequirement>
+      <semantic:requiredKnowledge 
href="#_32543811-b499-4608-b784-6c6f294b1c58"/>
+    </semantic:knowledgeRequirement>
+    <semantic:literalExpression 
xmlns:triso="http://www.trisotech.com/2015/triso/modeling";
+                                id="_d7e6836b-8491-487a-a653-5735daa85bf2"
+                                triso:unparsed="true">
+      <semantic:text>Say Hello( An Imported Person )</semantic:text>
+    </semantic:literalExpression>
+  </semantic:decision>
+
+  <semantic:decisionService id="_70386614-9838-420b-a2ae-ff901ada63fb"
+                            name="Remote Greeting Service">
+    <semantic:description>Remote Greeting Service</semantic:description>
+    <semantic:variable name="Remote Greeting Hello" typeRef="string"/>
+    <semantic:encapsulatedDecision 
href="#_bf4a9628-15ae-4887-97f2-7099426cb61g"/>
+  </semantic:decisionService>
+
+   <semantic:itemDefinition label="tPerson" name="tPerson">
+      <semantic:itemComponent id="_9bb0759c-b3c1-482f-87f5-c047dc65cef0" 
name="name">
+         <semantic:typeRef>string</semantic:typeRef>
+      </semantic:itemComponent>
+      <semantic:itemComponent id="_929acc15-101c-4e49-9b11-494fff411e50" 
name="age">
+         <semantic:typeRef>number</semantic:typeRef>
+      </semantic:itemComponent>
+   </semantic:itemDefinition>
+   <semantic:businessKnowledgeModel id="_32543811-b499-4608-b784-6c6f294b1c58" 
name="Say Hello">
+      <semantic:variable id="_a8eb10e1-30e6-40d8-a564-a868f4e0af34"
+                         name="Say Hello"
+                         typeRef="string"/>
+      <semantic:encapsulatedLogic kind="FEEL" 
id="_acbb96c9-34a3-4628-8179-dfc5f583e695">
+         <semantic:formalParameter id="_4a626f74-2ecc-4759-b76a-04baec6b795d"
+                                   name="Person"
+                                   typeRef="tPerson"/>
+         <semantic:literalExpression 
id="_c173a894-3719-4d2f-a365-25850e217310">
+            <semantic:text>"Hello " + Person.name + "!"</semantic:text>
+         </semantic:literalExpression>
+      </semantic:encapsulatedLogic>
+   </semantic:businessKnowledgeModel>
+</semantic:definitions>
diff --git 
a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Importing_EmptyNamed_Model.dmn
 
b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Importing_EmptyNamed_Model.dmn
new file mode 100644
index 0000000000..ff2d5d2720
--- /dev/null
+++ 
b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Importing_EmptyNamed_Model.dmn
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<semantic:definitions 
xmlns="http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc";
+                      xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/";
+                      xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/";
+                      xmlns:dmndi="http://www.omg.org/spec/DMN/20180521/DMNDI/";
+                      xmlns:feel="http://www.omg.org/spec/DMN/20180521/FEEL/";
+                      
xmlns:semantic="http://www.omg.org/spec/DMN/20180521/MODEL/";
+                      xmlns:tc="http://www.omg.org/spec/DMN/20160719/testcase";
+                      xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+                      exporter="DMN Modeler"
+                      exporterVersion="6.0.3.201802231629"
+                      id="_f79aa7a4-f9a3-410a-ac95-bea496edabgc"
+                      name="Importing empty-named Model"
+                      
namespace="http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc";>
+   <semantic:extensionElements>
+  </semantic:extensionElements>
+   <semantic:import xmlns:drools="http://www.drools.org/kie/dmn/1.1";
+                    xmlns:triso="http://www.trisotech.com/2015/triso/modeling";
+                    
importType="http://www.omg.org/spec/DMN1-2Alpha/20160929/MODEL";
+                    
namespace="http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f-9848-11ba35e0df36";
+                    name=""
+                    drools:modelName="Imported Model"
+                    
triso:fileId="eyJmIjp7InNrdSI6IjEwMmM0MDQ3LTg5NjctNGI3ZS1hODgxLTBhY2ZkNWJjOTAwMiIsIm5hbWUiOiJJbXBvcnRlZCBNb2RlbCJ9fQ=="
+                    triso:fileName="Edson Tirelli/Imported Model"/>
+   <semantic:inputData id="_51190b90-924d-479b-872b-4c6f3486c2cb" name="A 
Person">
+      <semantic:variable id="_44a44de4-c0ab-408e-9ba9-983d8ec2f6b5"
+                         name="A Person"
+                         typeRef="tPerson"/>
+   </semantic:inputData>
+   <semantic:decision id="_bf4a9628-15ae-4887-97f2-7099426cb60f" name="Local 
Greeting">
+      <semantic:variable id="_ecc6e0bb-a0af-4e99-aac6-5b8bed09c538"
+                         name="Local Greeting"
+                         typeRef="string"/>
+      <semantic:informationRequirement>
+         <semantic:requiredInput 
href="#_51190b90-924d-479b-872b-4c6f3486c2cb"/>
+      </semantic:informationRequirement>
+     <semantic:knowledgeRequirement>
+       <semantic:requiredKnowledge 
href="#_42543811-b499-4608-b784-6c6f294b1c59"/>
+     </semantic:knowledgeRequirement>
+      <semantic:literalExpression 
xmlns:triso="http://www.trisotech.com/2015/triso/modeling";
+                                  id="_d7e6836b-8491-487a-a653-5735daa85be1"
+                                  triso:unparsed="true">
+         <semantic:text>Local Hello( A Person )</semantic:text>
+      </semantic:literalExpression>
+   </semantic:decision>
+
+  <semantic:decision id="_bf4a9628-15ae-4887-97f2-7099426cb60g" name="Imported 
Greeting">
+    <semantic:variable id="_ecc6e0bb-a0af-4e99-aac6-5b8bed09c539"
+                       name="Imported Greeting"
+                       typeRef="string"/>
+    <semantic:informationRequirement>
+      <semantic:requiredInput href="#_51190b90-924d-479b-872b-4c6f3486c2cb"/>
+    </semantic:informationRequirement>
+    <semantic:knowledgeRequirement>
+      <semantic:requiredKnowledge 
href="#_32543811-b499-4608-b784-6c6f294b1c58"/>
+    </semantic:knowledgeRequirement>
+    <semantic:literalExpression 
xmlns:triso="http://www.trisotech.com/2015/triso/modeling";
+                                id="_d7e6836b-8491-487a-a653-5735daa85be2"
+                                triso:unparsed="true">
+      <semantic:text>Say Hello( A Person )</semantic:text>
+    </semantic:literalExpression>
+  </semantic:decision>
+
+  <semantic:businessKnowledgeModel id="_42543811-b499-4608-b784-6c6f294b1c59" 
name="Local Hello">
+    <semantic:variable id="_a8eb10e1-30e6-40d8-a564-a868f4e0af45"
+                       name="Local Hello"
+                       typeRef="string"/>
+    <semantic:encapsulatedLogic kind="FEEL" 
id="_acbb96c9-34a3-4628-8179-dfc5f583e695">
+      <semantic:formalParameter id="_4a626f74-2ecc-4759-b76a-04baec6b795d"
+                                name="Person"
+                                typeRef="tPerson"/>
+      <semantic:literalExpression id="_c173a894-3719-4d2f-a365-25850e217310">
+        <semantic:text>"Local Hello " + Person.name + "!"</semantic:text>
+      </semantic:literalExpression>
+    </semantic:encapsulatedLogic>
+  </semantic:businessKnowledgeModel>
+
+</semantic:definitions>
diff --git 
a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Importing_Named_Model.dmn
 
b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Importing_Named_Model.dmn
new file mode 100644
index 0000000000..e83912d76f
--- /dev/null
+++ 
b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Importing_Named_Model.dmn
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<semantic:definitions 
xmlns="http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc";
+                      xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/";
+                      xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/";
+                      xmlns:dmndi="http://www.omg.org/spec/DMN/20180521/DMNDI/";
+                      xmlns:feel="http://www.omg.org/spec/DMN/20180521/FEEL/";
+                      
xmlns:semantic="http://www.omg.org/spec/DMN/20180521/MODEL/";
+                      xmlns:tc="http://www.omg.org/spec/DMN/20160719/testcase";
+                      xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+                      exporter="DMN Modeler"
+                      exporterVersion="6.0.3.201802231629"
+                      id="_f79aa7a4-f9a3-410a-ac95-bea496edabgc"
+                      name="Importing named Model"
+                      
namespace="http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc";>
+   <semantic:extensionElements>
+  </semantic:extensionElements>
+   <semantic:import xmlns:drools="http://www.drools.org/kie/dmn/1.1";
+                    xmlns:triso="http://www.trisotech.com/2015/triso/modeling";
+                    
importType="http://www.omg.org/spec/DMN1-2Alpha/20160929/MODEL";
+                    
namespace="http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f-9848-11ba35e0df36";
+                    name="Imported Model"
+                    drools:modelName="Imported Model"
+                    
triso:fileId="eyJmIjp7InNrdSI6IjEwMmM0MDQ3LTg5NjctNGI3ZS1hODgxLTBhY2ZkNWJjOTAwMiIsIm5hbWUiOiJJbXBvcnRlZCBNb2RlbCJ9fQ=="
+                    triso:fileName="Edson Tirelli/Imported Model"/>
+   <semantic:inputData id="_51190b90-924d-479b-872b-4c6f3486c2cb" name="A 
Person">
+      <semantic:variable id="_44a44de4-c0ab-408e-9ba9-983d8ec2f6b5"
+                         name="A Person"
+                         typeRef="Imported Model.tPerson"/>
+   </semantic:inputData>
+   <semantic:decision id="_bf4a9628-15ae-4887-97f2-7099426cb60f" name="Local 
Greeting">
+      <semantic:variable id="_ecc6e0bb-a0af-4e99-aac6-5b8bed09c538"
+                         name="Local Greeting"
+                         typeRef="string"/>
+      <semantic:informationRequirement>
+         <semantic:requiredInput 
href="#_51190b90-924d-479b-872b-4c6f3486c2cb"/>
+      </semantic:informationRequirement>
+     <semantic:knowledgeRequirement>
+       <semantic:requiredKnowledge 
href="#_42543811-b499-4608-b784-6c6f294b1c59"/>
+     </semantic:knowledgeRequirement>
+      <semantic:literalExpression 
xmlns:triso="http://www.trisotech.com/2015/triso/modeling";
+                                  id="_d7e6836b-8491-487a-a653-5735daa85be1"
+                                  triso:unparsed="true">
+         <semantic:text>Local Hello( A Person )</semantic:text>
+      </semantic:literalExpression>
+   </semantic:decision>
+
+  <semantic:decision id="_bf4a9628-15ae-4887-97f2-7099426cb60g" name="Imported 
Greeting">
+    <semantic:variable id="_ecc6e0bb-a0af-4e99-aac6-5b8bed09c539"
+                       name="Imported Greeting"
+                       typeRef="string"/>
+    <semantic:informationRequirement>
+      <semantic:requiredInput href="#_51190b90-924d-479b-872b-4c6f3486c2cb"/>
+    </semantic:informationRequirement>
+    <semantic:knowledgeRequirement>
+      <semantic:requiredKnowledge 
href="http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f-9848-11ba35e0df36#_32543811-b499-4608-b784-6c6f294b1c58"/>
+    </semantic:knowledgeRequirement>
+    <semantic:literalExpression 
xmlns:triso="http://www.trisotech.com/2015/triso/modeling";
+                                id="_d7e6836b-8491-487a-a653-5735daa85be2"
+                                triso:unparsed="true">
+      <semantic:text>Imported Model.Say Hello( A Person )</semantic:text>
+    </semantic:literalExpression>
+  </semantic:decision>
+
+  <semantic:businessKnowledgeModel id="_42543811-b499-4608-b784-6c6f294b1c59" 
name="Local Hello">
+    <semantic:variable id="_a8eb10e1-30e6-40d8-a564-a868f4e0af45"
+                       name="Local Hello"
+                       typeRef="string"/>
+    <semantic:encapsulatedLogic kind="FEEL" 
id="_acbb96c9-34a3-4628-8179-dfc5f583e695">
+      <semantic:formalParameter id="_4a626f74-2ecc-4759-b76a-04baec6b795d"
+                                name="Person"
+                                typeRef="Imported Model.tPerson"/>
+      <semantic:literalExpression id="_c173a894-3719-4d2f-a365-25850e217310">
+        <semantic:text>"Local Hello " + Person.name + "!"</semantic:text>
+      </semantic:literalExpression>
+    </semantic:encapsulatedLogic>
+  </semantic:businessKnowledgeModel>
+
+</semantic:definitions>
diff --git 
a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Importing_OverridingEmptyNamed_Model.dmn
 
b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Importing_OverridingEmptyNamed_Model.dmn
new file mode 100644
index 0000000000..63ef659ae0
--- /dev/null
+++ 
b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Importing_OverridingEmptyNamed_Model.dmn
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<semantic:definitions 
xmlns="http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc";
+                      xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/";
+                      xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/";
+                      xmlns:dmndi="http://www.omg.org/spec/DMN/20180521/DMNDI/";
+                      xmlns:feel="http://www.omg.org/spec/DMN/20180521/FEEL/";
+                      
xmlns:semantic="http://www.omg.org/spec/DMN/20180521/MODEL/";
+                      xmlns:tc="http://www.omg.org/spec/DMN/20160719/testcase";
+                      xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+                      exporter="DMN Modeler"
+                      exporterVersion="6.0.3.201802231629"
+                      id="_f79aa7a4-f9a3-410a-ac95-bea496edabgc"
+                      name="Importing empty-named Model"
+                      
namespace="http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc";>
+   <semantic:extensionElements>
+  </semantic:extensionElements>
+   <semantic:import xmlns:drools="http://www.drools.org/kie/dmn/1.1";
+                    xmlns:triso="http://www.trisotech.com/2015/triso/modeling";
+                    
importType="http://www.omg.org/spec/DMN1-2Alpha/20160929/MODEL";
+                    
namespace="http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f-9848-11ba35e0df36";
+                    name=""
+                    drools:modelName="Imported Model"
+                    
triso:fileId="eyJmIjp7InNrdSI6IjEwMmM0MDQ3LTg5NjctNGI3ZS1hODgxLTBhY2ZkNWJjOTAwMiIsIm5hbWUiOiJJbXBvcnRlZCBNb2RlbCJ9fQ=="
+                    triso:fileName="Edson Tirelli/Imported Model"/>
+   <semantic:inputData id="_51190b90-924d-479b-872b-4c6f3486c2cb" name="A 
Person">
+      <semantic:variable id="_44a44de4-c0ab-408e-9ba9-983d8ec2f6b5"
+                         name="A Person"
+                         typeRef="tPerson"/>
+   </semantic:inputData>
+  <semantic:itemDefinition label="tPerson" name="tPerson">
+    <semantic:itemComponent id="_9bb0759c-b3c1-482f-87f5-c047dc65ceg1" 
name="name">
+      <semantic:typeRef>string</semantic:typeRef>
+    </semantic:itemComponent>
+    <semantic:itemComponent id="_929acc15-101c-4e49-9b11-494fff411e61" 
name="age">
+      <semantic:typeRef>number</semantic:typeRef>
+    </semantic:itemComponent>
+  </semantic:itemDefinition>
+   <semantic:decision id="_bf4a9628-15ae-4887-97f2-7099426cb60f" name="Local 
Greeting">
+      <semantic:variable id="_ecc6e0bb-a0af-4e99-aac6-5b8bed09c538"
+                         name="Local Greeting"
+                         typeRef="string"/>
+      <semantic:informationRequirement>
+         <semantic:requiredInput 
href="#_51190b90-924d-479b-872b-4c6f3486c2cb"/>
+      </semantic:informationRequirement>
+     <semantic:knowledgeRequirement>
+       <semantic:requiredKnowledge 
href="#_42543811-b499-4608-b784-6c6f294b1c59"/>
+     </semantic:knowledgeRequirement>
+      <semantic:literalExpression 
xmlns:triso="http://www.trisotech.com/2015/triso/modeling";
+                                  id="_d7e6836b-8491-487a-a653-5735daa85be1"
+                                  triso:unparsed="true">
+         <semantic:text>Local Hello( A Person )</semantic:text>
+      </semantic:literalExpression>
+   </semantic:decision>
+
+  <semantic:decision id="_bf4a9628-15ae-4887-97f2-7099426cb60g" name="Imported 
Greeting">
+    <semantic:variable id="_ecc6e0bb-a0af-4e99-aac6-5b8bed09c539"
+                       name="Imported Greeting"
+                       typeRef="string"/>
+    <semantic:informationRequirement>
+      <semantic:requiredInput href="#_51190b90-924d-479b-872b-4c6f3486c2cb"/>
+    </semantic:informationRequirement>
+    <semantic:knowledgeRequirement>
+      <semantic:requiredKnowledge 
href="#_32543811-b499-4608-b784-6c6f294b1c58"/>
+    </semantic:knowledgeRequirement>
+    <semantic:literalExpression 
xmlns:triso="http://www.trisotech.com/2015/triso/modeling";
+                                id="_d7e6836b-8491-487a-a653-5735daa85be2"
+                                triso:unparsed="true">
+      <semantic:text>Say Hello( A Person )</semantic:text>
+    </semantic:literalExpression>
+  </semantic:decision>
+  <semantic:decisionService id="_70386614-9838-420b-a2ae-ff901ada63gc"
+                            name="Remote Greeting Service">
+    <semantic:description>Remote Greeting Service</semantic:description>
+    <semantic:variable name="Remote Greeting Hello" typeRef="string"/>
+    <semantic:encapsulatedDecision 
href="#_bf4a9628-15ae-4887-97f2-7099426cb60g"/>
+  </semantic:decisionService>
+
+  <semantic:businessKnowledgeModel id="_42543811-b499-4608-b784-6c6f294b1c59" 
name="Local Hello">
+    <semantic:variable id="_a8eb10e1-30e6-40d8-a564-a868f4e0af45"
+                       name="Local Hello"
+                       typeRef="string"/>
+    <semantic:encapsulatedLogic kind="FEEL" 
id="_acbb96c9-34a3-4628-8179-dfc5f583e695">
+      <semantic:formalParameter id="_4a626f74-2ecc-4759-b76a-04baec6b795d"
+                                name="Person"
+                                typeRef="tPerson"/>
+      <semantic:literalExpression id="_c173a894-3719-4d2f-a365-25850e217310">
+        <semantic:text>"Local Hello " + Person.name + "!"</semantic:text>
+      </semantic:literalExpression>
+    </semantic:encapsulatedLogic>
+  </semantic:businessKnowledgeModel>
+
+</semantic:definitions>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to