void addMissing(int handleIndex, String external) {
allMissingExternals.put(external, handleIndex);
Set<String> removals = new HashSet<>();
- for(String ext : missingExternals) if(ext.startsWith(external)) return;
- for(String ext : missingExternals) if(external.startsWith(ext)) removals.add(ext);
+ 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);
}
TransientCacheAsyncListener.instance());
Resource child = childMap.get(def.name);
if(child == null) {
- addMissing(identity.resource, graph.getURI(parent) + "/" + def.name);
+ addMissing(identity.resource, graph.getURI(parent) + "/" + URIStringUtils.escape(def.name));
} else {
handles[identity.resource] = builder.handle(child);
}
} else {
- addMissing(identity.resource, TransferableGraphUtils.getURI(resourceCount, identityMap, def.parent) + "/" + def.name);
+ addMissing(identity.resource, TransferableGraphUtils.getURI(resourceCount, identityMap, def.parent) + "/" + URIStringUtils.escape(def.name));
}
}
}
}
else if(definition instanceof Internal) {
- String uri = TransferableGraphUtils.getTrueURI(resourceCount, identityMap, identity.resource);
+ String uri = TransferableGraphUtils.getURI(resourceCount, identityMap, identity.resource);
Resource existing = graph.getPossibleResource(uri);
if(existing != null) {
existingInternalMap.put(identity.resource, existing);
Resource nameResource = graph.newResource();
graph.claim(nameResource, InstanceOf, null, String);
- graph.claimValue(nameResource, parts[1], WriteBindings.STRING);
+ graph.claimValue(nameResource, URIStringUtils.unescape(parts[1]), WriteBindings.STRING);
graph.claim(childResource, HasName, NameOf, nameResource);
graph.claim(parent, ConsistsOf, PartOf, childResource);
if(definition instanceof External) {
External def = (External)definition;
if(def.parent == -1) return "http:/";
- else return getURI(resourceCount, identities, def.parent) + "/" + def.name;
+ else return getURI(resourceCount, identities, def.parent) + "/" + URIStringUtils.escape(def.name);
} else if(definition instanceof Root) {
Root def = (Root)definition;
if(def.name.isEmpty()) return "http:/";
return def.name;
} else if (definition instanceof Internal) {
Internal def = (Internal)definition;
- return getURI(resourceCount, identities, def.parent) + "/" + def.name;
- } else {
- return "";
- }
- }
- return "<internal reference " + id + ">:";
- }
-
- public static String getTrueURI(int resourceCount, TIntObjectMap<Identity> identities, int id) {
- Identity identity = identities.get(id);
- if(identity != null) {
- IdentityDefinition definition = identity.definition;
- if(definition instanceof External) {
- External def = (External)definition;
- if(def.parent == -1) return "http:/";
- else return getTrueURI(resourceCount, identities, def.parent) + "/" + URIStringUtils.escape(def.name);
- } else if(definition instanceof Root) {
- Root def = (Root)definition;
- if(def.name.isEmpty()) return "http:/";
- return def.name;
- } else if (definition instanceof Internal) {
- Internal def = (Internal)definition;
- return getTrueURI(resourceCount, identities, def.parent) + "/" + URIStringUtils.escape(def.name);
+ return getURI(resourceCount, identities, def.parent) + "/" + URIStringUtils.escape(def.name);
} else {
return "";
}
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.simantics.Simantics;
import org.simantics.databoard.binding.Binding;
-import org.simantics.databoard.binding.mutable.Variant;
import org.simantics.databoard.container.DataContainer;
import org.simantics.databoard.container.DataContainers;
import org.simantics.databoard.container.FormatHandler;
-import org.simantics.databoard.util.binary.BinaryFile;
+import org.simantics.databoard.util.URIStringUtils;
import org.simantics.db.Resource;
import org.simantics.db.Session;
import org.simantics.db.layer0.migration.MigratedImportResult;
import org.simantics.db.layer0.migration.MigrationStateKeys;
import org.simantics.db.layer0.migration.MigrationUtils;
import org.simantics.db.layer0.migration.ModelImportAdvisor;
-import org.simantics.db.layer0.util.DraftStatusBean;
import org.simantics.db.management.ISessionContext;
import org.simantics.graph.db.ImportResult;
import org.simantics.graph.db.MissingDependencyException;
if (result[0].hasMissingExternals()) {
InfoDialog.open(getShell(), "Missing Externals Created",
"The system was unable to find some of the external entities referenced by the imported material. Place-holders have been created for the missing entities.\nThe missing entities are:\n"
- + EString.implode(result[0].tgResult.missingExternals),
+ + URIStringUtils.unescape(EString.implode(result[0].tgResult.missingExternals)),
SWT.SHEET);
}
} catch (InvocationTargetException e) {
import org.simantics.databoard.container.DataContainer;
import org.simantics.databoard.container.DataContainers;
import org.simantics.databoard.container.FormatHandler;
+import org.simantics.databoard.util.URIStringUtils;
import org.simantics.db.Resource;
import org.simantics.db.Session;
import org.simantics.db.layer0.migration.MigratedImportResult;
if (result[0].hasMissingExternals()) {
InfoDialog.open(getShell(), "Missing Externals Created",
"The system was unable to find some of the external entities referenced by the imported material. Place-holders have been created for the missing entities.\nThe missing entities are:\n"
- + EString.implode(result[0].tgResult.missingExternals),
+ + URIStringUtils.unescape(EString.implode(result[0].tgResult.missingExternals)),
SWT.SHEET);
}
} catch (InvocationTargetException e) {