package jena; import java.util.Scanner; public class Menu { public static void main(String[] args) { displayMenu(); handleUserInput (); } private static void displayMenu () { System.out.println(""); System.out.println("Menu: "); System.out.println(""); System.out.println("1. Import data from …ppna bibliotek "); System.out.println("2. Read data from default file "); System.out.println("3. Consolidate xISBN to add other editions of each work"); System.out.println("4. Link your resources to openlibrary.org's resources "); System.out.println("0. Quit"); System.out.println(""); } private static void handleUserInput () { RDFGenerator rdfGeneratorObject = null; Scanner in = new Scanner(System.in); boolean quit = false; int choice; do { System.out.print("Choose action: "); choice = in.nextInt(); try { switch (choice) { case 1: System.out.println("You've chosen to import data from …ppna bibliotek. "); System.out.println("Note that this may require an open SSH-tunell to the Biblab server. "); rdfGeneratorObject = new RDFGenerator("import"); displayMenu(); break; case 2: System.out.println("You've chosen to import data from the default file. "); rdfGeneratorObject = new RDFGenerator("file"); displayMenu(); break; case 3: System.out.println("You've chosen to consolidate the xISBN web service in order to add other editions of each work."); if (rdfGeneratorObject == null){ rdfGeneratorObject = new RDFGenerator("file"); } rdfGeneratorObject.addAlternateManifestationsOfEachExpression(); displayMenu(); break; case 4: System.out.println("You've chosen to consolidate Talis' SPARQL-endpoint for openlibrary.org in order to link your resources to theirs."); if (rdfGeneratorObject == null){ rdfGeneratorObject = new RDFGenerator("file"); } System.out.println("This process may take a while..."); rdfGeneratorObject.identifyEquivalentResourcesInExternalGraph(); displayMenu(); break; case 0: quit = true; break; default: System.out.println("Invalid choice. Please try again."); displayMenu(); } } catch (Exception e) { e.printStackTrace(); } } while (!quit); System.out.println("Quitting... Welcome back!"); } }