- // Discover resources with URI
- for(Identity id : TransferableGraphUtils.getRoots(graph)) {
- String name = "ROOT";
- ResourceInfo info = new ResourceInfo(true, name, id.resource);
- infos.put(id.resource, info);
- for(Identity child : getChildren(graph, id)) {
- ResourceInfo childInfo = recurseURI(graph, child, name);
- childInfo.newResource = true;
+ prettyPrint(graph);
+ Files.write(output, this.output.toString().getBytes());
+
+ }
+
+ }
+
+ static Map<String,String> knownOntologies = new HashMap<>();
+
+ static {
+ knownOntologies.put("http://www.simantics.org/Layer0-1.1", "L0");
+ knownOntologies.put("http://www.simantics.org/Layer0X-1.1", "L0X");
+ knownOntologies.put("http://www.simantics.org/Modeling-1.2", "MOD");
+ knownOntologies.put("http://www.simantics.org/Diagram-2.2", "DIA");
+ knownOntologies.put("http://www.simantics.org/Structural-1.2", "STR");
+ knownOntologies.put("http://www.simantics.org/Document-1.2", "DOC");
+ knownOntologies.put("http://www.simantics.org/Documentation-1.2", "DOCU");
+ knownOntologies.put("http://www.simantics.org/G2D-1.1", "G2D");
+ knownOntologies.put("http://www.simantics.org/SelectionView-1.2", "SEL");
+ knownOntologies.put("http://www.simantics.org/Viewpoint-1.2", "VP");
+ knownOntologies.put("http://www.simantics.org/Image2-1.2", "IMAGE2");
+ knownOntologies.put("http://www.simantics.org/GraphFile-0.1", "GRAPHFILE");
+ knownOntologies.put("http://www.simantics.org/Project-1.2", "PROJECT");
+ knownOntologies.put("http://www.semantum.fi/Simupedia-1.0", "SIMUPEDIA");
+ knownOntologies.put("http://www.semantum.fi/SimupediaWorkbench-1.0", "SIMUPEDIA_WORKBENCH");
+ }
+
+
+ void prettyPrint(TransferableGraph1 graph) throws Exception {
+
+ for(Identity id : graph.identities) {
+ if(id.definition instanceof Internal) {
+ Internal internal = (Internal)id.definition;
+ Identity parent = TransferableGraphUtils.getIdentity(graph, internal.parent);
+ if(parent.definition instanceof External) {
+ String name = "BASE";
+ ResourceInfo info = new ResourceInfo(true, name, id.resource);
+ info.aliasURI = TransferableGraphUtils.getURI(graph, id.resource);
+ info.newResource = true;
+ infos.put(id.resource, info);
+ for(Identity child : getChildren(graph, id)) {
+ recurseURI(graph, child, name);
+ }