- @Override
- public DumpOntologyStructure perform(ReadGraph graph) throws DatabaseException {
- DumpOntologyStructure result = new DumpOntologyStructure();
- result.read(graph, info.library.getResource());
- return result;
- }
-
+ public static void doExport(IProgressMonitor monitor, File location, LibraryInfo info, boolean writeTg, boolean dumpStructure) throws DatabaseException, IOException {
+ int work = 1 + (writeTg ? 1 : 0) + (dumpStructure ? 1 : 0);
+ SubMonitor mon = SubMonitor.convert(monitor, work);
+
+ ModelingUtils.exportSharedOntology(mon.split(1, SubMonitor.SUPPRESS_NONE), Simantics.getSession(), location, Constants.SHARED_LIBRARY_FORMAT, Constants.SHARED_LIBRARY_CURRENT_VERSION, info);
+
+ Path input = location.toPath();
+
+ if (writeTg) {
+ try {
+ mon.subTask("Writing transferable graph");
+ FixExportedOntology.createTGAndPGraph(input, false);
+ mon.worked(1);
+ } catch (Exception e) {
+ LOGGER.error("Could not generate Transferable Graph", e);
+ }
+ }
+ if (dumpStructure) {
+ try {
+ monitor.subTask("Dumping library structure");
+ DumpOntologyStructure data = Simantics.getSession().syncRequest((ReadGraph graph) -> {
+ return new DumpOntologyStructure().read(graph, info.library.getResource());