final Collection<ISource> sources = new ArrayList<>();
Collection<TransferableGraph1> dependencies = new ArrayList<>();
- for (Bundle b : Activator.getContext().getBundles()) {
- URL tg = b.getEntry("/graph.tg");
- if (tg == null) continue;
- File f = url2file(FileLocator.resolve(tg), b.getSymbolicName());
- try {
- dependencies.add(GraphCompiler.read(f));
- } catch (Exception e) {
- throw new IOException("Failed to read compiled transferable graph as dependency: " + f, e);
- }
- }
-
- final TransferableGraph1 thisOntology = Simantics.sync(new UniqueRead<TransferableGraph1>() {
+ final Pair<String, TransferableGraph1> thisOntology = Simantics.sync(new UniqueRead<Pair<String, TransferableGraph1>>() {
@Override
- public TransferableGraph1 perform(ReadGraph graph) throws DatabaseException {
+ public Pair<String, TransferableGraph1> perform(ReadGraph graph) throws DatabaseException {
Layer0 L0 = Layer0.getInstance(graph);
Resource parent = graph.getSingleObject(r, L0.PartOf);
}
};
+ String uri = graph.getURI(r);
SimanticsClipboardImpl clipboard = new SimanticsClipboardImpl();
ch.copyToClipboard(graph, clipboard);
for (Set<Representation> object : clipboard.getContents()) {
TransferableGraph1 tg = ClipboardUtils.accept(graph, object, SimanticsKeys.KEY_TRANSFERABLE_GRAPH);
if (tg != null)
- return tg;
+ return Pair.make(uri, tg);
}
return null;
if (thisOntology == null)
throw new DatabaseException("Failed to dump the containing ontology of " + r + " into TransferableGraph1");
- dependencies.add(thisOntology);
+ dependencies.add(thisOntology.second);
+
+ for (Bundle b : Activator.getContext().getBundles()) {
+ String id = b.getSymbolicName();
+ String name = (String) b.getHeaders().get("Bundle-Name");
+ if (name == null) name = id;
+ if (name.equals(thisOntology.first))
+ continue;
+ URL tg = b.getEntry("/graph.tg");
+ if (tg == null) continue;
+ File f = url2file(FileLocator.resolve(tg), b.getSymbolicName());
+ try {
+ dependencies.add(GraphCompiler.read(f));
+ } catch (Exception e) {
+ throw new IOException("Failed to read compiled transferable graph as dependency: " + f, e);
+ }
+ }
+
Simantics.sync(new ReadRequest() {
@Override