From: Tuukka Lehtonen Date: Mon, 3 Apr 2017 12:10:34 +0000 (+0300) Subject: Database backwards compatibility fix for fail-safe import changes X-Git-Tag: v1.29.0~122 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F98%2F398%2F1;p=simantics%2Fplatform.git Database backwards compatibility fix for fail-safe import changes To keep databases created before Mar 30 18:39 compatible with the current git master version. refs #7016 Change-Id: Ic327809eae90d01d115cfb880a33b9dc37051a36 --- diff --git a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/CoreInitialization.java b/bundles/org.simantics.graph.db/src/org/simantics/graph/db/CoreInitialization.java index 096f0a00f..b64149032 100644 --- a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/CoreInitialization.java +++ b/bundles/org.simantics.graph.db/src/org/simantics/graph/db/CoreInitialization.java @@ -28,6 +28,10 @@ public class CoreInitialization { } static { + // IMPORTANT NOTICE: + // DO NOT alter the order of these definitions in any way + // unless you deliberately want to make the system incompatible + // with databases that have been created before changing these. addLayer0Builtin("InstanceOf"); addLayer0Builtin("Inherits"); addLayer0Builtin("SubrelationOf"); @@ -38,7 +42,6 @@ public class CoreInitialization { addLayer0Builtin("ConsistsOf"); addLayer0Builtin("PartOf"); - addLayer0Builtin("ExternalEntity"); addLayer0Builtin("String"); addLayer0Builtin("Library"); @@ -50,7 +53,33 @@ public class CoreInitialization { addLayer0Builtin("HasPredicateInverse"); addLayer0Builtin("HasObject"); + // #7016: This bogus URI replaces the builtin entry + // that was originally http://Projects. + // + // addBuiltin("http://Projects") was removed because its existence + // resulted in a non-functioning URI space because: + // + // 1. http://Projects was added as a "built-in resource" when the database + // is first initialized which means that ReadGraph.getResource("http://Projects") + // would succeed even when the resource was not yet properly imported + // from the project ontology. + // + // 2. When the project ontology is imported, a new resource is + // created to represent http://Projects instead of using the existing + // uninitialized "built-in resource". The L0.ExternalEntity changes made + // to the standard transferable graph import in this patch caused the + // code to find the built-in resource for "http://Projects" and think + // that it has to be a resource that's already properly initialized. + // This led to the TG import not initializing the resource at all. + // Previously there was a bug here as well but it was hidden by the fact + // that the system would import the actual/new "http://Projects" + // resource from the ontology anyway. This effectively left the + // uninitialized built-in resource just hanging in the database as + // trash. + //addBuiltin("http://Projects"); + addBuiltin("75e23fb39121b4b37cf2e6a26ccb34c52f77522d-do-not-remove"); addBuiltin("http:/"); + addLayer0Builtin("ExternalEntity"); } public static void initializeBuiltins(Session session) throws DatabaseException {