From f5d579079d4a49913256d6fb907ed748f80b3312 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Fri, 12 May 2017 10:20:15 +0300 Subject: [PATCH] (refs #7216) Removed OldTransferableGraph1 and all referring code Change-Id: Idde9dde36c06b5270730036ab7e435f38f59a5fd --- .../META-INF/MANIFEST.MF | 3 +- .../db/old/OldMissingDependencyException.java | 31 -- .../OldTransferableGraphImportProcess1.java | 479 ------------------ .../graph/db/old/OldTransferableGraphs.java | 57 --- .../org.simantics.graph/META-INF/MANIFEST.MF | 1 - .../query/TransferableGraphConversion.java | 5 - .../refactoring/GraphRefactoringUtils.java | 70 --- .../refactoring/PrintReferencesTool.java | 47 -- .../graph/refactoring/RefactoringTool.java | 81 --- .../old/OldTransferableGraph1.java | 88 ---- .../graph/representation/old/OldValue1.java | 31 -- .../tests/refactoring/TestRefactoring.java | 29 -- .../tests/refactoring/TestRefactoring2.java | 44 -- .../graph/tests/refactoring/mappingSpec.txt | 6 - .../graph/tests/refactoring/xor5.aprosSymbol | Bin 26902 -> 0 bytes 15 files changed, 1 insertion(+), 971 deletions(-) delete mode 100644 bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldMissingDependencyException.java delete mode 100644 bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldTransferableGraphImportProcess1.java delete mode 100644 bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldTransferableGraphs.java delete mode 100644 bundles/org.simantics.graph/src/org/simantics/graph/refactoring/PrintReferencesTool.java delete mode 100644 bundles/org.simantics.graph/src/org/simantics/graph/refactoring/RefactoringTool.java delete mode 100644 bundles/org.simantics.graph/src/org/simantics/graph/representation/old/OldTransferableGraph1.java delete mode 100644 bundles/org.simantics.graph/src/org/simantics/graph/representation/old/OldValue1.java delete mode 100644 bundles/org.simantics.graph/tests/org/simantics/graph/tests/refactoring/TestRefactoring.java delete mode 100644 bundles/org.simantics.graph/tests/org/simantics/graph/tests/refactoring/TestRefactoring2.java delete mode 100644 bundles/org.simantics.graph/tests/org/simantics/graph/tests/refactoring/mappingSpec.txt delete mode 100644 bundles/org.simantics.graph/tests/org/simantics/graph/tests/refactoring/xor5.aprosSymbol diff --git a/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF b/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF index f21b3e776..165a104ed 100644 --- a/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF @@ -9,6 +9,5 @@ Require-Bundle: org.simantics.graph;bundle-version="1.0.0";visibility:=reexport, gnu.trove3;bundle-version="3.0.3", org.simantics.layer0;bundle-version="1.0.0", org.slf4j.api;bundle-version="1.7.2" -Export-Package: org.simantics.graph.db, - org.simantics.graph.db.old +Export-Package: org.simantics.graph.db Bundle-Vendor: VTT Technical Research Centre of Finland diff --git a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldMissingDependencyException.java b/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldMissingDependencyException.java deleted file mode 100644 index 7ca83f318..000000000 --- a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldMissingDependencyException.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.simantics.graph.db.old; - -import java.util.Set; - -import org.simantics.db.exception.DatabaseException; - -public class OldMissingDependencyException extends DatabaseException { - - private static final long serialVersionUID = -1579450497603555931L; - - private final OldTransferableGraphImportProcess1 process; - - public OldMissingDependencyException(OldTransferableGraphImportProcess1 process) { - super(createMessage(process)); - this.process = process; - } - - private static String createMessage(OldTransferableGraphImportProcess1 process) { - StringBuilder b = new StringBuilder(); - b.append("The following references were not found:\r\n"); - for(String missing : process.missingExternals) { - b.append(" -" + missing + "\r\n"); - } - return b.toString(); - } - - public Set getMissingURIs() { - return process.missingExternals; - } - -} diff --git a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldTransferableGraphImportProcess1.java b/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldTransferableGraphImportProcess1.java deleted file mode 100644 index 6a69e8d92..000000000 --- a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldTransferableGraphImportProcess1.java +++ /dev/null @@ -1,479 +0,0 @@ -package org.simantics.graph.db.old; - -import java.io.DataOutput; -import java.io.DataOutputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.simantics.databoard.Bindings; -import org.simantics.databoard.adapter.AdaptException; -import org.simantics.databoard.binding.mutable.Variant; -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.VirtualGraph; -import org.simantics.db.WriteOnlyGraph; -import org.simantics.db.common.WriteBindings; -import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener; -import org.simantics.db.common.uri.UnescapedChildMapOfResource; -import org.simantics.db.common.utils.Logger; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.exception.ResourceNotFoundException; -import org.simantics.db.service.ClusterBuilder; -import org.simantics.db.service.ClusterBuilder.ResourceHandle; -import org.simantics.db.service.SerialisationSupport; -import org.simantics.db.service.TransferableGraphSupport; -import org.simantics.graph.db.CoreInitialization; -import org.simantics.graph.db.IImportAdvisor; -import org.simantics.graph.representation.Extensions; -import org.simantics.graph.representation.External; -import org.simantics.graph.representation.Identity; -import org.simantics.graph.representation.IdentityDefinition; -import org.simantics.graph.representation.Internal; -import org.simantics.graph.representation.Optional; -import org.simantics.graph.representation.Root; -import org.simantics.graph.representation.TransferableGraphUtils; -import org.simantics.graph.representation.old.OldTransferableGraph1; -import org.simantics.graph.representation.old.OldValue1; - -public class OldTransferableGraphImportProcess1 { - - public static String LOG_FILE = "transferableGraphs.log"; - final static private boolean LOG = false; - - static DataOutput log; - - static { - - if (LOG) { - try { - FileOutputStream stream = new FileOutputStream(LOG_FILE); - log = new DataOutputStream(stream); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - } - - } - - private static void log(String line) { - if (LOG) { - try { - log.writeUTF(line + "\n"); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - OldTransferableGraph1 tg; - IImportAdvisor advisor; - - Resource[] resources; - ResourceHandle[] handles; - - Set missingExternals = new HashSet(); - - // Builtins - Resource RootLibrary; - Resource String; - Resource Library; - - Resource InstanceOf; - Resource ConsistsOf; - Resource PartOf; - Resource HasName; - Resource NameOf; - - public OldTransferableGraphImportProcess1(OldTransferableGraph1 tg, IImportAdvisor advisor) { - this.tg = tg; - this.advisor = advisor; - /*System.out.println("Transferable graph identities:"); - for(Identity id : tg.identities) { - if(id.definition instanceof Internal) { - Internal def = (Internal)id.definition; - System.out.println(" internal " + def.name); - } - else if(id.definition instanceof External) { - External def = (External)id.definition; - System.out.println(" external " + def.name); - } - }*/ - } - - public void findBuiltins(WriteOnlyGraph g) throws DatabaseException { - RootLibrary = g.getBuiltin("http:/"); - String = g.getBuiltin(CoreInitialization.LAYER0 + "String"); - Library = g.getBuiltin(CoreInitialization.LAYER0 + "Library"); - InstanceOf = g.getBuiltin(CoreInitialization.LAYER0 + "InstanceOf"); - ConsistsOf = g.getBuiltin(CoreInitialization.LAYER0 + "ConsistsOf"); - PartOf = g.getBuiltin(CoreInitialization.LAYER0 + "PartOf"); - HasName = g.getBuiltin(CoreInitialization.LAYER0 + "HasName"); - NameOf = g.getBuiltin(CoreInitialization.LAYER0 + "NameOf"); - } - - public void findBuiltins(ReadGraph g) throws DatabaseException { - RootLibrary = g.getBuiltin("http:/"); - String = g.getBuiltin(CoreInitialization.LAYER0 + "String"); - Library = g.getBuiltin(CoreInitialization.LAYER0 + "Library"); - InstanceOf = g.getBuiltin(CoreInitialization.LAYER0 + "InstanceOf"); - ConsistsOf = g.getBuiltin(CoreInitialization.LAYER0 + "ConsistsOf"); - PartOf = g.getBuiltin(CoreInitialization.LAYER0 + "PartOf"); - HasName = g.getBuiltin(CoreInitialization.LAYER0 + "HasName"); - NameOf = g.getBuiltin(CoreInitialization.LAYER0 + "NameOf"); - } - - /* Preparation that is used when the core is empty. - */ - void initialPrepare(WriteOnlyGraph graph) throws DatabaseException { - findBuiltins(graph); - - resources = new Resource[tg.resourceCount]; - - int Root = -1; - int SimanticsDomain = -1; - int Layer0 = -1; - - for(Identity identity : tg.identities) { - if(identity.definition instanceof Internal) { - Internal def = (Internal)identity.definition; - Resource res = null; - if(def.parent == Layer0) { - try { - res = graph.getBuiltin(CoreInitialization.LAYER0 + def.name); - } catch(ResourceNotFoundException e) { - } - } - else if(def.parent == SimanticsDomain) { - if(def.name.equals("Layer0-1.1")) - Layer0 = identity.resource; - } - else if(def.parent == Root) { - if(def.name.equals("www.simantics.org")) - SimanticsDomain = identity.resource; - } - - if(res == null) - res = createChild(graph, resources[def.parent], def.name); - else - createChild(graph, res, resources[def.parent], def.name); - resources[identity.resource] = res; - } - else if(identity.definition instanceof Root) { - Root = identity.resource; - resources[identity.resource] = RootLibrary; - } - } - } - - void addMissing(String external) { - Set removals = new HashSet(); - for(String ext : missingExternals) if(ext.startsWith(external)) return; - for(String ext : missingExternals) if(external.startsWith(ext)) removals.add(ext); - missingExternals.removeAll(removals); - missingExternals.add(external); - } - - void prepare(ReadGraph graph) throws DatabaseException { - findBuiltins(graph); - - Resource[] resources = new Resource[tg.resourceCount]; - - for(Identity identity : tg.identities) { - IdentityDefinition definition = identity.definition; - if(definition instanceof External) { - External def = (External)definition; - if(def.parent == -1) { - resources[identity.resource] = RootLibrary; - } else { - if("@inverse".equals(def.name)) { - Resource parent = resources[def.parent]; - Resource child = graph.getInverse(parent); - resources[identity.resource] = child; - } else { - Resource parent = resources[def.parent]; - // TODO: escape should be removed when names become well-behaving - if(parent != null) { - Resource child = graph - .syncRequest(new UnescapedChildMapOfResource(parent), - new TransientCacheAsyncListener>()) - .get(def.name); - if(child == null) { - addMissing(graph.getURI(parent) + "/" + def.name); - } - resources[identity.resource] = child; - } else { - addMissing(TransferableGraphUtils.getURI(tg.resourceCount, tg.identities, def.parent) + "/" + def.name); - } - } - } - } - else if(definition instanceof Internal) { - // Do not do anything for now - } - else if(definition instanceof Root) { - Root root = (Root)definition; - if(root.name.equals("")) - resources[identity.resource] = RootLibrary; - else - advisor.analyzeRoot(graph, root); - } - else if(definition instanceof Optional) { - External def = (External)definition; - Resource parent = resources[def.parent]; - if(parent != null) - resources[identity.resource] = - graph.syncRequest(new UnescapedChildMapOfResource(parent)).get(def.name); - } - } - - this.resources = resources; - - if(!missingExternals.isEmpty()) throw new OldMissingDependencyException(this); - - } - - Resource createChild(WriteOnlyGraph graph, Resource parent, String name) throws DatabaseException { - Resource child = graph.newResource(); - graph.claim(parent, ConsistsOf, PartOf, child); - Resource nameResource = graph.newResource(); - graph.claim(nameResource, InstanceOf, null, String); - graph.claimValue(nameResource, name, WriteBindings.STRING); - graph.claim(child, HasName, NameOf, nameResource); - return child; - } - - void createChild(WriteOnlyGraph graph, Resource child, Resource parent, String name) throws DatabaseException { - graph.claim(parent, ConsistsOf, PartOf, child); - Resource nameResource = graph.newResource(); - graph.claim(nameResource, InstanceOf, null, String); - graph.claimValue(nameResource, name, WriteBindings.STRING); - graph.claim(child, HasName, NameOf, nameResource); - } - - int[] getClustering() { - Variant v = tg.extensions.get(Extensions.CLUSTERING); - if(v == null) return null; - try { - return (int[])v.getValue(Bindings.INT_ARRAY); - } catch (AdaptException e) { - Logger.defaultLogError(e); - return null; - } - } - - void write(WriteOnlyGraph graph) throws DatabaseException { - - Resource[] resources = this.resources; - - this.handles = new ResourceHandle[resources.length]; - - ResourceHandle[] handles = this.handles; - - int[] clustering = getClustering(); - - // Internal identities - for(Identity identity : tg.identities) { - IdentityDefinition definition = identity.definition; - if(resources[identity.resource] != null) - continue; - if(definition instanceof External) { - // Already done everything - } - else if(definition instanceof Internal) { - Internal def = (Internal)definition; - resources[identity.resource] = - createChild(graph, resources[def.parent], def.name); - } - else if(definition instanceof Root) { - Root root = (Root)definition; - resources[identity.resource] = advisor.createRoot(graph, root); - } - else if(definition instanceof Optional) { - Optional def = (Optional)definition; - Resource child = createChild(graph, resources[def.parent], def.name); - graph.claim(child, InstanceOf, null, Library); // ??? - resources[identity.resource] = child; - } - } - - ClusterBuilder builder = graph.getService(ClusterBuilder.class); - SerialisationSupport ss = graph.getService(SerialisationSupport.class); - - if(clustering != null) { - - int i = 0; - for(int c : clustering) { - builder.newCluster(); - for(int r=0;r= 0) { - - if(resources[obj] == null) { - ResourceHandle inverse = handles[inv]; - object.addStatement(graph, inverse, subject); - } else { - graph.claim( - handles[obj].resource(ss), - handles[inv].resource(ss), - null, handles[sub].resource(ss)); - } - - } - - if(LOG) { - log("[STATEMENT] " + resources[statements[i]].getResourceId() + ", " + resources[statements[i+1]].getResourceId() + ", " + resources[statements[i+3]].getResourceId()); - } - - } - - // Write values - TransferableGraphSupport tgSupport = - graph.getService(TransferableGraphSupport.class); - VirtualGraph vg = graph.getProvider(); - for(OldValue1 value : tg.values) { - int file = value.resource & 0x80000000; - int resource = value.resource & 0x7FFFFFFF; - if (file != 0) { - graph.claimValue(handles[resource].resource(ss), value.value, Bindings.BYTE_ARRAY); - } else { - if(resource < internals) { - handles[resource].addValue(graph, value.value); - } else { - tgSupport.setValue(graph, handles[resource].resource(ss), vg, value.value); - } - //tgSupport.setValue(resources[resource], vg, value.value); - } - } - } - - void write2(WriteOnlyGraph graph) throws DatabaseException { - Resource[] resources = this.resources; - - // Internal identities - for(Identity identity : tg.identities) { - IdentityDefinition definition = identity.definition; - if(resources[identity.resource] != null) - continue; - if(definition instanceof External) { - // Already done everything - } - else if(definition instanceof Internal) { - Internal def = (Internal)definition; - resources[identity.resource] = - createChild(graph, resources[def.parent], def.name); - } - else if(definition instanceof Root) { - Root root = (Root)definition; - resources[identity.resource] = advisor.createRoot(graph, root); - } - else if(definition instanceof Optional) { - Optional def = (Optional)definition; - Resource child = createChild(graph, resources[def.parent], def.name); - graph.claim(child, InstanceOf, null, Library); // ??? - resources[identity.resource] = child; - } - } - - // Create blank resources - for(int i=0;i callback) throws DatabaseException, TransferableGraphException { - final OldTransferableGraphImportProcess1 process = new OldTransferableGraphImportProcess1(tg, - advisor == null ? new ImportAdvisor() : advisor); - session.syncRequest(new ReadRequest() { - @Override - public void run(ReadGraph graph) throws DatabaseException { - process.prepare(graph); - } - }); - session.syncRequest(new WriteOnlyRequest() { - @Override - public void perform(WriteOnlyGraph graph) throws DatabaseException { - process.write(graph); - if(callback != null) - callback.apply(graph, process); - } - }); - } - - public static void importGraph1(WriteGraph graph, final OldTransferableGraph1 tg, IImportAdvisor advisor) throws DatabaseException { - final OldTransferableGraphImportProcess1 process = new OldTransferableGraphImportProcess1(tg, - advisor == null ? new ImportAdvisor() : advisor); - process.prepare(graph); - process.write2(graph); - - } - -} diff --git a/bundles/org.simantics.graph/META-INF/MANIFEST.MF b/bundles/org.simantics.graph/META-INF/MANIFEST.MF index d64e63f57..6ae6e86fe 100644 --- a/bundles/org.simantics.graph/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.graph/META-INF/MANIFEST.MF @@ -12,7 +12,6 @@ Export-Package: org.simantics.graph, org.simantics.graph.query, org.simantics.graph.refactoring, org.simantics.graph.representation, - org.simantics.graph.representation.old, org.simantics.graph.store, org.simantics.graph.tests.conversion, org.simantics.graph.utils diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/query/TransferableGraphConversion.java b/bundles/org.simantics.graph/src/org/simantics/graph/query/TransferableGraphConversion.java index 850c47d85..9c96f834d 100644 --- a/bundles/org.simantics.graph/src/org/simantics/graph/query/TransferableGraphConversion.java +++ b/bundles/org.simantics.graph/src/org/simantics/graph/query/TransferableGraphConversion.java @@ -15,7 +15,6 @@ import org.simantics.graph.representation.Optional; import org.simantics.graph.representation.Root; import org.simantics.graph.representation.TransferableGraph1; import org.simantics.graph.representation.Value; -import org.simantics.graph.representation.old.OldTransferableGraph1; import org.simantics.graph.store.GraphStore; import org.simantics.graph.store.IStore; import org.simantics.graph.store.IdentityStore; @@ -44,10 +43,6 @@ public class TransferableGraphConversion { return extractIdentities(tg.resourceCount, tg.identities); } - public static IdentityStore extractIdentities(OldTransferableGraph1 tg) { - return extractIdentities(tg.resourceCount, tg.identities); - } - private static IdentityStore extractIdentities(int resourceCount, Identity[] ids) { IdentityStore identities = new IdentityStore(); identities.setResourceCount(resourceCount); diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/GraphRefactoringUtils.java b/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/GraphRefactoringUtils.java index ddc31aa5b..9f8eca398 100644 --- a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/GraphRefactoringUtils.java +++ b/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/GraphRefactoringUtils.java @@ -1,6 +1,5 @@ package org.simantics.graph.refactoring; -import java.util.ArrayList; import java.util.Arrays; import org.simantics.databoard.util.URIStringUtils; @@ -11,14 +10,10 @@ import org.simantics.graph.query.UriUtils; import org.simantics.graph.refactoring.MappingSpecification.MappingRule; import org.simantics.graph.representation.External; import org.simantics.graph.representation.Identity; -import org.simantics.graph.representation.IdentityDefinition; import org.simantics.graph.representation.Internal; -import org.simantics.graph.representation.Optional; import org.simantics.graph.representation.Root; import org.simantics.graph.representation.TransferableGraph1; import org.simantics.graph.representation.TransferableGraphUtils; -import org.simantics.graph.representation.old.OldTransferableGraph1; -import org.simantics.graph.representation.old.OldValue1; import org.simantics.graph.store.GraphStore; import org.simantics.graph.store.IdentityStore; import org.slf4j.Logger; @@ -159,69 +154,4 @@ public class GraphRefactoringUtils { } } - public static void compactify(OldTransferableGraph1 tg, - TIntHashSet removed) { - // Filter removed set - for(Identity id : tg.identities) { - IdentityDefinition def = id.definition; - if(def instanceof Root) - removed.remove(id.resource); - else if(def instanceof External) - removed.remove(((External)def).parent); - else if(def instanceof Internal) - removed.remove(((Internal)def).parent); - else if(def instanceof Optional) - removed.remove(((Optional)def).parent); - } - for(int r : tg.statements) - removed.remove(r); - for(OldValue1 value : tg.values) - removed.remove(value.resource); - - // Compactify - if(!removed.isEmpty()) { - // create map - int resourceCount = tg.resourceCount; - int[] map = new int[resourceCount]; - for(int i=0;i newIdentities = new ArrayList(tg.identities.length); - for(Identity id : tg.identities) { - if(removed.contains(id.resource)) - continue; - else - newIdentities.add(id); - id.resource = map[id.resource]; - IdentityDefinition def = id.definition; - if(def instanceof External) { - External d = (External)def; - d.parent = map[d.parent]; - } - else if(def instanceof Internal) { - External d = (External)def; - d.parent = map[d.parent]; - } - else if(def instanceof Optional) { - External d = (External)def; - d.parent = map[d.parent]; - } - } - tg.identities = newIdentities.toArray(new Identity[newIdentities.size()]); - int[] statements = tg.statements; - for(int i=0;i= 0) - statements[i] = map[r]; - } - for(OldValue1 value : tg.values) - value.resource = map[value.resource]; - tg.resourceCount = resourceCount; - } - } - } diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/PrintReferencesTool.java b/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/PrintReferencesTool.java deleted file mode 100644 index d98069227..000000000 --- a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/PrintReferencesTool.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.simantics.graph.refactoring; - -import gnu.trove.map.hash.THashMap; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; - -import org.simantics.databoard.Files; -import org.simantics.graph.query.TransferableGraphConversion; -import org.simantics.graph.representation.old.OldTransferableGraph1; -import org.simantics.graph.store.IdentityStore; -import org.simantics.graph.store.IdentityStore.ConsistsOf; - -public class PrintReferencesTool { - - public static void main(String[] args) throws Exception { - print(new File(args[0])); - } - - public static void print(File input) throws IOException { - OldTransferableGraph1 tg = (OldTransferableGraph1) - Files.readFile(input, OldTransferableGraph1.BINDING); - GraphRefactoringUtils.fixIncorrectRoot(tg.identities); - IdentityStore idStore = TransferableGraphConversion.extractIdentities(tg); - printExternals(idStore, idStore.getRoot(""), 0); - } - - private static void printExternals(IdentityStore idStore, int cur, int indentation) { - THashMap map = idStore.getChildMap(cur); - if(map == null) - return; - ArrayList names = new ArrayList(map.keySet()); - Collections.sort(names); - for(String name : names) { - ConsistsOf co = map.get(name); - if(!idStore.isNewResource(co.child)) { - for(int i=0;i rules = new ArrayList(); - while(true) { - String line = reader.readLine(); - if(line == null) - break; - line = line.trim(); - if(line.isEmpty()) - continue; - String[] parts = line.trim().split(" "); - if(parts.length != 2) - throw new IOException("Invalid mapping spec format. Every non-empty line should contain two URIs."); - - Path from = UriUtils.uriToPath(parts[0]); - Path to = UriUtils.uriToPath(parts[1]); - - rules.add(new MappingRule(from, to)); - } - reader.close(); - - return new MappingSpecification(rules); - } - -} diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/representation/old/OldTransferableGraph1.java b/bundles/org.simantics.graph/src/org/simantics/graph/representation/old/OldTransferableGraph1.java deleted file mode 100644 index b68bea31e..000000000 --- a/bundles/org.simantics.graph/src/org/simantics/graph/representation/old/OldTransferableGraph1.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.graph.representation.old; - -import java.util.TreeMap; - -import org.simantics.databoard.Bindings; -import org.simantics.databoard.binding.Binding; -import org.simantics.databoard.binding.mutable.Variant; -import org.simantics.databoard.serialization.Serializer; -import org.simantics.graph.representation.External; -import org.simantics.graph.representation.Identity; -import org.simantics.graph.representation.Internal; -import org.simantics.graph.representation.Root; -import org.simantics.graph.tests.conversion.TransferableGraph0; - - -/** - * Transferable graph datatype. - * See specification. - * @author Hannu Niemist� - * - * @deprecated superceded by {@link TransferableGraph0} - */ -@Deprecated -public class OldTransferableGraph1 { - public static Binding BINDING = Bindings.getBindingUnchecked(OldTransferableGraph1.class); - public static Serializer SERIALIZER = Bindings.getSerializerUnchecked(BINDING); - - public int resourceCount; - public Identity[] identities; - public int[] statements; - public OldValue1[] values; - public TreeMap extensions; - - public OldTransferableGraph1() {} - - public OldTransferableGraph1(int resourceCount, Identity[] identities, - int[] statements, OldValue1[] values) { - this(resourceCount, identities, statements, values, - new TreeMap()); - } - - public OldTransferableGraph1(int resourceCount, Identity[] identities, - int[] statements, OldValue1[] values, TreeMap extensions) { - this.resourceCount = resourceCount; - this.identities = identities; - this.statements = statements; - this.values = values; - this.extensions = extensions; - } - - public void print() { - System.out.println("Identities"); - for(Identity id : identities) { - System.out.print(" " + id.resource + " = "); - if(id.definition instanceof Root) { - Root def = (Root)id.definition; - System.out.println("ROOT(" + def.name + ")"); - } - else if(id.definition instanceof External) { - External def = (External)id.definition; - System.out.println("EXTERNAL(" + def.parent + ", " + def.name + ")"); - } - else if(id.definition instanceof Internal) { - Internal def = (Internal)id.definition; - System.out.println("INTERNAL(" + def.parent + ", " + def.name + ")"); - } - } - System.out.println("Statements:"); - for(int i=0;i inputFiles = new ArrayList(); - List outputFiles = new ArrayList(); - String ext = ".aprosSymbol"; - File outDir = new File(dir,"out"); - if (!outDir.exists()) - outDir.mkdir(); - for (File f: allFiles) { - if (!f.isFile()) - continue; - if (!f.getName().endsWith(ext)) - continue; - inputFiles.add(f); - String outputName = f.getName(); - outputFiles.add(new File(outDir,outputName)); - } - - File mappingSpec = new File(dir, "mappingSpec.txt"); - for (int i = 0; i < inputFiles.size() ; i++) { - - File input = inputFiles.get(i); - File output = outputFiles.get(i); - - System.out.println(input + " -> " + output); - - RefactoringTool.refactor(mappingSpec, input, output); - } - } - -} diff --git a/bundles/org.simantics.graph/tests/org/simantics/graph/tests/refactoring/mappingSpec.txt b/bundles/org.simantics.graph/tests/org/simantics/graph/tests/refactoring/mappingSpec.txt deleted file mode 100644 index d85d332c2..000000000 --- a/bundles/org.simantics.graph/tests/org/simantics/graph/tests/refactoring/mappingSpec.txt +++ /dev/null @@ -1,6 +0,0 @@ -http://www.apros.fi/AprosStatic-6.0 http://www.apros.fi/Combustion/Configuration-6.0 -http://www.apros.fi/AprosDiagram-6.0/Terminals http://www.apros.fi/Apros-6.1/Terminals -http://www.apros.fi/AprosDiagram-6.0/Relations http://www.apros.fi/Combustion/Diagram-6.0/Relations -http://www.apros.fi/AprosDiagram-6.0/Symbols http://www.apros.fi/Combustion/Diagram-6.0/Symbols -http://www.apros.fi/AprosDiagram-6.0/AnalogSignalOutputRelation http://www.apros.fi/Combustion/Diagram-6.0/AnalogSignalOutputRelation -http://www.apros.fi/AprosDiagram-6.0/BinarySignalOutputRelation http://www.apros.fi/Combustion/Diagram-6.0/BinarySignalOutputRelation \ No newline at end of file diff --git a/bundles/org.simantics.graph/tests/org/simantics/graph/tests/refactoring/xor5.aprosSymbol b/bundles/org.simantics.graph/tests/org/simantics/graph/tests/refactoring/xor5.aprosSymbol deleted file mode 100644 index d005eb22c255d128c4943959bdff19279dd75716..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 26902 zcmd6wd7Md`6?JiYw?04B!|T5Jn`LI5tDi(9lee-7~;|QH%@j z8a0ahf)R}(#wen3!5xkJg17`1-1mJqzTfZMb8gqYm`~>AlRwgV<*jd>Q>RXyI#u^} zPt&i|E4+$(=2H1=N3JO~Cfm{4o}i>6Ju}tXo^DU4@@3>w{zqSlGSd%KXQrCdtx(Oj zb~hDVi;AXXv+a?7MXkxXsS@fGwRg4!wX(4b+EcmKWG13n(w59&e6e5XRW_-OqXfFe zWp%BEp2ZdU_GEi%E;X!@in!$-_&Z*SXc$dLK-=MT=O=Oz)fru^V+u4Ty7_FP9(dq*yr88mG0&>>^8 zbKA15@UH<=NB_O0|A>FLzdzgm0k4u^c+d0az;%Ci-%b2LYlfmZ6%&%3soYRH1DwmY zOi69FV@3w<_^rYfb*+eFYg1}cGupC&4knUrZ2`9lcMtm1sP+oMp*QS##x#ZkI!v_yTV>=u3{q{@d$7EYuQ%zjj$=P&kJDNKv zYcH*9otMhx>E1jxWJ;l2j~qgMzBH7O#McF4tp^m`fjgzOXI-IDlozsjb`QoX*_O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