Hi Danica,
As Boby said you're doing everithing right. Unfortunately, there is a bug at
our side - when storing documents with SerialDatastore some annotations are
skipped. I am going to review that part of the code and there will be a fix
soon. I understand you want to view your documents within GATE and that's
why you use SerialDatastore. I can propose to you 2 more ways to annotate
your docs and see them in GATE.
1. use the KIM Client PR directly within GATE, load and annotate documents
2. use the KIM Annotation Tool with the default Lucene storage and export
the documents to GATE XMLs with a tool like the one attached, then you can
load them in GATE with annotations included in
If you're running KIM WebUI there's still another way to see that everithing
is OK with annotation - annotate the document in the IExpolrer using the
KIM-plugin connected to your local server - and "Winky Pop" will get
recognized and highlighted.
So, sorry again for this misleading storage problem, we'll note you back
when it is fixed.
Regards,
Ilian
----- Original Message -----
From: "Danica Damljanovic" <[EMAIL PROTECTED]>
To: "Danica Damljanovic" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Wednesday, August 09, 2006 15:04 PM
Subject: [KIM-discussion] Extending kim knowledge base
Dear KIM team,
I wanted to extend KIM so to be able to annotate some of my concepts. I
tried to follow your document about extending KIM.
Lets say, I want KIM to annotate my "Winki Pop" beach. You probably
remember my beach from earlier :)
Ok, so proton ontology has a Beach class, so I don't need to extend
ontology. Then, I understand that KIM should work fine if the instance
is in its kb. I made a file called extended_wkb.nt and put these lines
in there:
<http://www.ontotext.com/kim/2005/04/wkb#Beach_T.2>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://proton.semanticweb.org/2005/04/protonu#Beach> .
<http://www.ontotext.com/kim/2005/04/wkb#Beach_T.2>
<http://www.w3.org/2000/01/rdf-schema#label> "Winki Pop" .
<http://www.ontotext.com/kim/2005/04/wkb#Beach_T.2.1>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://proton.semanticweb.org/2005/04/protons#Alias> .
<http://www.ontotext.com/kim/2005/04/wkb#Beach_T.2.1>
<http://www.w3.org/2000/01/rdf-schema#label> "Winki Pop" .
<http://www.ontotext.com/kim/2005/04/wkb#Beach_T.2>
<http://proton.semanticweb.org/2005/04/protons#hasAlias>
<http://www.ontotext.com/kim/2005/04/wkb#Beach_T.2.1> .
<http://www.ontotext.com/kim/2005/04/wkb#Beach_T.2>
<http://proton.semanticweb.org/2005/04/protons#hasMainAlias>
<http://www.ontotext.com/kim/2005/04/wkb#Beach_T.2.1> .
<http://www.ontotext.com/kim/2005/04/wkb#Beach_T.2>
<http://proton.semanticweb.org/2005/04/protont#locatedIn>
<http://www.ontotext.com/kim/2005/04/wkb#Country_T.AS> .
<http://www.ontotext.com/kim/2005/04/wkb#Beach_T.2>
<http://proton.semanticweb.org/2005/04/protons#generatedBy>
<http://www.ontotext.com/kim/2005/04/wkb#Gazetteer> .
I changed the sesame.inmem.conf file so to add new value for "imports"
and also for "defaultNS" so that my extend_wkb.nt will be loaded in
KIM's kb.
I started Sesame and KIM and it looks like everything is fine (At least
it says that kb/extend_wkb.nt is loaded).
I made a corpus where I have document with a sentence: "Nearby beaches
include 'Southside', 'Centreside', 'Rincon', Winki Pop, 'Lowers' and
'Lower Lowers'."
I started KIM Annotation Tool and make it save annotations in data store.
I opened this data store from GATE and look at the Annotation Sets.
There is Persistant Annotation Set with only Location, Organization and
Person in there.
Since there is no "Beach" in the Persist annotation set, I expect that
"Winki Pop" should be annotated at least as a Location (since Beach is
subclass of Location), but it is not.
Am I right?
Is there a way to make KIM aware of my Beach (pre-populated) without
writing new IE module?
Best regards,
Danica
Danica Damljanovic wrote:
Thank you very much!
I tried to load Kim Client PR and it does exactly what I wanted.
Best regards,
Danica
borislav popov wrote:
Dear Danica,
the IE.gapp has not been intended for direct loading into GATE. The
way it is expected to be used is by loading one of the KIM Client PRs
available for GATE. These are thin clients that deal with the
communication with an already started KIM Server.
The reason for this, as it is seen from the log you've sent is: KIM
needs other external resources, like the semantic repository. The
connection to these resources is not initialized in the IE application
itself, but during the startup of the server.
Please check if the KIM Client is fine for you or you really need
loading the IE gapp and let us know
have a good day
borislav
Danica Damljanovic wrote:
Dear KIM Team,
I started KIM GATE GUI and tried to restore application from file
where I choose IE.gapp file from
KIM_INSTALL_DIR\context\default\resources dir.
Each time I get the same exception:
gate.persist.PersistenceException: java.lang.NullPointerException
at
gate.util.persistence.PersistenceManager.loadObjectFromUrl(PersistenceManager.java:629)
at
gate.util.persistence.PersistenceManager.loadObjectFromFile(PersistenceManager.java:525)
at gate.gui.MainFrame$29.run(MainFrame.java:2162)
at java.lang.Thread.run(Thread.java:534)
Caused by:
java.lang.NullPointerException
at
com.ontotext.kim.client.GetService.getSemanticRepositoryAPI(GetService.java:139)
at com.ontotext.kim.gate.KimGazetteer.init(KimGazetteer.java:121)
at gate.Factory.createResource(Factory.java:302)
at
gate.util.persistence.ResourcePersistence.createObject(ResourcePersistence.java:82)
at
gate.util.persistence.PRPersistence.createObject(PRPersistence.java:75)
at
gate.util.persistence.LanguageAnalyserPersistence.createObject(LanguageAnalyserPersistence.java:50)
at
gate.util.persistence.PersistenceManager.getTransientRepresentation(PersistenceManager.java:240)
at
gate.util.persistence.CollectionPersistence.createObject(CollectionPersistence.java:68)
at
gate.util.persistence.PersistenceManager.getTransientRepresentation(PersistenceManager.java:240)
at
gate.util.persistence.ControllerPersistence.createObject(ControllerPersistence.java:57)
at
gate.util.persistence.ConditionalControllerPersistence.createObject(ConditionalControllerPersistence.java:44)
at
gate.util.persistence.PersistenceManager.getTransientRepresentation(PersistenceManager.java:240)
at
gate.util.persistence.PersistenceManager.loadObjectFromUrl(PersistenceManager.java:609)
at
gate.util.persistence.PersistenceManager.loadObjectFromFile(PersistenceManager.java:525)
at gate.gui.MainFrame$29.run(MainFrame.java:2162)
at java.lang.Thread.run(Thread.java:534)
Did I missed something here?
Best regards,
Danica Damljanovic
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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.1698 (20060808) 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