From: Tuukka Lehtonen Date: Fri, 16 Jun 2017 07:09:47 +0000 (+0300) Subject: Merge "Default property editing restores assertions" X-Git-Tag: v1.31.0~311 X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=3f5adda763f6281e9988277d067c1f71615e3da2 Merge "Default property editing restores assertions" --- 3f5adda763f6281e9988277d067c1f71615e3da2 diff --cc bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Layer0Utils.java index 198ee41b7,103c9bb01..5ccfcf325 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Layer0Utils.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Layer0Utils.java @@@ -1383,8 -1383,21 +1383,22 @@@ public class Layer0Utils TransferableGraphSource source = makeTGSource(graph, resource); TransferableGraph1 tg = TransferableGraphs.create(graph, source); GraphRefactoringUtils.fixOntologyExport(tg); - return PrettyPrintTG.print(tg); + System.out.println("Printing resoure " + graph.getURI(resource)); + return PrettyPrintTG.print(tg, ignoreIdentifiers); } + public static Resource getPossibleAssertedObject(ReadGraph graph, Resource resource, Resource predicate) throws DatabaseException { + Resource result = null; + for(Resource type : graph.getPrincipalTypes(resource)) { + Collection rs = graph.getAssertedObjects(type, predicate); + if(rs.size() > 1) return null; + if(rs.size() == 1) { + Resource ass = rs.iterator().next(); + if (result != null && !result.equals(ass)) return null; + result = ass; + } + } + return result; + } + }