From: luukkainen Date: Wed, 23 Feb 2011 14:07:39 +0000 (+0000) Subject: Changing L0.ConsistsOf to Interop.HasImportData X-Git-Tag: v1.31.0~128 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=82d9794e76d4d3c91d814b7935f24d20fa6e915c;p=simantics%2Finterop.git Changing L0.ConsistsOf to Interop.HasImportData git-svn-id: https://www.simantics.org/svn/simantics/interoperability/trunk@19824 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.interop/graph.tg b/org.simantics.interop/graph.tg index e136802..537da89 100644 Binary files a/org.simantics.interop/graph.tg and b/org.simantics.interop/graph.tg differ diff --git a/org.simantics.interop/graph/Interop.pgraph b/org.simantics.interop/graph/Interop.pgraph index 4a6fc85..ae2fd71 100644 --- a/org.simantics.interop/graph/Interop.pgraph +++ b/org.simantics.interop/graph/Interop.pgraph @@ -6,6 +6,8 @@ INTEROP = : L0.Ontology L0.HasResourceClass "org.simantics.interop.stubs.InteropResource" @L0.new +INTEROP.HasImportData getChildren(ReadGraph graph) throws DatabaseException { List nodes = new ArrayList(); - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); InteropResource i = InteropResource.getInstance(graph); // Collection models = graph.getObjects(project, b.ConsistsOf); // for (Resource m : models) { @@ -85,7 +86,8 @@ public class ImportNode implements INode { // } // } // } - Collection objs = graph.getObjects(model, b.ConsistsOf); + //Collection objs = graph.getObjects(model, b.ConsistsOf); + Collection objs = graph.getObjects(model, i.HasImportData); for (Resource o : objs) { if (graph.isInstanceOf(o, i.ImportLibrary)) { INode node = graph.adapt(o, INode.class); diff --git a/org.simantics.interop/src/org/simantics/interop/browsing/ImportNode2.java b/org.simantics.interop/src/org/simantics/interop/browsing/ImportNode2.java index 38fb562..d4122cc 100644 --- a/org.simantics.interop/src/org/simantics/interop/browsing/ImportNode2.java +++ b/org.simantics.interop/src/org/simantics/interop/browsing/ImportNode2.java @@ -15,6 +15,7 @@ import org.simantics.db.WriteGraph; import org.simantics.db.exception.DatabaseException; import org.simantics.interop.Activator; import org.simantics.interop.stubs.InteropResource; +import org.simantics.layer0.Layer0; import org.simantics.modeling.ui.modelBrowser.model.INode; public class ImportNode2 implements INode { @@ -72,7 +73,7 @@ public class ImportNode2 implements INode { @Override public Collection getChildren(ReadGraph graph) throws DatabaseException { List nodes = new ArrayList(); - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); InteropResource i = InteropResource.getInstance(graph); // Collection models = graph.getObjects(project, b.ConsistsOf); // for (Resource m : models) { @@ -84,7 +85,8 @@ public class ImportNode2 implements INode { // } // } // } - Collection objs = graph.getObjects(project, b.ConsistsOf); + //Collection objs = graph.getObjects(project, b.ConsistsOf); + Collection objs = graph.getObjects(project, i.HasImportData); for (Resource o : objs) { if (graph.isInstanceOf(o, i.ImportLibrary)) { INode node = graph.adapt(o, INode.class); diff --git a/org.simantics.interop/src/org/simantics/interop/stubs/InteropResource.java b/org.simantics.interop/src/org/simantics/interop/stubs/InteropResource.java index a2b7f14..de2e123 100644 --- a/org.simantics.interop/src/org/simantics/interop/stubs/InteropResource.java +++ b/org.simantics.interop/src/org/simantics/interop/stubs/InteropResource.java @@ -9,12 +9,16 @@ import org.simantics.db.exception.DatabaseException; public class InteropResource { public final Resource HasDestination; + public final Resource HasImportData; public final Resource HasSource; + public final Resource ImportDataOf; public final Resource ImportLibrary; public static class URIs { public static final String HasDestination = "http://www.simantics.org/Interop-1.0/HasDestination"; + public static final String HasImportData = "http://www.simantics.org/Interop-1.0/HasImportData"; public static final String HasSource = "http://www.simantics.org/Interop-1.0/HasSource"; + public static final String ImportDataOf = "http://www.simantics.org/Interop-1.0/ImportDataOf"; public static final String ImportLibrary = "http://www.simantics.org/Interop-1.0/ImportLibrary"; } @@ -29,7 +33,9 @@ public class InteropResource { public InteropResource(ReadGraph graph) { HasDestination = getResourceOrNull(graph, URIs.HasDestination); + HasImportData = getResourceOrNull(graph, URIs.HasImportData); HasSource = getResourceOrNull(graph, URIs.HasSource); + ImportDataOf = getResourceOrNull(graph, URIs.ImportDataOf); ImportLibrary = getResourceOrNull(graph, URIs.ImportLibrary); }