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 9da33cd531 [incubator-kie-issues#1748] DMNCompilerImpl class code 
refactoring and Test cases (#6267)
9da33cd531 is described below

commit 9da33cd5316adb93599492219ada896eaafd3e65
Author: ChinchuAjith <[email protected]>
AuthorDate: Mon Mar 24 18:24:39 2025 +0530

    [incubator-kie-issues#1748] DMNCompilerImpl class code refactoring and Test 
cases (#6267)
    
    * TestCases for DMNCompilerImpl class
    
    * TestCases for DMNCompilerImpl class
    
    * TestCases for DMNCompilerImpl class - changes in assertions
    
    * TestCases for DMNCompilerImpl class - changes in assertions
    
    * Changing Testcase names
    
    * Refactoring Compile method
    
    * Refactoring Compile method
    
    * Refactoring Compile method
    
    * Refactoring Compile method-Incorporating review comments, code cleanup
    
    * Test cases for refactored method
    
    * Review Comments fix
    
    * Review Comments fix:replace if/else with switch in DMNCompilerImpl class
    
    * [incubator-kie-issues#1748] Refactoring and unit testing 
DMNCompilerImpl#resolvePMMLImportType
    
    * Review Comments fix
    
    * Moving static classes to the Util class and Renaming the util class to 
DMNImportsUtil.
    
    * Adding javaDoc
    
    * Added test case for invalidDMN and mocked the static methods
    
    * Added test case for invalidDMN and mocked the static methods
    
    * [incubator-kie-issues#1748] Minor refactoring unit test
    
    * Correcting dmn file name
    
    * Adding Javadoc for newly created Methods
    
    * Updating Javadoc for newly created Methods
    
    ---------
    
    Co-authored-by: Gabriele-Cardosi <[email protected]>
---
 .../dmn/core/assembler/DMNAssemblerService.java    |  11 +-
 .../org/kie/dmn/core/compiler/DMNCompilerImpl.java | 145 +++++------
 .../org/kie/dmn/core/compiler/DMNImportsUtil.java  | 264 +++++++++++++++++++++
 .../dmn/core/compiler/ImportDMNResolverUtil.java   | 133 -----------
 .../kie/dmn/core/compiler/DMNCompilerImplTest.java | 190 +++++++++++++--
 ...solverUtilTest.java => DMNImportsUtilTest.java} | 143 +++++++++--
 .../DMNv1_2/dmn-validation-rules-dmndi.drl         |   4 +-
 .../DMNv1_2/dmn-validation-rules-typeref.drl       |  18 +-
 .../DMNv1_3/dmn-validation-rules-dmndi.drl         |   4 +-
 .../DMNv1_3/dmn-validation-rules-typeref.drl       |  18 +-
 .../dmn/validation/DMNv1x/dmn-validation-rules.drl |   6 +-
 11 files changed, 649 insertions(+), 287 deletions(-)

diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/assembler/DMNAssemblerService.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/assembler/DMNAssemblerService.java
index 77e1421b4c..746282aede 100644
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/assembler/DMNAssemblerService.java
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/assembler/DMNAssemblerService.java
@@ -43,12 +43,13 @@ import org.kie.dmn.api.core.DMNMessage;
 import org.kie.dmn.api.core.DMNModel;
 import org.kie.dmn.api.marshalling.DMNMarshaller;
 import org.kie.dmn.core.api.DMNFactory;
+
 import org.kie.dmn.core.compiler.DMNCompilerConfigurationImpl;
 import org.kie.dmn.core.compiler.DMNCompilerImpl;
+import org.kie.dmn.core.compiler.DMNImportsUtil;
+import org.kie.dmn.core.compiler.DMNImportsUtil.ImportType;
 import org.kie.dmn.core.compiler.DMNDecisionLogicCompilerFactory;
 import org.kie.dmn.core.compiler.DMNProfile;
-import org.kie.dmn.core.compiler.ImportDMNResolverUtil;
-import org.kie.dmn.core.compiler.ImportDMNResolverUtil.ImportType;
 import org.kie.dmn.core.compiler.RuntimeTypeCheckOption;
 import org.kie.dmn.core.compiler.profiles.ExtendedDMNProfile;
 import org.kie.dmn.core.impl.DMNKnowledgeBuilderError;
@@ -132,10 +133,10 @@ public class DMNAssemblerService implements 
KieAssemblerService {
     public static void 
enrichDMNResourcesWithImportsDependencies(List<DMNResource> dmnResources, 
Collection<DMNModel> dmnModels) {
         for (DMNResource r : dmnResources) {
             for (Import i : r.getDefinitions().getImport()) {
-                if (ImportDMNResolverUtil.whichImportType(i) == 
ImportType.DMN) {
-                    Either<String, DMNModel> inAlreadyCompiled = 
ImportDMNResolverUtil.resolveImportDMN(i, dmnModels, x -> new 
QName(x.getNamespace(), x.getName()));
+                if (DMNImportsUtil.whichImportType(i) == ImportType.DMN) {
+                    Either<String, DMNModel> inAlreadyCompiled = 
DMNImportsUtil.resolveImportDMN(i, dmnModels, x -> new QName(x.getNamespace(), 
x.getName()));
                     if (inAlreadyCompiled.isLeft()) { // the DMN Model is not 
already available in the KieBuilder and needs to be compiled.
-                        Either<String, DMNResource> resolvedResult = 
ImportDMNResolverUtil.resolveImportDMN(i, dmnResources, 
DMNResource::getModelID);
+                        Either<String, DMNResource> resolvedResult = 
DMNImportsUtil.resolveImportDMN(i, dmnResources, DMNResource::getModelID);
                         DMNResource located = 
resolvedResult.getOrElseThrow(RuntimeException::new);
                         r.addDependency(located.getModelID());
                     } else {
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 4b6db70be7..d637ccf91a 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
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -6,9 +6,7 @@
  * 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
- *
+ * 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
@@ -19,7 +17,6 @@
 package org.kie.dmn.core.compiler;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.Reader;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -33,7 +30,6 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
 import java.util.Map;
-import java.util.Optional;
 import java.util.Set;
 import java.util.UUID;
 import java.util.function.Consumer;
@@ -41,9 +37,7 @@ import java.util.function.Function;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
-
 import javax.xml.namespace.QName;
-
 import org.drools.io.FileSystemResource;
 import org.kie.api.io.Resource;
 import org.kie.dmn.api.core.DMNCompiler;
@@ -56,7 +50,6 @@ import org.kie.dmn.api.core.ast.DMNNode;
 import org.kie.dmn.api.core.ast.DecisionNode;
 import org.kie.dmn.api.core.ast.DecisionServiceNode;
 import org.kie.dmn.api.core.ast.InputDataNode;
-import org.kie.dmn.api.core.ast.ItemDefNode;
 import org.kie.dmn.api.marshalling.DMNExtensionRegister;
 import org.kie.dmn.api.marshalling.DMNMarshaller;
 import org.kie.dmn.backend.marshalling.v1x.DMNMarshallerFactory;
@@ -66,13 +59,12 @@ import org.kie.dmn.core.ast.DMNBaseNode;
 import org.kie.dmn.core.ast.DecisionNodeImpl;
 import org.kie.dmn.core.ast.DecisionServiceNodeImpl;
 import org.kie.dmn.core.ast.ItemDefNodeImpl;
-import org.kie.dmn.core.compiler.ImportDMNResolverUtil.ImportType;
+import org.kie.dmn.core.compiler.DMNImportsUtil.ImportType;
 import org.kie.dmn.core.impl.BaseDMNTypeImpl;
 import org.kie.dmn.core.impl.CompositeTypeImpl;
 import org.kie.dmn.core.impl.DMNModelImpl;
 import org.kie.dmn.core.impl.SimpleFnTypeImpl;
 import org.kie.dmn.core.impl.SimpleTypeImpl;
-import org.kie.dmn.core.pmml.DMNImportPMMLInfo;
 import org.kie.dmn.core.util.Msg;
 import org.kie.dmn.core.util.MsgUtil;
 import org.kie.dmn.core.util.NamespaceUtil;
@@ -84,7 +76,6 @@ import org.kie.dmn.feel.lang.types.BuiltInType;
 import org.kie.dmn.feel.lang.types.GenFnType;
 import org.kie.dmn.feel.lang.types.GenListType;
 import org.kie.dmn.feel.runtime.UnaryTest;
-import org.kie.dmn.feel.util.Either;
 import org.kie.dmn.model.api.DMNElementReference;
 import org.kie.dmn.model.api.DMNModelInstrumentedBase;
 import org.kie.dmn.model.api.DRGElement;
@@ -107,6 +98,10 @@ import org.kie.internal.io.ResourceFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
+import static org.kie.dmn.core.compiler.DMNImportsUtil.resolveDMNImportType;
+import static org.kie.dmn.core.compiler.DMNImportsUtil.logErrorMessage;
+import static org.kie.dmn.core.compiler.DMNImportsUtil.resolvePMMLImportType;
 import static org.kie.dmn.core.compiler.UnnamedImportUtils.processMergedModel;
 
 public class DMNCompilerImpl implements DMNCompiler {
@@ -203,77 +198,71 @@ public class DMNCompilerImpl implements DMNCompiler {
         return null;
     }
 
+    /**
+     * This method compiles a given DMN Definitions object into a DMNModel, 
processing imports, item definitions and DRG elements as part of the 
compilation process.
+     * @param dmndefs : The Definitions object containing the DMN model 
definition to be compiled.
+     * @param dmnModels A collection of existing DMN models that may be used 
during the compilation process.
+     * @param resource The Resource that provides the underlying data for the 
DMN model.
+     * @param relativeResolver A Function that resolves relative paths to 
resources as Reader.
+     * @return A DMNModelImpl representing the compiled DMN model, or null if 
dmndefs is null.
+     */
     public DMNModel compile(Definitions dmndefs, Collection<DMNModel> 
dmnModels, Resource resource, Function<String, Reader> relativeResolver) {
         if (dmndefs == null) {
             return null;
         }
         DMNModelImpl model = new DMNModelImpl(dmndefs, resource);
         model.setRuntimeTypeCheck(((DMNCompilerConfigurationImpl) 
dmnCompilerConfig).getOption(RuntimeTypeCheckOption.class).isRuntimeTypeCheck());
+        DMNCompilerContext ctx = configureDMNCompiler(model.getFeelDialect(), 
relativeResolver);
+        if (!dmndefs.getImport().isEmpty()) {
+            iterateImports(dmndefs, dmnModels, model, relativeResolver );
+        }
+        processItemDefinitions(ctx, model, dmndefs);
+        processDrgElements(ctx, model, dmndefs);
+        return model;
+    }
+
+    /**
+     * This method will Configures and creates a DMNCompilerContext for the 
DMN compiler, setting up the FEEL helper and relative resolver.
+     * @param feeldialect : It used by the DMN compiler for parsing and 
evaluating FEEL expressions.
+     * @param relativeResolver : A Function that resolves relative paths to 
resources as Reader.
+     * @return A configured DMNCompilerContext instance that can be used in 
the DMN compilation process.
+     */
+    private DMNCompilerContext configureDMNCompiler(FEELDialect feeldialect, 
Function<String, Reader> relativeResolver) {
+
         DMNCompilerConfigurationImpl cc = (DMNCompilerConfigurationImpl) 
dmnCompilerConfig;
         List<FEELProfile> helperFEELProfiles = cc.getFeelProfiles();
-        DMNFEELHelper feel = new DMNFEELHelper(cc.getRootClassLoader(), 
helperFEELProfiles, model.getFeelDialect());
+        DMNFEELHelper feel = new DMNFEELHelper(cc.getRootClassLoader(), 
helperFEELProfiles, feeldialect);
         DMNCompilerContext ctx = new DMNCompilerContext(feel);
         ctx.setRelativeResolver(relativeResolver);
+        return ctx;
+    }
+
+    /**
+     * This method is used to iterates over the imports defined in a DMN 
Definitions object and processes each import based on its type.
+     * After processing all imports, it merges models by calling 
processMergedModel method for each merged model.
+     * @param dmndefs : The Definitions object that contains the imports to be 
processed.
+     * @param dmnModels : A collection of existing DMNModel instances that may 
be relevant for resolving imports.
+     * @param model : The DMNModelImpl instance into which the resolved 
imports are applied.
+     * @param relativeResolver : A Function that resolves relative paths to 
resources as Reader.
+     */
+    void iterateImports(Definitions dmndefs, Collection<DMNModel> dmnModels, 
DMNModelImpl model, Function<String, Reader> relativeResolver ) {
         List<DMNModel> toMerge = new ArrayList<>();
-        if (!dmndefs.getImport().isEmpty()) {
-            for (Import i : dmndefs.getImport()) {
-                if (ImportDMNResolverUtil.whichImportType(i) == 
ImportType.DMN) {
-                    Either<String, DMNModel> resolvedResult = 
ImportDMNResolverUtil.resolveImportDMN(i, dmnModels, (DMNModel m) -> new 
QName(m.getNamespace(), m.getName()));
-                    DMNModel located = resolvedResult.cata(msg -> {
-                        MsgUtil.reportMessage(logger,
-                                              DMNMessage.Severity.ERROR,
-                                              i,
-                                              model,
-                                              null,
-                                              null,
-                                              Msg.IMPORT_NOT_FOUND_FOR_NODE,
-                                              msg,
-                                              i);
-                        return null;
-                    }, Function.identity());
-                    if (located != null) {
-                        String iAlias = 
Optional.ofNullable(i.getName()).orElse(located.getName());
-                        // 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);
+        for (Import i : dmndefs.getImport()) {
+            ImportType importType = DMNImportsUtil.whichImportType(i);
+            switch(importType) {
+                case DMN :
+                    resolveDMNImportType(i, dmnModels, model, toMerge);
+                    break;
+                case PMML:
+                    resolvePMMLImportType(model, i, relativeResolver, 
(DMNCompilerConfigurationImpl) dmnCompilerConfig);
                     model.setImportAliasForNS(i.getName(), i.getNamespace(), 
i.getName());
-                } else {
-                    MsgUtil.reportMessage(logger,
-                                          DMNMessage.Severity.ERROR,
-                                          null,
-                                          model,
-                                          null,
-                                          null,
-                                          Msg.IMPORT_TYPE_UNKNOWN,
-                                          i.getImportType());
-                }
+                    break;
+                default :
+                    logErrorMessage(model, i.getImportType());
+                    break;
             }
         }
-
         toMerge.forEach(mergedModel -> processMergedModel(model, 
(DMNModelImpl) mergedModel));
-        processItemDefinitions(ctx, model, dmndefs);
-        processDrgElements(ctx, model, dmndefs);
-        return model;
-    }
-
-    private void processPMMLImport(DMNModelImpl model, Import i, 
Function<String, Reader> relativeResolver) {
-        ClassLoader rootClassLoader = ((DMNCompilerConfigurationImpl) 
dmnCompilerConfig).getRootClassLoader();
-        Resource relativeResource = resolveRelativeResource(rootClassLoader, 
model, i, i, relativeResolver);
-        try (InputStream pmmlIS = relativeResource.getInputStream()) {
-            DMNImportPMMLInfo.from(pmmlIS, (DMNCompilerConfigurationImpl) 
dmnCompilerConfig, model, i).consume(new PMMLImportErrConsumer(model, i),
-                                                                               
                                model::addPMMLImportInfo);
-        } catch (IOException e) {
-            new PMMLImportErrConsumer(model, i).accept(e);
-        }
     }
 
     public static class PMMLImportErrConsumer implements Consumer<Exception> {
@@ -306,7 +295,6 @@ public class DMNCompilerImpl implements DMNCompiler {
         }
 
     }
-
     protected static Resource resolveRelativeResource(ClassLoader classLoader, 
DMNModelImpl model, Import i, DMNModelInstrumentedBase node, Function<String, 
Reader> relativeResolver) {
         if (relativeResolver != null) {
             Reader reader = relativeResolver.apply(i.getLocationURI());
@@ -348,24 +336,7 @@ public class DMNCompilerImpl implements DMNCompiler {
         }
     }
 
-    private void importFromModel(DMNModelImpl model, DMNModel m, String 
iAlias) {
-        model.addImportChainChild(((DMNModelImpl) m).getImportChain(), iAlias);
-        for (ItemDefNode idn : m.getItemDefinitions()) {
-            model.getTypeRegistry().registerType(idn.getType());
-        }
-        for (InputDataNode idn : m.getInputs()) {
-            model.addInput(idn);
-        }
-        for (BusinessKnowledgeModelNode bkm : m.getBusinessKnowledgeModels()) {
-            model.addBusinessKnowledgeModel(bkm);
-        }
-        for (DecisionNode dn : m.getDecisions()) {
-            model.addDecision(dn);
-        }
-        for (DecisionServiceNode dsn : m.getDecisionServices()) {
-            model.addDecisionService(dsn);
-        }
-    }
+
 
     private void processItemDefinitions(DMNCompilerContext ctx, DMNModelImpl 
model, Definitions dmndefs) {
         dmndefs.normalize();
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNImportsUtil.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNImportsUtil.java
new file mode 100644
index 0000000000..ce5c6f09aa
--- /dev/null
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNImportsUtil.java
@@ -0,0 +1,264 @@
+/**
+ * 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.
+ */
+package org.kie.dmn.core.compiler;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.Collection;
+import java.util.List;
+import java.util.Optional;
+import java.util.function.Function;
+
+import javax.xml.namespace.QName;
+
+import org.kie.api.io.Resource;
+import org.kie.dmn.api.core.DMNMessage;
+import org.kie.dmn.api.core.DMNModel;
+import org.kie.dmn.api.core.ast.*;
+import org.kie.dmn.core.impl.DMNModelImpl;
+import org.kie.dmn.core.pmml.DMNImportPMMLInfo;
+import org.kie.dmn.core.util.Msg;
+import org.kie.dmn.core.util.MsgUtil;
+import org.kie.dmn.feel.util.Either;
+import org.kie.dmn.model.api.Definitions;
+import org.kie.dmn.model.api.Import;
+import org.kie.dmn.model.api.NamespaceConsts;
+import org.kie.dmn.model.v1_1.TImport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static 
org.kie.dmn.core.compiler.DMNCompilerImpl.resolveRelativeResource;
+
+public class DMNImportsUtil {
+
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(DMNImportsUtil.class);
+
+    private DMNImportsUtil() {
+        // No constructor for util class.
+    }
+
+    public static <T> Either<String, T> resolveImportDMN(Import importElement, 
Collection<T> dmns, Function<T, QName> idExtractor) {
+        final String importerDMNNamespace = ((Definitions) 
importElement.getParent()).getNamespace();
+        final String importerDMNName = ((Definitions) 
importElement.getParent()).getName();
+        final String importNamespace = importElement.getNamespace();
+        final String importName = importElement.getName();
+        final String importLocationURI = importElement.getLocationURI(); // 
This is optional
+        final String importModelName = 
importElement.getAdditionalAttributes().get(TImport.MODELNAME_QNAME);
+
+        LOGGER.debug("Resolving an Import in DMN Model with name={} and 
namespace={}. " +
+                        "Importing a DMN model with namespace={} name={} 
locationURI={}, modelName={}",
+                importerDMNName, importerDMNNamespace, importNamespace, 
importName, importLocationURI, importModelName);
+
+        if (dmns.isEmpty()) {
+            return Either.ofLeft("Impossible to resolve an import against an 
empty DMN collection");
+        }
+
+        List<T> matchingDMNList = dmns.stream()
+                .filter(m -> 
idExtractor.apply(m).getNamespaceURI().equals(importNamespace))
+                .toList();
+        if (matchingDMNList.size() == 1) {
+            T located = matchingDMNList.get(0);
+            // Check if the located DMN Model in the NS, correspond for the 
import `drools:modelName`. 
+            if (importModelName == null || 
idExtractor.apply(located).getLocalPart().equals(importModelName)) {
+                LOGGER.debug("DMN Model with name={} and namespace={} 
successfully imported a DMN " +
+                                "with namespace={} name={} locationURI={}, 
modelName={}",
+                        importerDMNName, importerDMNNamespace, 
importNamespace, importName, importLocationURI, importModelName);
+                return Either.ofRight(located);
+            } else {
+                LOGGER.error("DMN Model with name={} and namespace={} can't 
import a DMN with namespace={}, name={}, modelName={}, " +
+                                "located within namespace only {} but does not 
match for the actual modelName",
+                        importerDMNName, importerDMNNamespace, 
importNamespace, importName, importModelName, idExtractor.apply(located));
+                return Either.ofLeft(String.format(
+                        "DMN Model with name=%s and namespace=%s can't import 
a DMN with namespace=%s, name=%s, modelName=%s, " +
+                                "located within namespace only %s but does not 
match for the actual modelName",
+                        importerDMNName, importerDMNNamespace, 
importNamespace, importName, importModelName, idExtractor.apply(located)));
+            }
+        } else {
+            List<T> usingNSandName = matchingDMNList.stream()
+                    .filter(dmn -> 
idExtractor.apply(dmn).getLocalPart().equals(importModelName))
+                    .toList();
+            if (usingNSandName.size() == 1) {
+                LOGGER.debug("DMN Model with name={} and namespace={} 
successfully imported a DMN " +
+                                "with namespace={} name={} locationURI={}, 
modelName={}",
+                        importerDMNName, importerDMNNamespace, 
importNamespace, importName, importLocationURI, importModelName);
+                return Either.ofRight(usingNSandName.get(0));
+            } else if (usingNSandName.isEmpty()) {
+                LOGGER.error("DMN Model with name={} and namespace={} failed 
to import a DMN with namespace={} name={} locationURI={}, modelName={}.",
+                        importerDMNName, importerDMNNamespace, 
importNamespace, importName, importLocationURI, importModelName);
+                return Either.ofLeft(String.format(
+                        "DMN Model with name=%s and namespace=%s failed to 
import a DMN with namespace=%s name=%s locationURI=%s, modelName=%s. ",
+                        importerDMNName, importerDMNNamespace, 
importNamespace, importName, importLocationURI, importModelName));
+            } else {
+                LOGGER.error("DMN Model with name={} and namespace={} detected 
a collision ({} elements) trying to import a DMN with namespace={} name={} 
locationURI={}, modelName={}",
+                        importerDMNName, importerDMNNamespace, 
usingNSandName.size(), importNamespace, importName, importLocationURI, 
importModelName);
+                return Either.ofLeft(String.format(
+                        "DMN Model with name=%s and namespace=%s detected a 
collision trying to import a DMN with %s namespace, " +
+                                "%s name and modelName %s. There are %s DMN 
files with the same namespace in your project. " +
+                                "Please change the DMN namespaces and make 
them unique to fix this issue.",
+                        importerDMNName, importerDMNNamespace, 
importNamespace, importName, importModelName, usingNSandName.size()));
+            }
+        }
+    }
+
+    public enum ImportType {
+        UNKNOWN,
+        DMN,
+        PMML;
+    }
+    public static ImportType whichImportType(Import importElement) {
+        switch (importElement.getImportType()) {
+            case org.kie.dmn.model.v1_1.KieDMNModelInstrumentedBase.URI_DMN:
+            case "http://www.omg.org/spec/DMN1-2Alpha/20160929/MODEL":
+            case org.kie.dmn.model.v1_2.KieDMNModelInstrumentedBase.URI_DMN:
+            case org.kie.dmn.model.v1_3.KieDMNModelInstrumentedBase.URI_DMN:
+            case org.kie.dmn.model.v1_4.KieDMNModelInstrumentedBase.URI_DMN:
+            case org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase.URI_DMN:
+                return ImportType.DMN;
+            case NamespaceConsts.PMML_3_0:
+            case NamespaceConsts.PMML_3_1:
+            case NamespaceConsts.PMML_3_2:
+            case NamespaceConsts.PMML_4_0:
+            case NamespaceConsts.PMML_4_1:
+            case NamespaceConsts.PMML_4_2:
+            case NamespaceConsts.PMML_4_3:
+                return ImportType.PMML;
+            default:
+                return ImportType.UNKNOWN;
+        }
+    }
+
+    /**
+     * Resolves a DMN import by searching for the corresponding DMNModel based 
on the provided Import object.
+     * If the import is resolved successfully, it is checked and merged with 
the current DMN model.
+     * @param i : The Import object representing the DMN import to be resolved.
+     * @param dmnModels : A collection of existing DMNModel objects that may 
be used to resolve the import.
+     * @param model : Instance of the DMNModelImpl into which the resolved 
import will be incorporated.
+     * @param toMerge : A list that will hold DMN models to be merged with the 
current model.
+     */
+    static void resolveDMNImportType(Import i, Collection<DMNModel> dmnModels, 
DMNModelImpl model, List<DMNModel> toMerge) {
+        Either<String, DMNModel> resolvedResult = 
DMNImportsUtil.resolveImportDMN(i, dmnModels, (DMNModel m) -> new 
QName(m.getNamespace(), m.getName()));
+        DMNModel located = resolvedResult.cata(msg -> {
+            MsgUtil.reportMessage(LOGGER,
+                    DMNMessage.Severity.ERROR,
+                    i,
+                    model,
+                    null,
+                    null,
+                    Msg.IMPORT_NOT_FOUND_FOR_NODE,
+                    msg,
+                    i);
+            return null;
+        }, Function.identity());
+        checkLocatedDMNModel(i, located, model, toMerge);
+    }
+
+    /**
+     * This method is used to checks if a DMNModel is located and processes it 
by setting the import alias or merging it with the original model.
+     * @param i : represents an import object, and it has a name 
(i.getName()). If the name is available, it will be used as the import alias.
+     * @param located : it is a DMN model that has been locate.
+     * @param model : it is the target DMN model where the import or merge is 
being applied model.
+     * @param toMerge : This is a list that will hold DMN models that are to 
be merged later, instead of being directly imported.
+     */
+    static void checkLocatedDMNModel(Import i, DMNModel located, DMNModelImpl 
model, List<DMNModel> toMerge) {
+        if (located != null) {
+            String importAlias = 
Optional.ofNullable(i.getName()).orElse(located.getName());
+            // 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 (importAlias != null && !importAlias.isEmpty()) {
+                model.setImportAliasForNS(importAlias, located.getNamespace(), 
located.getName());
+                importFromModel(model, located, importAlias);
+            } else {
+                toMerge.add(located);
+            }
+        }
+    }
+
+    /**
+     * The method is using for handling imports related to PMML models, 
allowing the DMN model to incorporate external PMML-based resources.
+     * @param model : Represents a DMN model that requires the PMML import 
resolution.
+     * @param i : Object that specifies the import details for the PMML 
resource.
+     * @param relativeResolver : A function that resolves relative paths to 
resources.
+     * @param dmnCompilerConfig : Instance of the DMNCompilerConfigurationImpl 
that holds configuration details, including the root class loader.
+     */
+    static void resolvePMMLImportType(DMNModelImpl model, Import i, 
Function<String, Reader> relativeResolver, DMNCompilerConfigurationImpl 
dmnCompilerConfig) {
+        ClassLoader rootClassLoader = dmnCompilerConfig.getRootClassLoader();
+        Resource relativeResource = resolveRelativeResource(rootClassLoader, 
model, i, i, relativeResolver);
+        resolvePMMLImportType(model, i, relativeResource, dmnCompilerConfig);
+    }
+
+    /**
+     * Resolves the PMML import type for a given DMN model and import, 
consuming and processing the PMML import information.
+     * If an error occurs while reading the PMML resource, the exception is 
handled and passed to the error consumer for appropriate processing.
+     * @param model : represents a DMN model where the PMML import information 
will be added.
+     * @param i : The Import object that specifies the PMML import details.
+     * @param relativeResource : The resource representing the relative 
resource containing the PMML data.
+     * @param dmnCompilerConfig : The DMNCompilerConfigurationImpl providing 
configuration details for the DMN compiler.
+     * @throws IOException If an error occurs while reading the PMML resource 
input stream.
+     */
+    static void resolvePMMLImportType(DMNModelImpl model, Import i, Resource 
relativeResource, DMNCompilerConfigurationImpl dmnCompilerConfig) {
+        try (InputStream pmmlIS = relativeResource.getInputStream()) {
+            DMNImportPMMLInfo.from(pmmlIS, dmnCompilerConfig, model, 
i).consume(new DMNCompilerImpl.PMMLImportErrConsumer(model, i),
+                    model::addPMMLImportInfo);
+        } catch (IOException e) {
+            new DMNCompilerImpl.PMMLImportErrConsumer(model, i).accept(e);
+        }
+    }
+
+    /**
+     * Logs an error message when an unsupported or unknown import type is 
encountered during DMN model compilation.
+     * @param model : Instance of the DMNModelImpl that represents the DMN 
model where the error occurred.
+     * @param importType : The type of the import that caused the error (e.g., 
DMN, PMML, or unknown type).
+     */
+    static void logErrorMessage(DMNModelImpl model, String importType) {
+        MsgUtil.reportMessage(LOGGER,
+                DMNMessage.Severity.ERROR,
+                null,
+                model,
+                null,
+                null,
+                Msg.IMPORT_TYPE_UNKNOWN,
+                importType);
+    }
+
+    /**
+     * This method ensures that all necessary components from the source DMN 
model are integrated into the target model,
+     * including the import chain and various types of nodes (inputs, items, 
decisions, etc.).
+     * @param model : The DMNModelImpl instance into which elements from the 
source model will be imported.
+     * @param m : DMN model from which elements will be imported.
+     * @param iAlias : The alias to be used for the import chain when adding 
the elements from the source model.
+     */
+    static void importFromModel(DMNModelImpl model, DMNModel m, String iAlias) 
{
+        model.addImportChainChild(((DMNModelImpl) m).getImportChain(), iAlias);
+        for (ItemDefNode idn : m.getItemDefinitions()) {
+            model.getTypeRegistry().registerType(idn.getType());
+        }
+        for (InputDataNode idn : m.getInputs()) {
+            model.addInput(idn);
+        }
+        for (BusinessKnowledgeModelNode bkm : m.getBusinessKnowledgeModels()) {
+            model.addBusinessKnowledgeModel(bkm);
+        }
+        for (DecisionNode dn : m.getDecisions()) {
+            model.addDecision(dn);
+        }
+        for (DecisionServiceNode dsn : m.getDecisionServices()) {
+            model.addDecisionService(dsn);
+        }
+    }
+}
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/ImportDMNResolverUtil.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/ImportDMNResolverUtil.java
deleted file mode 100644
index 388a47c608..0000000000
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/ImportDMNResolverUtil.java
+++ /dev/null
@@ -1,133 +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.
- */
-package org.kie.dmn.core.compiler;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.function.Function;
-
-import javax.xml.namespace.QName;
-
-import org.kie.dmn.feel.util.Either;
-import org.kie.dmn.model.api.Definitions;
-import org.kie.dmn.model.api.Import;
-import org.kie.dmn.model.api.NamespaceConsts;
-import org.kie.dmn.model.v1_1.TImport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ImportDMNResolverUtil {
-
-    private static final Logger LOGGER = 
LoggerFactory.getLogger(ImportDMNResolverUtil.class);
-
-    private ImportDMNResolverUtil() {
-        // No constructor for util class.
-    }
-
-    public static <T> Either<String, T> resolveImportDMN(Import importElement, 
Collection<T> dmns, Function<T, QName> idExtractor) {
-        final String importerDMNNamespace = ((Definitions) 
importElement.getParent()).getNamespace();
-        final String importerDMNName = ((Definitions) 
importElement.getParent()).getName();
-        final String importNamespace = importElement.getNamespace();
-        final String importName = importElement.getName();
-        final String importLocationURI = importElement.getLocationURI(); // 
This is optional
-        final String importModelName = 
importElement.getAdditionalAttributes().get(TImport.MODELNAME_QNAME);
-
-        LOGGER.debug("Resolving an Import in DMN Model with name={} and 
namespace={}. " +
-                        "Importing a DMN model with namespace={} name={} 
locationURI={}, modelName={}",
-                importerDMNName, importerDMNNamespace, importNamespace, 
importName, importLocationURI, importModelName);
-
-        if (dmns.isEmpty()) {
-            return Either.ofLeft("Impossible to resolve an import against an 
empty DMN collection");
-        }
-
-        List<T> matchingDMNList = dmns.stream()
-                .filter(m -> 
idExtractor.apply(m).getNamespaceURI().equals(importNamespace))
-                .toList();
-        if (matchingDMNList.size() == 1) {
-            T located = matchingDMNList.get(0);
-            // Check if the located DMN Model in the NS, correspond for the 
import `drools:modelName`. 
-            if (importModelName == null || 
idExtractor.apply(located).getLocalPart().equals(importModelName)) {
-                LOGGER.debug("DMN Model with name={} and namespace={} 
successfully imported a DMN " +
-                                "with namespace={} name={} locationURI={}, 
modelName={}",
-                        importerDMNName, importerDMNNamespace, 
importNamespace, importName, importLocationURI, importModelName);
-                return Either.ofRight(located);
-            } else {
-                LOGGER.error("DMN Model with name={} and namespace={} can't 
import a DMN with namespace={}, name={}, modelName={}, " +
-                                "located within namespace only {} but does not 
match for the actual modelName",
-                        importerDMNName, importerDMNNamespace, 
importNamespace, importName, importModelName, idExtractor.apply(located));
-                return Either.ofLeft(String.format(
-                        "DMN Model with name=%s and namespace=%s can't import 
a DMN with namespace=%s, name=%s, modelName=%s, " +
-                                "located within namespace only %s but does not 
match for the actual modelName",
-                        importerDMNName, importerDMNNamespace, 
importNamespace, importName, importModelName, idExtractor.apply(located)));
-            }
-        } else {
-            List<T> usingNSandName = matchingDMNList.stream()
-                    .filter(dmn -> 
idExtractor.apply(dmn).getLocalPart().equals(importModelName))
-                    .toList();
-            if (usingNSandName.size() == 1) {
-                LOGGER.debug("DMN Model with name={} and namespace={} 
successfully imported a DMN " +
-                                "with namespace={} name={} locationURI={}, 
modelName={}",
-                        importerDMNName, importerDMNNamespace, 
importNamespace, importName, importLocationURI, importModelName);
-                return Either.ofRight(usingNSandName.get(0));
-            } else if (usingNSandName.isEmpty()) {
-                LOGGER.error("DMN Model with name={} and namespace={} failed 
to import a DMN with namespace={} name={} locationURI={}, modelName={}.",
-                        importerDMNName, importerDMNNamespace, 
importNamespace, importName, importLocationURI, importModelName);
-                return Either.ofLeft(String.format(
-                        "DMN Model with name=%s and namespace=%s failed to 
import a DMN with namespace=%s name=%s locationURI=%s, modelName=%s. ",
-                        importerDMNName, importerDMNNamespace, 
importNamespace, importName, importLocationURI, importModelName));
-            } else {
-                LOGGER.error("DMN Model with name={} and namespace={} detected 
a collision ({} elements) trying to import a DMN with namespace={} name={} 
locationURI={}, modelName={}",
-                        importerDMNName, importerDMNNamespace, 
usingNSandName.size(), importNamespace, importName, importLocationURI, 
importModelName);
-                return Either.ofLeft(String.format(
-                        "DMN Model with name=%s and namespace=%s detected a 
collision trying to import a DMN with %s namespace, " +
-                                "%s name and modelName %s. There are %s DMN 
files with the same namespace in your project. " +
-                                "Please change the DMN namespaces and make 
them unique to fix this issue.",
-                        importerDMNName, importerDMNNamespace, 
importNamespace, importName, importModelName, usingNSandName.size()));
-            }
-        }
-    }
-
-    public enum ImportType {
-        UNKNOWN,
-        DMN,
-        PMML;
-    }
-
-    public static ImportType whichImportType(Import importElement) {
-        switch (importElement.getImportType()) {
-            case org.kie.dmn.model.v1_1.KieDMNModelInstrumentedBase.URI_DMN:
-            case "http://www.omg.org/spec/DMN1-2Alpha/20160929/MODEL":
-            case org.kie.dmn.model.v1_2.KieDMNModelInstrumentedBase.URI_DMN:
-            case org.kie.dmn.model.v1_3.KieDMNModelInstrumentedBase.URI_DMN:
-            case org.kie.dmn.model.v1_4.KieDMNModelInstrumentedBase.URI_DMN:
-            case org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase.URI_DMN:
-                return ImportType.DMN;
-            case NamespaceConsts.PMML_3_0:
-            case NamespaceConsts.PMML_3_1:
-            case NamespaceConsts.PMML_3_2:
-            case NamespaceConsts.PMML_4_0:
-            case NamespaceConsts.PMML_4_1:
-            case NamespaceConsts.PMML_4_2:
-            case NamespaceConsts.PMML_4_3:
-                return ImportType.PMML;
-            default:
-                return ImportType.UNKNOWN;
-        }
-    }
-}
diff --git 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/DMNCompilerImplTest.java
 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/DMNCompilerImplTest.java
index bc11d10e56..e45048502a 100644
--- 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/DMNCompilerImplTest.java
+++ 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/DMNCompilerImplTest.java
@@ -1,5 +1,4 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
+/* 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
@@ -18,21 +17,41 @@
  */
 package org.kie.dmn.core.compiler;
 
+import org.drools.io.ClassPathResource;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
-import org.kie.dmn.model.api.DMNElementReference;
-import org.kie.dmn.model.api.Definitions;
-import org.kie.dmn.model.api.InformationRequirement;
-import org.kie.dmn.model.v1_5.TDMNElementReference;
-import org.kie.dmn.model.v1_5.TDefinitions;
-import org.kie.dmn.model.v1_5.TInformationRequirement;
+import org.kie.api.io.Resource;
+import org.kie.dmn.api.core.DMNMessageType;
+import org.kie.dmn.api.core.DMNModel;
+
+import org.kie.dmn.core.impl.DMNModelImpl;
+import org.kie.dmn.model.api.*;
+import org.kie.dmn.model.v1_5.*;
+import org.mockito.MockedStatic;
+import org.mockito.Mockito;
+import org.mockito.verification.VerificationMode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Reader;
+import java.util.*;
+import java.util.List;
+import java.util.function.Function;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static 
org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
 
 class DMNCompilerImplTest {
 
-    private static final String nameSpace = 
"http://www.montera.com.au/spec/DMN/local-hrefs";;
+    public static final Logger LOG = 
LoggerFactory.getLogger(DMNCompilerImplTest.class);
+
+    private static DMNCompilerImpl dMNCompiler;
+    private static final String NAMESPACE = 
"http://www.montera.com.au/spec/DMN/local-hrefs";;
     private static Definitions parent;
 
     @BeforeAll
@@ -40,14 +59,16 @@ class DMNCompilerImplTest {
         String modelName = "LocalHrefs";
         parent = new TDefinitions();
         parent.setName(modelName);
-        parent.setNamespace(nameSpace);
+        parent.setNamespace(NAMESPACE);
+
+        dMNCompiler = new DMNCompilerImpl();
     }
 
     @Test
     void getId() {
         String localPart = "reference";
         DMNElementReference elementReference = new TDMNElementReference();
-        elementReference.setHref(String.format("%s#%s", nameSpace, localPart));
+        elementReference.setHref(String.format("%s#%s", NAMESPACE, localPart));
         elementReference.setParent(parent);
         String retrieved = DMNCompilerImpl.getId(elementReference);
         assertThat(retrieved).isNotNull().isEqualTo(localPart);
@@ -62,7 +83,7 @@ class DMNCompilerImplTest {
     void getRootElement() {
         String localPart = "reference";
         DMNElementReference elementReference = new TDMNElementReference();
-        String href = String.format("%s#%s", nameSpace, localPart);
+        String href = String.format("%s#%s", NAMESPACE, localPart);
         elementReference.setHref(href);
         elementReference.setParent(parent);
         Definitions retrieved = 
DMNCompilerImpl.getRootElement(elementReference);
@@ -70,10 +91,149 @@ class DMNCompilerImplTest {
 
         InformationRequirement informationRequirement = new 
TInformationRequirement();
         elementReference.setParent(informationRequirement);
-        assertThatExceptionOfType(RuntimeException.class).isThrownBy(() -> 
DMNCompilerImpl.getRootElement(elementReference));
-
+        assertThatExceptionOfType(RuntimeException.class).isThrownBy(
+                () -> 
DMNCompilerImpl.getRootElement(elementReference)).withMessageContaining
+                ("Failed to get Definitions parent for 
org.kie.dmn.model.v1_5");
         informationRequirement.setParent(parent);
         retrieved = DMNCompilerImpl.getRootElement(elementReference);
         assertThat(retrieved).isNotNull().isEqualTo(parent);
     }
-}
\ No newline at end of file
+
+    @Test
+    void compile() {
+        List<DMNModel> dmnModels = new ArrayList<>();
+        String nameSpace = 
"http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f-9848-11ba35e0df44";;
+        Resource resource = new ClassPathResource( 
"valid_models/DMNv1_5/Imported_Model_Unamed.dmn",
+                this.getClass());
+        DMNModel importedModel = dMNCompiler.compile( resource, dmnModels);
+        assertThat(importedModel).isNotNull();
+        
assertThat(importedModel.getNamespace()).isNotNull().isEqualTo(nameSpace);
+        assertThat(importedModel.getMessages()).isEmpty();
+    }
+
+    @Test
+    void compileWithUnknownTypeModelImports() {
+        List<DMNModel> dmnModels = new ArrayList<>();
+        String nameSpace = 
"http://www.trisotech.com/dmn/definitions/_f27bb64b-6fc7-4e1f-9848-11ba35e0df44";;
+        String modelName = "Imported Model";
+        String importType = String.valueOf(DMNImportsUtil.ImportType.UNKNOWN);
+        Resource resource = new ClassPathResource( 
"valid_models/DMNv1_5/Imported_Model_Unamed.dmn",
+                this.getClass());
+        DMNModel model = dMNCompiler.compile( resource, dmnModels);
+        assertThat(model).isNotNull();
+        Definitions dmnDefn = model.getDefinitions();
+        addImport(dmnDefn, importType, nameSpace, modelName);
+        dmnModels.add(model);
+        model = dMNCompiler.compile(dmnDefn, resource, dmnModels);
+        assertThat(model).isNotNull();
+        assertThat(model.getName()).isNotNull().isEqualTo(modelName);
+        assertThat(model.getMessages()).hasSize(1);
+        assertThat(model.getMessages().get(0).getText()).isEqualTo("DMN: 
Import type unknown: 'UNKNOWN'. (Invalid FEEL syntax on the referenced 
expression) ");
+
+    }
+
+    @Test
+    void compileWithImportingDmnModel() {
+        List<DMNModel> dmnModels = new ArrayList<>();
+        Resource resource = new ClassPathResource( 
"valid_models/DMNv1_5/Imported_Model_Unamed.dmn",
+                this.getClass());
+        DMNModel importedModel = dMNCompiler.compile( resource, dmnModels);
+        assertThat(importedModel).isNotNull();
+        dmnModels.add(importedModel);
+
+        //imported model - Importing_Named_Model.dmn
+        String nameSpace = 
"http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc";;
+        resource = new ClassPathResource( 
"valid_models/DMNv1_5/Importing_Named_Model.dmn",
+                this.getClass());
+
+        DMNModel importingModel = dMNCompiler.compile(resource, dmnModels);
+        assertThat(importingModel).isNotNull();
+        
assertThat(importingModel.getNamespace()).isNotNull().isEqualTo(nameSpace);
+        assertThat(importingModel.getMessages()).isEmpty();
+    }
+
+    @Test
+    void compileImportingModelWithoutImportedModel()  {
+        List<DMNModel> dmnModels = new ArrayList<>();
+        String modelName = "Importing named Model";
+        Resource resource = new ClassPathResource( 
"valid_models/DMNv1_5/Importing_Named_Model.dmn",
+                this.getClass());
+        DMNModel model = dMNCompiler.compile( resource, dmnModels);
+        assertThat(model).isNotNull();
+        assertThat(model.getName()).isNotNull().isEqualTo(modelName);
+
+        Definitions dmnDefn = model.getDefinitions();
+        dmnModels.add(model);
+        model = dMNCompiler.compile(dmnDefn, resource, dmnModels);
+        assertThat(model).isNotNull();
+        assertThat(model.getName()).isNotNull().isEqualTo(modelName);
+        assertThat(model.getMessages()).hasSize(5);
+        
assertThat(model.getMessages().get(0).getMessageType()).isEqualTo(DMNMessageType.IMPORT_NOT_FOUND);
+
+    }
+
+    @Test
+    void compileWithInvalidModel() {
+        List<DMNModel> dmnModels = new ArrayList<>();
+        Resource resource = new ClassPathResource( 
"invalid_models/DMNv1_5/DMN-Invalid.dmn",
+                this.getClass());
+        DMNModel importedModel = dMNCompiler.compile( resource, dmnModels);
+        assertThat(importedModel).isNotNull();
+        assertThat(importedModel.getMessages()).isNotEmpty();
+        assertThat(importedModel.getMessages()).hasSize(1);
+        
assertThat(importedModel.getMessages().get(0).getMessageType()).isEqualTo(DMNMessageType.ERR_COMPILING_FEEL);
+    }
+
+    @Test
+    void iterateImportsWithDMNImport() {
+        commonIterateImport(DMNImportsUtil.ImportType.DMN, null, times(1), 
never(), never());
+    }
+
+    @Test
+    void iterateImportsWithPMMLImport() {
+        DMNModelImpl mockedModel = mock(DMNModelImpl.class);
+        commonIterateImport(DMNImportsUtil.ImportType.PMML, mockedModel, 
never(), times(1), never());
+        verify(mockedModel, times(1)).setImportAliasForNS(anyString(), 
anyString(), anyString());
+    }
+
+    @Test
+    void iterateImportsWithUnknownImport() {
+        commonIterateImport(DMNImportsUtil.ImportType.UNKNOWN, null, never(), 
never(), times(1));
+    }
+
+    private void commonIterateImport(DMNImportsUtil.ImportType importType, 
DMNModelImpl model, VerificationMode dmnInvocation, VerificationMode 
pmmlInvocation, VerificationMode logErrorInvocation) {
+        Definitions dmnDefs = new TDefinitions();
+        addImport(dmnDefs, "importType", "nameSpace", "modelName");
+        try (MockedStatic<DMNImportsUtil> mockDMNImportsUtil = 
Mockito.mockStatic(DMNImportsUtil.class)) {
+            mockDMNImportsUtil.when(() -> 
DMNImportsUtil.logErrorMessage(Mockito.any(), 
Mockito.any())).thenAnswer(invocation -> {
+                LOG.debug("Mocked static void logErrorMessage !");
+                return null;
+            });
+            mockDMNImportsUtil.when(() -> 
DMNImportsUtil.whichImportType(Mockito.any())).thenAnswer(invocation -> {
+                LOG.debug("Mocked static void whichImportType !");
+                return importType;
+            });
+            dMNCompiler.iterateImports(dmnDefs, null, model, null );
+            mockDMNImportsUtil.verify(() -> 
DMNImportsUtil.resolveDMNImportType(Mockito.any(), Mockito.any(), 
Mockito.any(), Mockito.any()), dmnInvocation);
+            mockDMNImportsUtil.verify(() -> 
DMNImportsUtil.whichImportType(Mockito.any()), times(1));
+            mockDMNImportsUtil.verify(() -> 
DMNImportsUtil.resolvePMMLImportType(Mockito.any(), Mockito.any(), 
(Function<String, Reader>) Mockito.any(), Mockito.any()), pmmlInvocation);
+            mockDMNImportsUtil.verify(() -> 
DMNImportsUtil.logErrorMessage(Mockito.any(), Mockito.any()), 
logErrorInvocation);
+        }
+    }
+
+    private void addImport(Definitions dmnDefs, String importType, String 
nameSpace, String modelName) {
+        dmnDefs.setName(modelName);
+        Import toAdd = new TImport();
+        toAdd.setNamespace(nameSpace);
+        toAdd.setName(modelName);
+        toAdd.setImportType(importType);
+        toAdd.setParent(dmnDefs);
+        toAdd.setLocationURI(importType);
+        dmnDefs.getImport().add(toAdd);
+    }
+
+}
+
+
+
+
diff --git 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/ImportDMNResolverUtilTest.java
 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/DMNImportsUtilTest.java
similarity index 51%
rename from 
kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/ImportDMNResolverUtilTest.java
rename to 
kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/DMNImportsUtilTest.java
index 2b7554d1d8..21d4d66fe0 100644
--- 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/ImportDMNResolverUtilTest.java
+++ 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/DMNImportsUtilTest.java
@@ -6,9 +6,7 @@
  * 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
- *
+ * 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
@@ -18,16 +16,18 @@
  */
 package org.kie.dmn.core.compiler;
 
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.function.Function;
 
 import javax.xml.namespace.QName;
 
+import org.drools.io.ClassPathResource;
+import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
+import org.kie.api.io.Resource;
+import org.kie.dmn.api.core.DMNCompiler;
+import org.kie.dmn.api.core.DMNModel;
+import org.kie.dmn.core.impl.DMNModelImpl;
 import org.kie.dmn.feel.util.Either;
 import org.kie.dmn.model.api.Definitions;
 import org.kie.dmn.model.api.Import;
@@ -36,7 +36,14 @@ import org.kie.dmn.model.v1_1.TImport;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
 
-class ImportDMNResolverUtilTest {
+class DMNImportsUtilTest {
+
+    private static DMNCompiler dMNCompiler;
+
+    @BeforeAll
+    static void setup() {
+        dMNCompiler = new DMNCompilerImpl();
+    }
 
     @Test
     void nSonly() {
@@ -44,7 +51,7 @@ class ImportDMNResolverUtilTest {
         final List<QName> available = Arrays.asList(new QName("ns1", "m1"),
                                                     new QName("ns2", "m2"),
                                                     new QName("ns3", "m3"));
-        final Either<String, QName> result = 
ImportDMNResolverUtil.resolveImportDMN(i, available, Function.identity());
+        final Either<String, QName> result = 
DMNImportsUtil.resolveImportDMN(i, available, Function.identity());
         assertThat(result.isRight()).isTrue();
         assertThat(result.getOrElse(null)).isEqualTo(new QName("ns1", "m1"));
     }
@@ -55,7 +62,7 @@ class ImportDMNResolverUtilTest {
         final List<QName> available = Arrays.asList(new QName("ns1", "m1"),
                                                     new QName("ns2", "m2"),
                                                     new QName("ns3", "m3"));
-        final Either<String, QName> result = 
ImportDMNResolverUtil.resolveImportDMN(i, available, Function.identity());
+        final Either<String, QName> result = 
DMNImportsUtil.resolveImportDMN(i, available, Function.identity());
         assertThat(result.isRight()).isTrue();
         assertThat(result.getOrElse(null)).isEqualTo(new QName("ns1", "m1"));
     }
@@ -66,7 +73,7 @@ class ImportDMNResolverUtilTest {
         final List<QName> available = Arrays.asList(new QName("ns1", "m1"),
                                                     new QName("ns2", "m2"),
                                                     new QName("ns3", "m3"));
-        final Either<String, QName> result = 
ImportDMNResolverUtil.resolveImportDMN(i, available, Function.identity());
+        final Either<String, QName> result = 
DMNImportsUtil.resolveImportDMN(i, available, Function.identity());
         assertThat(result.isRight()).isTrue();
         assertThat(result.getOrElse(null)).isEqualTo(new QName("ns1", "m1"));
     }
@@ -77,7 +84,7 @@ class ImportDMNResolverUtilTest {
         final List<QName> available = Arrays.asList(new QName("ns1", "m1"),
                                                     new QName("ns2", "m2"),
                                                     new QName("ns3", "m3"));
-        final Either<String, QName> result = 
ImportDMNResolverUtil.resolveImportDMN(i, available, Function.identity());
+        final Either<String, QName> result = 
DMNImportsUtil.resolveImportDMN(i, available, Function.identity());
         assertThat(result.isRight()).isTrue();
         assertThat(result.getOrElse(null)).isEqualTo(new QName("ns1", "m1"));
     }
@@ -88,7 +95,7 @@ class ImportDMNResolverUtilTest {
         final List<QName> available = Arrays.asList(new QName("ns1", "m1"),
                                                     new QName("ns2", "m2"),
                                                     new QName("ns3", "m3"));
-        final Either<String, QName> result = 
ImportDMNResolverUtil.resolveImportDMN(i, available, Function.identity());
+        final Either<String, QName> result = 
DMNImportsUtil.resolveImportDMN(i, available, Function.identity());
         assertThat(result.isLeft()).isTrue();
     }
 
@@ -98,7 +105,7 @@ class ImportDMNResolverUtilTest {
         final List<QName> available = Arrays.asList(new QName("ns1", "m1"),
                                                     new QName("ns2", "m2"),
                                                     new QName("ns3", "m3"));
-        final Either<String, QName> result = 
ImportDMNResolverUtil.resolveImportDMN(i, available, Function.identity());
+        final Either<String, QName> result = 
DMNImportsUtil.resolveImportDMN(i, available, Function.identity());
         assertThat(result.isRight()).isTrue();
         assertThat(result.getOrElse(null)).isEqualTo(new QName("ns1", "m1"));
     }
@@ -109,7 +116,7 @@ class ImportDMNResolverUtilTest {
         final List<QName> available = Arrays.asList(new QName("nsA", "m1"),
                                                     new QName("nsA", "m2"),
                                                     new QName("nsB", "m3"));
-        final Either<String, QName> result = 
ImportDMNResolverUtil.resolveImportDMN(i, available, Function.identity());
+        final Either<String, QName> result = 
DMNImportsUtil.resolveImportDMN(i, available, Function.identity());
         assertThat(result.isRight()).isTrue();
         assertThat(result.getOrElse(null)).isEqualTo(new QName("nsA", "m1"));
     }
@@ -120,7 +127,7 @@ class ImportDMNResolverUtilTest {
         final List<QName> available = Arrays.asList(new QName("nsA", "m1"),
                                                     new QName("nsA", "m2"),
                                                     new QName("nsB", "m3"));
-        final Either<String, QName> result = 
ImportDMNResolverUtil.resolveImportDMN(i, available, Function.identity());
+        final Either<String, QName> result = 
DMNImportsUtil.resolveImportDMN(i, available, Function.identity());
         assertThat(result.isLeft()).isTrue();
     }
 
@@ -130,7 +137,7 @@ class ImportDMNResolverUtilTest {
         final List<QName> available = Arrays.asList(new QName("nsA", "m1"),
                                                     new QName("nsA", "m2"),
                                                     new QName("nsB", "m3"));
-        final Either<String, QName> result = 
ImportDMNResolverUtil.resolveImportDMN(i, available, Function.identity());
+        final Either<String, QName> result = 
DMNImportsUtil.resolveImportDMN(i, available, Function.identity());
         assertThat(result.isRight()).isTrue();
         assertThat(result.getOrElse(null)).isEqualTo(new QName("nsA", "m1"));
     }
@@ -141,7 +148,7 @@ class ImportDMNResolverUtilTest {
         final List<QName> available = Arrays.asList(new QName("nsA", "m1"),
                                                     new QName("nsA", "m2"),
                                                     new QName("nsB", "m3"));
-        final Either<String, QName> result = 
ImportDMNResolverUtil.resolveImportDMN(i, available, Function.identity());
+        final Either<String, QName> result = 
DMNImportsUtil.resolveImportDMN(i, available, Function.identity());
         assertThat(result.isLeft()).isTrue();
     }
 
@@ -151,7 +158,7 @@ class ImportDMNResolverUtilTest {
         final List<QName> available = Arrays.asList(new QName("nsA", "m1"),
                                                     new QName("nsA", "m2"),
                                                     new QName("nsB", "m3"));
-        final Either<String, QName> result = 
ImportDMNResolverUtil.resolveImportDMN(i, available, Function.identity());
+        final Either<String, QName> result = 
DMNImportsUtil.resolveImportDMN(i, available, Function.identity());
         assertThat(result.isLeft()).isTrue();
     }
 
@@ -161,14 +168,14 @@ class ImportDMNResolverUtilTest {
         final List<QName> available = Arrays.asList(new QName("nsA", "mA"),
                                                     new QName("nsA", "mA"),
                                                     new QName("nsB", "m3"));
-        final Either<String, QName> result = 
ImportDMNResolverUtil.resolveImportDMN(i, available, Function.identity());
+        final Either<String, QName> result = 
DMNImportsUtil.resolveImportDMN(i, available, Function.identity());
         assertThat(result.isLeft()).isTrue();
     }
 
     @Test
     void emptyDMNCollection() {
         final Import i = makeImport("nsA", "aliased", "mA");
-        final Either<String, QName> result = 
ImportDMNResolverUtil.resolveImportDMN(i, Collections.emptyList(), 
Function.identity());
+        final Either<String, QName> result = 
DMNImportsUtil.resolveImportDMN(i, Collections.emptyList(), 
Function.identity());
         assertThat(result.isLeft()).isTrue();
     }
 
@@ -190,4 +197,96 @@ class ImportDMNResolverUtilTest {
         return i;
     }
 
+    @Test
+    void checkLocatedDMNModel() {
+        List<DMNModel> toMerge = new ArrayList<>();
+        List<DMNModel> dmnModels = new ArrayList<>();
+        String nameSpace = 
"http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc";;
+        Resource resource = new ClassPathResource( 
"valid_models/DMNv1_5/Importing_Named_Model.dmn",
+                this.getClass());
+        DMNModel importingModel = dMNCompiler.compile(resource, dmnModels);
+        assertThat(importingModel).isNotNull();
+        
assertThat(importingModel.getNamespace()).isNotNull().isEqualTo(nameSpace);
+
+        Import input = importingModel.getDefinitions().getImport().get(0);
+        DMNModelImpl model = new DMNModelImpl(importingModel.getDefinitions(), 
resource);
+        DMNModel located = new DMNModelImpl(importingModel.getDefinitions(), 
resource);
+        DMNImportsUtil.checkLocatedDMNModel(input, located, model, toMerge);
+        assertThat(importingModel).isNotNull();
+        
assertThat(importingModel.getNamespace()).isNotNull().isEqualTo(nameSpace);
+        assertThat(toMerge).isEmpty();
+    }
+
+    @Test
+    void resolveDMNImportType()  {
+        List<DMNModel> toMerge = new ArrayList<>();
+        List<DMNModel> dmnModels = new ArrayList<>();
+        Resource resource = new ClassPathResource( 
"valid_models/DMNv1_5/Imported_Model_Unamed.dmn",
+                this.getClass());
+        DMNModel importedModel = dMNCompiler.compile( resource, dmnModels);
+        assertThat(importedModel).isNotNull();
+        dmnModels.add(importedModel);
+
+        //imported model - Importing_Named_Model.dmn
+        String nameSpace = 
"http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc";;
+        resource = new ClassPathResource( 
"valid_models/DMNv1_5/Importing_Named_Model.dmn",
+                this.getClass());
+        DMNModel importingModel = dMNCompiler.compile(resource, dmnModels);
+        assertThat(importingModel).isNotNull();
+        
assertThat(importingModel.getNamespace()).isNotNull().isEqualTo(nameSpace);
+        assertThat(importingModel.getMessages()).isEmpty();
+
+        Import input = importingModel.getDefinitions().getImport().get(0);
+        DMNModelImpl model = new DMNModelImpl(importingModel.getDefinitions(), 
resource);
+        DMNImportsUtil.resolveDMNImportType(input, dmnModels, model, toMerge);
+        assertThat(model.getMessages()).isEmpty();
+        
assertThat(model.getImportAliasesForNS().entrySet().stream().findFirst())
+                .isPresent().get().extracting(Map.Entry::getValue)
+                
.extracting(QName::getLocalPart).isNotNull().isEqualTo("Imported Model");
+
+    }
+
+
+
+    @Test
+    void checkLocatedDMNModelWithAliasNull() {
+        String 
namespace="http://www.trisotech.com/dmn/definitions/_f79aa7a4-f9a3-410a-ac95-bea496edabgc";;
+        List<DMNModel> toMerge = new ArrayList<>();
+        List<DMNModel> dmnModels = new ArrayList<>();
+        Resource resource = new ClassPathResource( 
"valid_models/DMNv1_5/Importing_EmptyNamed_Model_Without_Href_Namespace.dmn",
+                this.getClass());
+        DMNModel emptyNamedModel = dMNCompiler.compile( resource, dmnModels);
+        assertThat(emptyNamedModel).isNotNull();
+        dmnModels.add(emptyNamedModel);
+
+        Import input = emptyNamedModel.getDefinitions().getImport().get(0);
+        DMNModelImpl model = new 
DMNModelImpl(emptyNamedModel.getDefinitions(), resource);
+        DMNModel located = new DMNModelImpl(emptyNamedModel.getDefinitions(), 
resource);
+        DMNImportsUtil.checkLocatedDMNModel(input, located, model, toMerge);
+        assertThat(emptyNamedModel).isNotNull();
+        assertThat(toMerge).isNotEmpty();
+        assertThat(toMerge.size()).isEqualTo(1);
+        
assertThat(toMerge.get(0).getNamespace()).isNotNull().isEqualTo(namespace);
+    }
+
+    @Test
+    void resolvePMMLImportType() {
+        List<DMNModel> dmnModels = new ArrayList<>();
+        Resource dmnResource = new ClassPathResource( 
"../pmml/KiePMMLNewTree.dmn",
+                this.getClass());
+        DMNModel importingModel = dMNCompiler.compile( dmnResource, dmnModels);
+        assertThat(importingModel).isNotNull();
+
+
+        Import input = importingModel.getDefinitions().getImport().get(0);
+        DMNModelImpl model = new DMNModelImpl(importingModel.getDefinitions(), 
dmnResource);
+
+        Resource relativeResource = new ClassPathResource( 
"../pmml/test_tree_new.pmml",
+                this.getClass());
+        assertThat(model.getPmmlImportInfo()).isEmpty();
+        DMNCompilerConfigurationImpl dmnCompilerConfig = 
(DMNCompilerConfigurationImpl)((DMNCompilerImpl)dMNCompiler).getDmnCompilerConfig();
+        DMNImportsUtil.resolvePMMLImportType(model, input, relativeResource, 
dmnCompilerConfig);
+        
assertThat(model.getPmmlImportInfo()).hasSize(1).containsOnlyKeys("test_tree");
+    }
+
 }
diff --git 
a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_2/dmn-validation-rules-dmndi.drl
 
b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_2/dmn-validation-rules-dmndi.drl
index 06c8d4ac96..fec324661e 100644
--- 
a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_2/dmn-validation-rules-dmndi.drl
+++ 
b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_2/dmn-validation-rules-dmndi.drl
@@ -99,7 +99,7 @@ when
     DMNDI()
     $shape : DMNShape($prefix : dmnElementRef.prefix != 
XMLConstants.DEFAULT_NS_PREFIX)
     Definitions($nsContext : nsContext)
-    $import : Import(ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.DMN, namespace == $nsContext[$prefix])
+    $import : Import(DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.DMN, namespace == $nsContext[$prefix])
     $importDef : Definitions(namespace == $import.namespace) from entry-point 
"DMNImports"
     not DRGElement(id == $shape.dmnElementRef.localPart) from 
$importDef.drgElement
     not TextAnnotation(id == $shape.dmnElementRef.localPart) from 
$importDef.artifact
@@ -124,7 +124,7 @@ when
     DMNDI()
     $edge : DMNEdge($prefix : dmnElementRef.prefix != 
XMLConstants.DEFAULT_NS_PREFIX, $localPart : dmnElementRef.localPart)
     Definitions($nsContext : nsContext)
-    $import : Import(ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.DMN, namespace == $nsContext[$prefix])
+    $import : Import(DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.DMN, namespace == $nsContext[$prefix])
     $importDef : Definitions(namespace == $import.namespace) from entry-point 
"DMNImports"
     eval(!doesDefinitionsContainIdForDMNEdge($importDef, $localPart))
 then
diff --git 
a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_2/dmn-validation-rules-typeref.drl
 
b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_2/dmn-validation-rules-typeref.drl
index e5afc96d98..3d24641ea2 100644
--- 
a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_2/dmn-validation-rules-typeref.drl
+++ 
b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_2/dmn-validation-rules-typeref.drl
@@ -28,7 +28,7 @@ import org.kie.dmn.feel.parser.feel11.FEELParser;
 import org.kie.dmn.feel.runtime.events.SyntaxErrorEvent;
 import org.kie.dmn.api.feel.runtime.events.FEELEvent;
 import org.kie.dmn.core.util.Msg;
-import org.kie.dmn.core.compiler.ImportDMNResolverUtil;
+import org.kie.dmn.core.compiler.DMNImportsUtil;
 
 import function org.kie.dmn.core.util.NamespaceUtil.getNamespaceAndName;
 import function java.util.Collections.emptyMap;
@@ -65,12 +65,12 @@ when
   Definitions($ns : namespace)
   $o: Expression( !(this instanceof UnaryTests), typeRef != null, 
getNamespaceAndName(this, emptyMap(), typeRef, $ns).namespaceURI != 
getURIFEEL(), $typeRef : typeRef )
   (and (not ItemDefinition( name == $typeRef.getLocalPart() ) )
-       (not (and Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.DMN, $importName : name, $importedNS : 
namespace )
+       (not (and Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.DMN, $importName : name, $importedNS : namespace )
                  $importDef : Definitions( namespace == $importedNS ) from 
entry-point "DMNImports"
                  ItemDefinition( $typeRef.getLocalPart() == $importName + "." 
+ name ) from $importDef.itemDefinition
             )
        )
-       (not Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] 
( name + "." ) ) )
+       (not Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] ( name 
+ "." ) ) )
   )
 then
   reporter.report( DMNMessage.Severity.ERROR,  $o , 
Msg.UNKNOWN_TYPE_REF_ON_NODE, $typeRef, 
$o.getParentDRDElement().getIdentifierString() );
@@ -81,12 +81,12 @@ when
   Definitions($ns : namespace)
   $o: InformationItem( typeRef != null, getNamespaceAndName(this, emptyMap(), 
typeRef, $ns).namespaceURI != getURIFEEL(), $typeRef : typeRef )
   (and (not ItemDefinition( name == $typeRef.getLocalPart() ) )
-       (not (and Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.DMN, $importName : name, $importedNS : 
namespace )
+       (not (and Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.DMN, $importName : name, $importedNS : namespace )
                  $importDef : Definitions( namespace == $importedNS ) from 
entry-point "DMNImports"
                  ItemDefinition( $typeRef.getLocalPart() == $importName + "." 
+ name ) from $importDef.itemDefinition
             )
        )
-       (not Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] 
( name + "." ) ) )
+       (not Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] ( name 
+ "." ) ) )
   )
 then
   reporter.report( DMNMessage.Severity.ERROR,  $o , 
Msg.UNKNOWN_TYPE_REF_ON_NODE, $typeRef, 
$o.getParentDRDElement().getIdentifierString() );
@@ -97,12 +97,12 @@ when
   Definitions($ns : namespace)
   $o: ItemDefinition( typeRef != null, getNamespaceAndName(this, emptyMap(), 
typeRef, $ns).namespaceURI != getURIFEEL(), $typeRef : typeRef )
   (and (not ItemDefinition( name == $typeRef.getLocalPart() ) )
-       (not (and Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.DMN, $importName : name, $importedNS : 
namespace )
+       (not (and Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.DMN, $importName : name, $importedNS : namespace )
                  $importDef : Definitions( namespace == $importedNS ) from 
entry-point "DMNImports"
                  ItemDefinition( $typeRef.getLocalPart() == $importName + "." 
+ name ) from $importDef.itemDefinition
             )
        )
-       (not Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] 
( name + "." ) ) )
+       (not Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] ( name 
+ "." ) ) )
   )
 then
   reporter.report( DMNMessage.Severity.ERROR,  $o , 
Msg.UNKNOWN_TYPE_REF_ON_NODE, $typeRef, 
$o.getParentDRDElement().getIdentifierString() );
@@ -113,12 +113,12 @@ when
   Definitions($ns : namespace)
   $o: OutputClause( typeRef != null, getNamespaceAndName(this, emptyMap(), 
typeRef, $ns).namespaceURI != getURIFEEL(), $typeRef : typeRef )
   (and (not ItemDefinition( name == $typeRef.getLocalPart() ) )
-       (not (and Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.DMN, $importName : name, $importedNS : 
namespace )
+       (not (and Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.DMN, $importName : name, $importedNS : namespace )
                  $importDef : Definitions( namespace == $importedNS ) from 
entry-point "DMNImports"
                  ItemDefinition( $typeRef.getLocalPart() == $importName + "." 
+ name ) from $importDef.itemDefinition
             )
        )
-       (not Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] 
( name + "." ) ) )
+       (not Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] ( name 
+ "." ) ) )
   )
 then
   reporter.report( DMNMessage.Severity.ERROR,  $o , 
Msg.UNKNOWN_TYPE_REF_ON_NODE, $typeRef, 
$o.getParentDRDElement().getIdentifierString() );
diff --git 
a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_3/dmn-validation-rules-dmndi.drl
 
b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_3/dmn-validation-rules-dmndi.drl
index 5c195827bb..e3a2f059b8 100644
--- 
a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_3/dmn-validation-rules-dmndi.drl
+++ 
b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_3/dmn-validation-rules-dmndi.drl
@@ -100,7 +100,7 @@ when
     DMNDI()
     $shape : DMNShape($prefix : dmnElementRef.prefix != 
XMLConstants.DEFAULT_NS_PREFIX)
     Definitions($nsContext : nsContext)
-    $import : Import(ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.DMN, namespace == $nsContext[$prefix])
+    $import : Import(DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.DMN, namespace == $nsContext[$prefix])
     $importDef : Definitions(namespace == $import.namespace) from entry-point 
"DMNImports"
     not DRGElement(id == $shape.dmnElementRef.localPart) from 
$importDef.drgElement
     not TextAnnotation(id == $shape.dmnElementRef.localPart) from 
$importDef.artifact
@@ -126,7 +126,7 @@ when
     DMNDI()
     $edge : DMNEdge($prefix : dmnElementRef.prefix != 
XMLConstants.DEFAULT_NS_PREFIX, $localPart : dmnElementRef.localPart)
     Definitions($nsContext : nsContext)
-    $import : Import(ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.DMN, namespace == $nsContext[$prefix])
+    $import : Import(DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.DMN, namespace == $nsContext[$prefix])
     $importDef : Definitions(namespace == $import.namespace) from entry-point 
"DMNImports"
     eval(!doesDefinitionsContainIdForDMNEdge($importDef, $localPart))
 then
diff --git 
a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_3/dmn-validation-rules-typeref.drl
 
b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_3/dmn-validation-rules-typeref.drl
index 19cd904d98..683e40692e 100644
--- 
a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_3/dmn-validation-rules-typeref.drl
+++ 
b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1_3/dmn-validation-rules-typeref.drl
@@ -28,7 +28,7 @@ import org.kie.dmn.feel.parser.feel11.FEELParser;
 import org.kie.dmn.feel.runtime.events.SyntaxErrorEvent;
 import org.kie.dmn.api.feel.runtime.events.FEELEvent;
 import org.kie.dmn.core.util.Msg;
-import org.kie.dmn.core.compiler.ImportDMNResolverUtil;
+import org.kie.dmn.core.compiler.DMNImportsUtil;
 
 import function org.kie.dmn.core.util.NamespaceUtil.getNamespaceAndName;
 import function java.util.Collections.emptyMap;
@@ -65,12 +65,12 @@ when
   Definitions($ns : namespace)
   $o: Expression( !(this instanceof UnaryTests), typeRef != null, 
getNamespaceAndName(this, emptyMap(), typeRef, $ns).namespaceURI != 
getURIFEEL(), $typeRef : typeRef )
   (and (not ItemDefinition( name == $typeRef.getLocalPart() ) )
-       (not (and Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.DMN, $importName : name, $importedNS : 
namespace )
+       (not (and Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.DMN, $importName : name, $importedNS : namespace )
                  $importDef : Definitions( namespace == $importedNS ) from 
entry-point "DMNImports"
                  ItemDefinition( $typeRef.getLocalPart() == $importName + "." 
+ name ) from $importDef.itemDefinition
             )
        )
-       (not Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] 
( name + "." ) ) )
+       (not Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] ( name 
+ "." ) ) )
   )
 then
   reporter.report( DMNMessage.Severity.ERROR,  $o , 
Msg.UNKNOWN_TYPE_REF_ON_NODE, $typeRef, 
$o.getParentDRDElement().getIdentifierString() );
@@ -81,12 +81,12 @@ when
   Definitions($ns : namespace)
   $o: InformationItem( typeRef != null, getNamespaceAndName(this, emptyMap(), 
typeRef, $ns).namespaceURI != getURIFEEL(), $typeRef : typeRef )
   (and (not ItemDefinition( name == $typeRef.getLocalPart() ) )
-       (not (and Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.DMN, $importName : name, $importedNS : 
namespace )
+       (not (and Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.DMN, $importName : name, $importedNS : namespace )
                  $importDef : Definitions( namespace == $importedNS ) from 
entry-point "DMNImports"
                  ItemDefinition( $typeRef.getLocalPart() == $importName + "." 
+ name ) from $importDef.itemDefinition
             )
        )
-       (not Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] 
( name + "." ) ) )
+       (not Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] ( name 
+ "." ) ) )
   )
 then
   reporter.report( DMNMessage.Severity.ERROR,  $o , 
Msg.UNKNOWN_TYPE_REF_ON_NODE, $typeRef, 
$o.getParentDRDElement().getIdentifierString() );
@@ -97,12 +97,12 @@ when
   Definitions($ns : namespace)
   $o: ItemDefinition( typeRef != null, getNamespaceAndName(this, emptyMap(), 
typeRef, $ns).namespaceURI != getURIFEEL(), $typeRef : typeRef )
   (and (not ItemDefinition( name == $typeRef.getLocalPart() ) )
-       (not (and Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.DMN, $importName : name, $importedNS : 
namespace )
+       (not (and Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.DMN, $importName : name, $importedNS : namespace )
                  $importDef : Definitions( namespace == $importedNS ) from 
entry-point "DMNImports"
                  ItemDefinition( $typeRef.getLocalPart() == $importName + "." 
+ name ) from $importDef.itemDefinition
             )
        )
-       (not Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] 
( name + "." ) ) )
+       (not Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] ( name 
+ "." ) ) )
   )
 then
   reporter.report( DMNMessage.Severity.ERROR,  $o , 
Msg.UNKNOWN_TYPE_REF_ON_NODE, $typeRef, 
$o.getParentDRDElement().getIdentifierString() );
@@ -113,12 +113,12 @@ when
   Definitions($ns : namespace)
   $o: OutputClause( typeRef != null, getNamespaceAndName(this, emptyMap(), 
typeRef, $ns).namespaceURI != getURIFEEL(), $typeRef : typeRef )
   (and (not ItemDefinition( name == $typeRef.getLocalPart() ) )
-       (not (and Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.DMN, $importName : name, $importedNS : 
namespace )
+       (not (and Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.DMN, $importName : name, $importedNS : namespace )
                  $importDef : Definitions( namespace == $importedNS ) from 
entry-point "DMNImports"
                  ItemDefinition( $typeRef.getLocalPart() == $importName + "." 
+ name ) from $importDef.itemDefinition
             )
        )
-       (not Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] 
( name + "." ) ) )
+       (not Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.PMML, $typeRef.getLocalPart() str[startsWith] ( name 
+ "." ) ) )
   )
 then
   reporter.report( DMNMessage.Severity.ERROR,  $o , 
Msg.UNKNOWN_TYPE_REF_ON_NODE, $typeRef, 
$o.getParentDRDElement().getIdentifierString() );
diff --git 
a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1x/dmn-validation-rules.drl
 
b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1x/dmn-validation-rules.drl
index 565c916b21..c43f3f0703 100644
--- 
a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1x/dmn-validation-rules.drl
+++ 
b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1x/dmn-validation-rules.drl
@@ -28,7 +28,7 @@ import org.kie.dmn.feel.parser.feel11.FEELParser;
 import org.kie.dmn.feel.runtime.events.SyntaxErrorEvent;
 import org.kie.dmn.api.feel.runtime.events.FEELEvent;
 import org.kie.dmn.core.util.Msg;
-import org.kie.dmn.core.compiler.ImportDMNResolverUtil;
+import org.kie.dmn.core.compiler.DMNImportsUtil;
 import org.kie.dmn.validation.ValidatorUtil;
 
 import function org.kie.dmn.validation.ValidatorUtil.rightOfHash;
@@ -40,7 +40,7 @@ declare entry-point "DMNImports" end
 
 rule MISSING_IMPORT_p1
 when
-  $elemRef : Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.DMN,
+  $elemRef : Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.DMN,
                      $importedNS : namespace,
                      
getAdditionalAttributes().get(ValidatorUtil.KIE_MODEL_NAME_QNAME) == null )
   not( Definitions( namespace == $importedNS ) from entry-point "DMNImports" )
@@ -50,7 +50,7 @@ end
 
 rule MISSING_IMPORT_p2
 when
-  $elemRef : Import( ImportDMNResolverUtil.whichImportType(this) == 
ImportDMNResolverUtil.ImportType.DMN,
+  $elemRef : Import( DMNImportsUtil.whichImportType(this) == 
DMNImportsUtil.ImportType.DMN,
                      $importedNS : namespace,
                      
getAdditionalAttributes().get(ValidatorUtil.KIE_MODEL_NAME_QNAME) != null,
                      $importedName : 
getAdditionalAttributes().get(ValidatorUtil.KIE_MODEL_NAME_QNAME) )


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

Reply via email to