Hello Naaman,
Adding a custom feature to your documents is actually not a simple task to do,
especially if you are trying to populate the documents using out populator
tool.
1) If you are using the Java API to annotate and store documents into the KIM
server, the procedure is as follows:
- update the com.ontotext.kim.KIMConstants.DOCUMENT_FEAT_LIST property in
kim-home/config/document.repository.properties configuration file, adding the
name of your custom property to the list of properties
- start the KIM server
- you have to use the following (or similar) code to annotate, add the custom
property value and store the document into the server:
// retrieve all necessary server APIs
KIMService service = GetService.from("localhost", 1099);
DocumentRepositoryAPI dr = service.getDocumentRepositoryAPI();
SemanticAnnotationAPI sa = service.getSemanticAnnotationAPI();
CorporaAPI ca = service.getCorporaAPI();
// use corpora API to retrieve object of KIMDocument type
// by invoking the most suitable method
KIMDocument doc = ca.createDocument(new URL("someurl"), "UTF-8");
// semantically annotate the content of the document
// read carefully the javadoc to understand what is happening
doc = sa.execute(doc);
// add your feature to the document
// the features can be of any type
// String is recommended
Object myFeatureValue = ...;
doc.putFeature("MYFEATURE", myFeatureValue);
// store the document
dr.addDocument(doc);
For more detail on using KIM server APIs check our documentation at
http://ontotext.com/kim/doc/KimDocs-3.0-EN/DevelopersGuide.html and
http://nmwiki.ontotext.com/kim-javadoc/index.html
2) If you are using our populator tool, all this gets much more complex. As
long as all things that the code above does happen in the populator tool JVM,
you can't modify any object there. In order to be able to set your custom
property, you have to add another step to the annotation process. That
process is controlled by a special file:
kim-home/context/default/resources/IE.gapp (by default!).
This is the description of our GATE application; in short, GATE is a platform
for text analysis and similar stuff, developed by our colleagues at the
University of Sheffield. See http://gate.ac.uk for more info. If you are not
familiar with GATE, I'm afraid it will be much harder to achieve your goal.
With a few words - you have to add a new GATE processing resource to the GATE
application. That processing resource would actually do the job of setting
your custom property to the document. If you need more information, you can
always ask us, but it is really recommended that you know how to do things
with GATE.
Hope this helps!
Regards,
Boyan Kukushev,
KIM Platform developer, KIM team
On Thu November 25 2010 16:48:30 Naaman Musawwir wrote:
> Attached is the properties file.
>
>
>
> Regards,
>
> Naaman Musawwir.
>
> _____
>
> From: Philip Alexiev @ Ontotext [mailto:[email protected]]
> Sent: Thursday, November 25, 2010 7:07 PM
> To: Naaman Musawwir
> Cc: [email protected]
> Subject: Re: [Kim-discussion] Help - Document Feature Schema
>
>
>
> Hi Naaman
>
>
>
> Adding your custom feature to the list is sufficient. Please send your
> document.repository.properties if you still have problems with that.
>
>
>
> Greetings,
>
> Philip Alexiev
>
> Software Engineer, KIM Team
>
>
>
> On Nov 25, 2010, at 9:57 AM, Naaman Musawwir wrote:
>
>
>
>
>
> Hello,
>
>
>
> I want to add a few custom features to KIM documents. How should I do that?
> I updated the propertycom.ontotext.kim.KIMConstants.DOCUMENT_FEAT_LIST in
> <KIM_HOME>conf/document.repository.properties but even after that I get the
> error that
>
>
>
> Features [CUSTOM_FEATURE] are not in the feature schema. Feature schema is
> currently: [SUBJECT, AUTHORS, SOURCE, LANGUAGE, DOCTYPE, KEYENTITIES,
> KEYPHRASES, TIMESTAMP, URL, TITLE]
>
>
>
> What to do more in this regard?
>
>
>
> Regards,
>
> Naaman Musawwir.
>
>
>
> _______________________________________________
> Kim-discussion mailing list
> [email protected]
> http://ontotext.com/mailman/listinfo/kim-discussion
>
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.872 / Virus Database: 271.1.1/3277 - Release Date: 11/25/10
> 00:34:00
>
>
>
--
Boyan Kukushev
Senior Software Engineer / Java Developer
Ontotext AD @ Sirma Group Corp.
_______________________________________________
Kim-discussion mailing list
[email protected]
http://ontotext.com/mailman/listinfo/kim-discussion