Hi Keith,

We released a new version with some changes, fixes and patches.
One of them is the problem with the SerialDatastore under Linux.
I hate to blame someone else but this bug isn't really ours,
I found it discussed but not solved in the GATE forums.
The problem is that under Windows an URL for a file should start
with the "file:/" prefix and under Linux for some reason with "file://" (2 slashes).
Anyway, I made a patch that questions the JVM envinronment about the
OS name - this is a rough patch but works. Try it now.

Then you should be able to load the storage with GATE. There are, however,
two more ways to have the corpus annotated in GATE:
1. Using the GATE_GUI, load the corpus, create a KIM Client PR
and process the corpus with it (slow on big corpora).
2. Use a sample code like the one attached to export your annotated
and stored (to Serial or Lucene storage) documents as GATE XMLs.
(may require lot of space if the storage is big)

As for the installator problem, I guess it still remains. It is probably
caused by some access permissions for the user you're installing KIM under
to create/modify files/folders in some location owned by another user.
It would be useful if you could send me some error log so I can see
what does the installator complain about.

Regards,
Ilian

----- Original Message ----- From: "Keith Suderman" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, August 02, 2006 20:35 PM
Subject: Re: [KIM-discussion] More on extending KIM


Hi Ilian,

At 03:52 AM 8/1/2006, Ilian Kitchukov wrote:

The only option I could offer you is to get
the JAR installer and try it instead of the dedicated MacOSX one.

I did try the JAR installer and it failed in the same place with the
same error.  However, as I said, if I created the destination
directory manually before running the installer the installation
worked flawlessly.  I'll be installing KIM on another, identical, Mac
so I will be sure to save a copy of the stack trace for you this time.

We stopped developing the SerialDatasore and pushed on Lucene
some time ago, so we don't really encourage people to use Serial storage,

My only interest in using a SerialDatastore was I was hoping to load
the data store created by the Populate and Store tool into GATE.  Is
there some other way of doing this?

Cheers,
Keith


_______________________________________________
NOTE: Please REPLY TO ALL to ensure that your reply reaches all members of this mailing list.

KIM-discussion mailing list
[email protected]
http://ontotext.com/mailman/listinfo/kim-discussion_ontotext.com


__________ NOD32 1.1688 (20060802) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com


package com.ontotext.kim.howto;

import com.ontotext.kim.client.*;
import com.ontotext.kim.client.corpora.*;
import com.ontotext.kim.client.index.*;

import gate.util.*;

import java.net.*;
import java.util.*;
import java.io.*;

public class ExportDocumentsToXML {
  // replace "c:/kim-platform" in the strings below with your real KIM path
  // or assign INDEX_AND_PERSIST_URL a new value if your storage is in a custom folder
  public static final String INDEX_AND_PERSIST_URL = "lucene:/c:/kim-platform/context/default/populated/index-and-store";

  // put your XML export folder here
  public static final String XML_EXPORT_FOLDER = "f:/temp";
  // it is a good idea files to be distributes in some directory structure (e.g. by date)
  // if the storage being exported is too large
  // you can do this while generating the file path and name

  // internal component variables
  private static CorporaAPI apiCorpora = null;
  private static IndexAndPersistAPI apiIndexAndPersist = null;

  public ExportDocumentsToXML() {
  }

  public static void main(String[] args) {
    try{
        // ----------------------------------------------------------------------------------
        // connect to KIMService (deployed on specific host and port)
        KIMService serviceKim = GetService.from("localhost", 1099);
        spit("KIM Server connected.");
        // obtain CorporaAPI and IndexAndPersistAPI components
        apiCorpora = serviceKim.getCorporaAPI();
        apiIndexAndPersist = serviceKim.getIndexAndPersistAPI(INDEX_AND_PERSIST_URL);
        spit("CorporaAPI and IndexAndPersistAPI obtained successfully.");
        // make sure a new index is created if none exists
        try{
          apiIndexAndPersist.createIndex();
          spit("Index created in folder: " + INDEX_AND_PERSIST_URL);
        }
        catch(Exception ex){
        }
        // ----------------------------------------------------------------------------------

        spit("All documents in store: " + apiIndexAndPersist.getDocumentCount(null));
        spit("LastPersistenceID=" + apiIndexAndPersist.getLastPersistenceID());

        // NOTE: this takes the current value of the DB_STORE_LIMITED_DOC option
        // and will not help if you have stored documents during different runs
        // with this option having different values => i.e. have mixed type documents
        boolean isLimited = apiIndexAndPersist.isLimitedDocument();
        int lastPersistenceID = Integer.parseInt(apiIndexAndPersist.getLastPersistenceID().toString());
        for(int i=1; i<lastPersistenceID+1; i++){
          String fileTitle = "";
          String fileXML = "";
          boolean nonExistent = true;
          // if you're sure which is your type of document
          // you may use one of the following sections hardcoded
          if(isLimited){ // for KIMLimitedDocument
            KIMLimitedDocument kdoc = apiIndexAndPersist.loadLimitedDoc(String.valueOf(i));
            if(kdoc!=null){
              fileTitle = kdoc.getFeatures().get("TITLE").toString();
              fileXML = kdoc.toXML();
              nonExistent = false;
            }
          }else{ // for KIMDocument
            KIMDocument kdoc = apiIndexAndPersist.loadDoc(String.valueOf(i));
            if(kdoc!=null){
              fileTitle = kdoc.getFeatures().get("TITLE").toString();
              fileXML = kdoc.toXML();
              nonExistent = false;
            }
          }

          // XML export
          if(!nonExistent){
            // make sure file names are unique so as NOT to ovewrite each other
            // if needed use combination of features rather than just the title
            String fileName = XML_EXPORT_FOLDER + "/" + fileTitle + ".xml";
            FileWriter writer = new FileWriter(new File(fileName), true);
            writer.write(fileXML);
            writer.close();
          }else{
            spit("Document with ID=" + i + " does not exist!");
          }
        }
      }
      catch (Exception x) {
        x.printStackTrace();
      }
    }

  public static void spit(Object o){
    System.out.println(o);
  }
}
_______________________________________________
NOTE: Please REPLY TO ALL to ensure that your reply reaches all members of this 
mailing list.

KIM-discussion mailing list
[email protected]
http://ontotext.com/mailman/listinfo/kim-discussion_ontotext.com

Reply via email to