Hi Zoran,
For the first question I'll need some time to check and test things.
This is an idea for solving your second question.
In general there are many solutions and the most suitable depends on the way
you will later search and retrieve the documents.
My proposal is relatively simple and could help in variety of situations.
Here are the steps:
1) Create the KIM document through "CorporaAPI" method:
KIMDocument createDocument(URL url, String encoding);
providing the page URL. Execute:
KIMDocument doc =
createDocument("http://my.web.pages/lecture_1.html","UTF-8");
2) Retrieve the text of the title of the resulting document like this:
String doc_title =
doc.getFeatures().get(KIMDocument.DOCUMENT_FEATURE_TITLE)
3) Annotate separately the text of the title through the
"SemanticAnnotationAPI" method:
KIMAnnotationSet title_ann = SemanticAnnotationAPI.execute(doc_title);
4) Browse the resulting annotations to find if an annotation of "design
pattern" type was found.
If fortunately there is a "design pattern" mentioned in the title retrieve
its URI like this:
String titleDesignPatternURI = '';
for (int i = 0; i < title_ann.size(); i++)
if ( "THE_URI_OF_DESIGN_PATTERNS_CLASS".equals(
( (KIMAnnotation) title_ann.get(i)
).getFeatures().get("CLASS")
)
)
titleDesignPatternURI = ( (KIMAnnotation) title_ann.get(i)
).getFeatures().get("INST");
5) Store the retrieved URI in any of the text features of the document you do
not intend to use:
KIMFeatureMap doc_features = doc.getFeatures();
doc_features.set(KIMDocument.DOCUMENT_FEATURE_SUBJECT,
titleDesignPatternURI);
doc.setFeatures(doc_features);
6) Then you store the patched document in the document repository of KIM
This way you'll have the URI of the focus design pattern of the document stored
as a document feature.
Here is an usage scenario:
1) The user picks an "design pattern" of interest.
2) You find its URI identifier
3) You search for documents containing entity with such URI
4) In the returned documents you check the SUBJECT feature if it equals the
design pattern's URI.
That way you find which of the documents are really focused on that "design
pattern"
As a result you will have a set of related to this "design pattern" documents
and you can point which of them are focused on it.
Hope that it is helpful and understandable too.
Greetings!
DanKo
senior developer, KIM
----- Original Message -----
From: Zoran Jeremic
To: [email protected] ; DanKo
Sent: Tuesday, September 16, 2008 2:13 PM
Subject: Re: [KIM-discussion] change recognized entity in content
Hi Danko,
Please find attached all ontologies that I use, as well as
knowledge-base. In this case I have used class GoF_Form defined in GoFForm.owl.
Among other instances I have, for example, created AbstractFactory with alias
labeled as "Abstract Factory". This instance is found when I annotate documents
or web pages, but I want to annotate "Abstract factory", "abstract factory" and
"abstract Factory" as well as "Abstract Factory".
I have one more question for you. Sorry, for so much questions.
My application (Java RMI client uses KIM server) annotates web pages
that describes design patterns. These pages usually describes only one design
pattern, but could contain instances of other patterns as well, that are
related patterns, or just a references to other patterns. My idea is to check
if some instance is found in the page title ( between <title>...</title> tags).
This could indicate that this web page describes some specific design pattern,
so my application could suggest students to use this web page as relevant for
some design pattern. Do you have any suggestions about how to solve this.
Thank you for your patience,
Zoran
--- On Tue, 9/16/08, DanKo <[EMAIL PROTECTED]> wrote:
From: DanKo <[EMAIL PROTECTED]>
Subject: Re: [KIM-discussion] change recognized entity in content
To: [EMAIL PROTECTED], [email protected]
Date: Tuesday, September 16, 2008, 3:38 AM
Hi Zoran,
Please send me a copy of your extention to the ontology and the
knowledge-base with the instances you want to be recognised later
Greetings,
DanKo
----- Original Message -----
From: Zoran Jeremic
To: [email protected] ; DanKo
Sent: Thursday, September 11, 2008 8:24 PM
Subject: Re: [KIM-discussion] change recognized entity in content
Hi Danko,
Thank you for your answer.
> The one resource which case sensitivity could be
manipulated is the Gazeteer.
> Use the parameter:
>
com.ontotext.kim.KIMConstants.ENTITY_CASE_TYPE=caseinsensitive
> in file:
> <KIM_HOME>\config\install.properties
I have tried this, but in this case I don't get any
annotation. Actually, I'm not sure what Gazeteer is. I remmember that I have
read about it from your documents, but I can't find that document now, and I
don't know if it concern my case. In my application I have extended proton's
Topic class with several class from my domain ontology, and all I use to
annotate the content are instances of these classes.
Zoran
--- On Wed, 9/10/08, DanKo <[EMAIL PROTECTED]> wrote:
From: DanKo <[EMAIL PROTECTED]>
Subject: Re: [KIM-discussion] change recognized entity in
content
To: [EMAIL PROTECTED], [email protected]
Date: Wednesday, September 10, 2008, 4:17 AM
Hi Zoran,
This mail slipped my attention besides your other troubles
:)
Here are my comments on your questions:
1) The annotation process is multistaged and complex so the
case sensitivity cant be manipulated as a whole.
For example the JAPE rules largely rely on detection of
Title case words for name recognition.
The one resource which case sensitivity could be
manipulated is the Gazeteer.
Use the parameter:
com.ontotext.kim.KIMConstants.ENTITY_CASE_TYPE=caseinsensitive
in file:
<KIM_HOME>\config\install.properties
2) To make your tag insertion the most easy way is to use
the "KIMDocument" structure.
You can put in it the text for annotation, then use the
method:
public KIMDocument execute(KIMDocument doc2)
Then the returned document contains the plain text and
the corresponding annotations in structured form ("KIMAnnotationSet")
Then you will:
- cycle through the annotations
- pick the text offsets and types
- form the replacement tagged fragment
- replace the coresponding piece of the document body
It is not a very detailed description, so if you find
anything vague, please ask me back.
Greetings!
DanKo
senior developer, KIM
----- Original Message -----
From: Zoran Jeremic
To: [email protected]
Sent: Saturday, September 06, 2008 6:13 PM
Subject: [KIM-discussion] change recognized entity in
content
Hi,
I have two questions about using KIM :
1) How can I set KIM annotation not to be case
sensitive?
2) I want to annotate the content that is stored in
the database and used as the web page content (i.e. discussion forum
threads...), to recognize the entities, and change those recognized entities
(i.e. Abstract factory) to the hiperlinks like: "<a title="View suggestions"
href="/depths/services/online_resources/view_suggestions.php"
onclick="this.target='message_3';return
openpopup('/depths/services/online_resources/view_suggestions.php',
'message_3',
'menubar=0,location=0,scrollbars,status,resizable,width=800,height=600',
0);">Abstract factory</a>", and then to put this content back in the database.
I know it is possible to get event from KIM that
some entity is recognized and then using Java to process String and find that
entity again and change it, but it would be better if I don't have to traverse
the content twice. Do you have some idea how to use KIM for this?
Thanks,
Zoran
----------------------------------------------------------
_______________________________________________
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 3421 (20080906) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.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