+ }
+ }
+
+ private static Path replaceExtension(Path p, String newExtension) {
+ String newName = p.getFileName().toString();
+ int lastDot = newName.lastIndexOf('.');
+ if (lastDot > -1)
+ newName = newName.substring(0, lastDot);
+ return p.resolveSibling(newName + newExtension);
+ }
+
+ private static void createTg(Path input, Path output) throws Exception {
+ convertExportedSharedOntologyIntoBundleOntology(input, output);
+ }
+
+ public static void createTg(Path input) throws Exception {
+ createTg(input, replaceExtension(input, ".tg"));
+ }
+
+ public static void createTGAndPGraph(Path input) throws Exception {
+ createTGAndPGraph(input, true);
+ }
+
+ public static void createTGAndPGraph(Path input, boolean writePGraph) throws Exception {
+ TransferableGraph1 tg = convertExportedSharedOntologyIntoBundleOntology(input, replaceExtension(input, ".tg"));
+ if (writePGraph) {
+ String listing = PrettyPrintTG.print(tg, false);
+ Files.write(replaceExtension(input, ".pgraph"), listing.getBytes(),StandardOpenOption.CREATE);