Revision: 17472
          http://sourceforge.net/p/gate/code/17472
Author:   valyt
Date:     2014-02-27 14:50:28 +0000 (Thu, 27 Feb 2014)
Log Message:
-----------
Scratch code

Modified Paths:
--------------
    mimir/branches/5.0/mimir-test/src/gate/mimir/test/Scratch.java

Modified: mimir/branches/5.0/mimir-test/src/gate/mimir/test/Scratch.java
===================================================================
--- mimir/branches/5.0/mimir-test/src/gate/mimir/test/Scratch.java      
2014-02-27 14:48:17 UTC (rev 17471)
+++ mimir/branches/5.0/mimir-test/src/gate/mimir/test/Scratch.java      
2014-02-27 14:50:28 UTC (rev 17472)
@@ -53,6 +53,7 @@
 import gate.mimir.index.AtomicIndex;
 import gate.mimir.index.AtomicTokenIndex;
 import gate.mimir.index.GATEDocument;
+import gate.mimir.index.IndexException;
 import gate.mimir.search.IndexReaderPool;
 import gate.mimir.search.QueryEngine;
 import gate.mimir.search.QueryEngine.IndexType;
@@ -76,23 +77,51 @@
 import gate.mimir.search.terms.TermsQuery;
 import gate.mimir.search.terms.TermsResultSet;
 import gate.mimir.tool.WebUtils;
+import gate.mimir.util.IndexUpgrader;
 import gate.mimir.util.MG4JTools;
 import gate.util.GateException;
 
 public class Scratch {
 
   public static void main (String[] args) throws Exception {
-    
+    mainIndexConvert(args);
 //    mainIndexer5(args);
     
 //     mainSimple(args);
     
-    mainDirectIndexes(args);
+//    mainDirectIndexes(args);
 //    mainBuildDirectIndex(args);
 //    mainQueryIndex(args);
 //    mainRemote(args);
   }
   
+  public static final void mainIndexConvert(String[] args) throws Exception {
+    Gate.setGateHome(new File("gate-home"));
+    Gate.setUserConfigFile(new File("gate-home/user-gate.xml"));
+    Gate.init();
+    // load the tokeniser plugin
+    Gate.getCreoleRegister().registerDirectories(
+      new File("gate-home/plugins/ANNIE-tokeniser").toURI().toURL());
+    // load the DB plugin
+    Gate.getCreoleRegister().registerDirectories(
+      new File("../plugins/db-h2").toURI().toURL());
+//    Gate.getCreoleRegister().registerDirectories(
+//      new File("../plugins/sesame").toURI().toURL());    
+    // load the measurements plugin
+    Gate.getCreoleRegister().registerDirectories(
+      new File("../plugins/measurements").toURI().toURL());
+    Gate.getCreoleRegister().registerDirectories(
+      new File("../plugins/sparql").toURI().toURL());
+    
+    if(args.length != 1) throw new RuntimeException(
+        "You need to provide a single commnad line parameter, which should "
+        + "be the path to a pre-5.0 Mímir index.");
+    File indexDir = new File(args[0]);
+    IndexUpgrader indexUpgrader =  new IndexUpgrader();
+    indexUpgrader.upgradeIndex(indexDir);
+  }
+  
+  
   /**
    * Interactive tool for querying a MG4J index (e.g. a Mímir sub-index, or a 
    * Mímir sub-index batch).

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to