From da4cc0ede99247df95557b92dc173d50c341b73f Mon Sep 17 00:00:00 2001 From: Antti Villberg Date: Thu, 28 Sep 2017 14:13:29 +0300 Subject: [PATCH] Exclude fully weak relations to external resources in model TG export refs #7516 Change-Id: I63759780310eab31f3b7f8417c8c48080857bfa9 --- .../db/layer0/util/DomainProcessor3.java | 9 +++++--- .../ModelTransferableGraphSourceRequest.java | 23 +++++++++++++++++-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/DomainProcessor3.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/DomainProcessor3.java index 7a0a5f06b..20856d4ce 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/DomainProcessor3.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/DomainProcessor3.java @@ -2,6 +2,7 @@ package org.simantics.db.layer0.util; import java.io.IOException; import java.io.InputStream; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; @@ -20,6 +21,7 @@ import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.ResourceMap; import org.simantics.db.Statement; +import org.simantics.db.common.StandardStatement; import org.simantics.db.common.primitiverequest.Value; import org.simantics.db.common.procedure.adapter.TransientCacheListener; import org.simantics.db.common.utils.NameUtils; @@ -61,7 +63,7 @@ public class DomainProcessor3 { Map isRelatedToPredicates = null; Set deadPredicates = null; Set strongInverseSet = null; - + List unresolvedWeakLinks = new ArrayList<>(); TIntIntHashMap ids = null; ResourceMap status = null; Map bindings = new HashMap(); @@ -367,8 +369,9 @@ public class DomainProcessor3 { // The inverse is also weak (or there is no inverse) if(!strongInverseSet.contains(predicate)) { - - addToStream(predicate, object); + + unresolvedWeakLinks.add(new StandardStatement(subject, predicate, object)); + //addToStream(predicate, object); if(objectStatus == null) { status.put(object, ExtentStatus.PENDING); diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/ModelTransferableGraphSourceRequest.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/ModelTransferableGraphSourceRequest.java index 5760f1a02..b7fe6ed7b 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/ModelTransferableGraphSourceRequest.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/ModelTransferableGraphSourceRequest.java @@ -438,8 +438,12 @@ public class ModelTransferableGraphSourceRequest extends UniqueRead this must then be external + //state.externals.add(transientId); + // Pending resources are found through weak links - if they are still pending at this stage do not add an external + processor.status.put(r, ExtentStatus.EXTERNAL); + } else { state.pending.add(transientId); System.err.println("Pending status in export: " + NameUtils.getSafeName(graph, r, true) + " (" + graph.getPossibleURI(r) + ")"); @@ -447,6 +451,21 @@ public class ModelTransferableGraphSourceRequest extends UniqueRead