Revision: 14588
          http://gate.svn.sourceforge.net/gate/?rev=14588&view=rev
Author:   valyt
Date:     2011-11-22 13:54:51 +0000 (Tue, 22 Nov 2011)
Log Message:
-----------
Simple interactive scratchpad (using the Groovy console).

Added Paths:
-----------
    mimir/trunk/mimir-test/src/gate/mimir/test/ScratchConsole.groovy

Added: mimir/trunk/mimir-test/src/gate/mimir/test/ScratchConsole.groovy
===================================================================
--- mimir/trunk/mimir-test/src/gate/mimir/test/ScratchConsole.groovy            
                (rev 0)
+++ mimir/trunk/mimir-test/src/gate/mimir/test/ScratchConsole.groovy    
2011-11-22 13:54:51 UTC (rev 14588)
@@ -0,0 +1,48 @@
+package gate.mimir.test;
+
+import java.io.File;
+import java.net.MalformedURLException;
+
+import gate.Gate;
+import gate.mimir.index.IndexException;
+import gate.mimir.search.QueryEngine;
+import gate.mimir.search.query.parser.QueryParser;
+import gate.util.GateException;
+import groovy.ui.Console;
+
+public class ScratchConsole {
+  /**
+   * @param args
+   * @throws GateException 
+   * @throws MalformedURLException 
+   * @throws IndexException 
+   */
+  public static void main(String[] args) throws MalformedURLException, 
+      GateException, IndexException {
+    // GATE, Mimir init
+    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());
+    // load the measurements plugin
+    Gate.getCreoleRegister().registerDirectories(
+      new File("../plugins/measurements").toURI().toURL());
+    QueryEngine qEngine = new QueryEngine(new File(args[0]));
+    // Prepare console
+    Console console = new Console();
+    console.setVariable("qEngine", qEngine);
+    console.setVariable("qParser", QueryParser.class);
+    console.run();
+//    console.getInputArea().setText(
+//      "import gate.mimir.search.*\n" +
+//      "import gate.mimir.search.score.*\n" +
+//      "def qNode = qParser.parse('{Measurement}')\n" +
+//      "def qExecutor = qNode.getQueryExecutor(qEngine)\n" +
+//      "def qRunner = new RankingQueryRunnerImpl(qExecutor, new 
BindingScorer())");    
+  }
+}


Property changes on: 
mimir/trunk/mimir-test/src/gate/mimir/test/ScratchConsole.groovy
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

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


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to