diff --git a/com.incquerylabs.v4md/src/main/com/incquerylabs/v4md/internal/MagicDrawProjectScope.java b/com.incquerylabs.v4md/src/main/com/incquerylabs/v4md/internal/MagicDrawProjectScope.java index 5c2350c..8a72b5e 100644 --- a/com.incquerylabs.v4md/src/main/com/incquerylabs/v4md/internal/MagicDrawProjectScope.java +++ b/com.incquerylabs.v4md/src/main/com/incquerylabs/v4md/internal/MagicDrawProjectScope.java @@ -19,6 +19,7 @@ import org.eclipse.viatra.query.runtime.emf.EMFScope; import com.nomagic.magicdraw.core.Project; +import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Package; public class MagicDrawProjectScope extends EMFScope { @@ -34,7 +35,8 @@ public class MagicDrawProjectScope extends EMFScope { .withStrictNotificationMode(false); static Stream getProjectModels(Project projectModel) { - return projectModel.getModels().stream(); + Package primaryModel = projectModel.getPrimaryModel(); + return projectModel.getModels().stream().filter(pkg -> pkg == primaryModel || !EcoreUtil.isAncestor(primaryModel, pkg)); } static Stream getCustomNotifiers(Notifier... notifiers) {