Hi Leandro,

Yes, you are missing something, but I just checked the sys-doc and it is 
never mentioned expilictly in the 'Extending the KIM Platform' section. So 
it is our fault you are not aware of it. Namely, I'm speaking about KIM's 
entity caching mechanism that is meant for faster loading, but obviously is 
an obstacle for all of you that want to extend the ontology.

Loading trusted and recognized entities from the semantic repository every 
time KIM starts is slow, so on its first load it caches the trusted entities 
(assuming they don't change as such) and on every shutdown caches the 
recognized entities for the run. Respectively, when loading if these files 
exist KIM doesn't bother loading entities from the repository but loads them 
from these files instead.

What I mean is that if you've started KIM even once prior to extending the 
ontology and the knowledge base you have these files cached and no matter 
that you've made extensions after that they are just not taken into account. 
Now, to start everithing from clear refer this pages:
http://www.ontotext.com/kim/doc/sys-doc/faq-howto-bugs/howto-procedures.html#q2
http://www.ontotext.com/kim/doc/sys-doc/kim-platform-administration/configure-kim-context-folder.html
or the equivalent ones from your local sys-doc. When done with this starting 
KIM will cause loading all the entities from the semantic repository and 
they should then become recognized when met in documents.

So, bear in mind to clear the contents of the %KIM_CONTEXT%/populated/cache 
folder every time you change the ontology or the KB (add/remove/update 
trusted entities) as they are by default considered static. Also if you want 
to use KIM WebUI, viewing the changes in the ontology on the "Browse 
Ontology" page must be preceeded by deleting of the file 
%TOMCAT%/webapps/KIM/screen/script.inc, which caches in the same way the 
ontology tree for viewing in the WebUI as not to retrieve it every time. 
After deleting it and refreshing the page you'll be able to see your newly 
defined subclasses.

Another thing I noticed in the 'vbe.nt' file you sent is a paragraph atached 
by a mail checking system. I hope the real file you use does not end with 
this NOD32 message :)

I'm sorry if I was too explanatory,
HTH,
Ilian

----- Original Message ----- 
From: "Leandro Loss" <[EMAIL PROTECTED]>
To: "borislav popov" <[EMAIL PROTECTED]>; <[email protected]>
Cc: "Rui Jorge Tramontin Junior" <[EMAIL PROTECTED]>
Sent: 24 August 2006, Thursday 20:29
Subject: Re: [KIM-discussion] Extending KIM Knowledge Base 2 (help!)


>
> Dear Borislav,
> Dear all,
>
> Thank you for your help. I already included lines related to the trusted 
> entities in my file "vbe.nt", however it still does not work. Maybe I am 
> missing something...
>
> My steps are:
> 1 - To edit the file HOME_KIM/config/sesame.inmem.conf in order to include 
> the vbe.owl and vbe.nt
> 2 - Start TomCat
> 3 - Start KIM - KIM is loading correctly the files... (see below)
>
> NUMBER_OF_INDICES=4000000
> _addThisOntology: kb/owl/owl.rdfs
> _addThisOntology: kb/owl/protons.owl
> _addThisOntology: kb/owl/protont.owl
> _addThisOntology: kb/owl/protonu.owl
> _addThisOntology: kb/owl/protonkm.owl
> _addThisOntology: kb/owl/kimso.owl
> _addThisOntology: kb/owl/kimlo.owl
> _addThisOntology: kb/owl/vbe.owl
> _addThisOntology: kb/owl/in.space.owl
> _addThisOntology: kb/vbe.nt
> _addThisOntology: kb/in.space.nt
> _addThisOntology: kb/wkb.nt
> _addThisOntology: kb/wkbx.nt
> _addThisOntology: kb/ignorelist.nt
> _addThisOntology: kb/visibility.nt
> _addThisOntology: populated/rkb.nt
> _addThisOntology: populated/new-temp-triples.nt
>
> 4 - Run the software (a Java application that uses the API in order to 
> execute the semantic annotation)
>
> The text in the file any.txt is the following:
> "This text represents a VBE called Virtec that is located in Europe and is 
> rulled by Mr George Bush. There is also a Robot called R2D2."
>
> When running the SemantiAnnotation program, it identifies only 2 entities
>
> See the log below:
>
> KIM Server connected.
> CorporaAPI and SemanticAnnotationAPI obtained successfully.
> Text annotated.
> [ Document's Annotations (begin) ]
> KIMAnnotationImpl: id=100; type=Person; features={gender=male, 
> inst=http://www.ontotext.com/kim/2005/04/wkb#Man.George%20Bush_R.49543, 
> rule1=PersonTitlePror, rule=PersonFinal, originalName=George Bush, 
> class=http://proton.semanticweb.org/2005/04/protonu#Man}; start=88; end=99
>
> KIMAnnotationImpl: id=99; type=Location; 
> features={inst=http://www.ontotext.com/kim/2005/04/wkb#Continent_T.4, 
> rule1=GazLocation, rule2=LocFinal, originalName=Europe, 
> class=http://proton.semanticweb.org/2005/04/protonu#Continent}; start=60; 
> end=66
>
> [ Document's Annotations (end) ]
> [ Document's Typed Annotations (begin) ]
> = Annotations of type [Person] :
> -- KIMAnnotationImpl: id=100; type=Person; features={gender=male, 
> inst=http://www.ontotext.com/kim/2005/04/wkb#Man.George%20Bush_R.49543, 
> rule1=PersonTitlePror, rule=PersonFinal, originalName=George Bush, 
> class=http://proton.semanticweb.org/2005/04/protonu#Man}; start=88; end=99
>
> = Annotations of type [Location] :
> -- KIMAnnotationImpl: id=99; type=Location; 
> features={inst=http://www.ontotext.com/kim/2005/04/wkb#Continent_T.4, 
> rule1=GazLocation, rule2=LocFinal, originalName=Europe, 
> class=http://proton.semanticweb.org/2005/04/protonu#Continent}; start=60; 
> end=66
>
> [ Document's Features (begin) ]
> [key: gate.SourceURL] [feature: file:/home/kim/Software/Tool/any.txt]
> [key: MimeType] [feature: text/plain]
> [key: KeyEntities] [feature: ]
> [key: docNewLineType] [feature: ]
> [ Document's Features (end) ]
>
> Please, find attached "all my files" :-) (SemanticAnnoation.java, any.txt, 
> sesame.inmem.conf, vbe.owl and vbe.nt)
>
>
> Am I missing something?
>
>
> Thanks in advance.
>
> Best regards
> Leandro.
>
>
>
>
>
> borislav popov wrote:
>  Dear Leandro,
>     great that you put so much effort into this!
>  One thing that you are missing is that you are not associating your new 
> predefined entities with a trusted source.
>  You can find how to do this in the system documentation in your KIM 
> Installation, section Extending KIM, or directly online at the following 
> address:
> 
> http://www.ontotext.com/kim/doc/sys-doc/kim-platform-administration/extending-kim-platform.html
>  hth, borislav
>  p.s. if you think this is a clumsy way (in the doc it is described why we 
> do it that way), we are open for discussions, which eventually will make 
> KIM better and better.
>  have a good day
>  b
>
>  Leandro Loss wrote:
>
>    Dear KIM team,
>    I am working hard in this issue in the last days and I have problems 
> similar to the ones described by Danica...
>
>    Let's go...
>
>    I am running KIM version 1.6.8.14.
>    As Danica, I want to be able to make annotation related to new 
> entities. After some problems, it was possible to extend the ontology 
> (vbe.owl) and the instance base (vbe.nt), however, when creating a sample 
> document it is not possible to create annotations related to this new 
> class (the one inside vbe.owl).
>
>    KIM platform is working properly with pre-defined entities, like 
> "George Bush" and "Europe", but it is not able to annotate our document 
> regarding the new class.
>
>    Is it necessary to setup something else?
>
>    I already changed the file sesame.inmem.conf in order to read this new 
> .owl and .nt
>
>    Please, find attached my .owl and .nt as well as the sample application 
> that uses the semantic annotation API to annotate a very simple doc.
>
>
>    Best Regards,
>    Leandro
>
>
>
>
>    -- 
>    ------------------------------------------------------------------------
>    Leandro Loss, M. Eng.
>    UFSC - Universidade Federal de Santa Catarina
>    DAS - Departamento de Automação e Sistemas
>    GSIGMA - Grupo de Sistemas Inteligentes de Manufatura
>    Cx. Postal 476 - Florianópolis - SC       CEP 88040-900
>    Tel.: (++48) 3331 9742
>    E-mail: [EMAIL PROTECTED]
>    Homepage: http://www.gsigma.ufsc.br/~loss 
> <http://www.gsigma.ufsc.br/%7Eloss>
>
>
>    ------------------------------------------------------------------------
>
>    _______________________________________________
>    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
>      ------------------------------------------------------------------------
>
>    No virus found in this incoming message.
>    Checked by AVG Free Edition.
>    Version: 7.1.405 / Virus Database: 268.11.5/425 - Release Date: 
> 8/22/2006
>
>
>
>
>
>
> -- 
>
> --------------------------------------------------------------------------------
>      Leandro Loss, M. Eng.
>      UFSC - Universidade Federal de Santa Catarina
>      DAS - Departamento de Automação e Sistemas
>      GSIGMA - Grupo de Sistemas Inteligentes de Manufatura
>      Cx. Postal 476 - Florianópolis - SC       CEP 88040-900
>      Tel.: (++48) 3331 9742
>      E-mail: [EMAIL PROTECTED]
>      Homepage: http://www.gsigma.ufsc.br/~loss
>
>
>
>
>
> __________ NOD32 1.1723 (20060824) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>


--------------------------------------------------------------------------------


> <http://www.ontotext.com/kim/2005/04/wkb#VBE_T.1> 
> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vbe#VBE> .
> <http://www.ontotext.com/kim/2005/04/wkb#VBE_T.1> 
> <http://www.w3.org/2000/01/rdf-schema#label> "Virtec" .
> <http://www.ontotext.com/kim/2005/04/wkb#VBE_T.1.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#VBE_T.1.1> 
> <http://www.w3.org/2000/01/rdf-schema#label> "VF" .
> <http://www.ontotext.com/kim/2005/04/wkb#VBE_T.1> 
> <http://proton.semanticweb.org/2005/04/protons#hasAlias> 
> <http://www.ontotext.com/kim/2005/04/wkb#VBE_T.1.1> .
> <http://www.ontotext.com/kim/2005/04/wkb#VBE_T.1.2> 
> <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#VBE_T.1.2> 
> <http://www.w3.org/2000/01/rdf-schema#label> "Virfebras" .
> <http://www.ontotext.com/kim/2005/04/wkb#VBE_T.1> 
> <http://proton.semanticweb.org/2005/04/protons#hasAlias> 
> <http://www.ontotext.com/kim/2005/04/wkb#VBE_T.1.2> .
> <http://www.ontotext.com/kim/2005/04/wkb#VBE_T.1.3> 
> <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#VBE_T.1.3> 
> <http://www.w3.org/2000/01/rdf-schema#label> "Virtuelle Fabrik" .
> <http://www.ontotext.com/kim/2005/04/wkb#VBE_T.1> 
> <http://proton.semanticweb.org/2005/04/protons#hasAlias> 
> <http://www.ontotext.com/kim/2005/04/wkb#VBE_T.1.3> .
> <http://www.ontotext.com/kim/2005/04/wkb#VBE_T.1> 
> <http://proton.semanticweb.org/2005/04/protons#hasMainAlias> 
> <http://www.ontotext.com/kim/2005/04/wkb#VBE_T.1.1> .
> <http://www.ontotext.com/kim/2005/04/wkb#VBEModelsList> 
> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
> <http://proton.semanticweb.org/2005/04/protons#Trusted> .
> <http://www.ontotext.com/kim/2005/04/wkb#VBE_T.1> 
> <http://proton.semanticweb.org/2005/04/protons#generatedBy> 
> <http://www.ontotext.com/kim/2005/04/wkb#VBEModelsList> .
>
>
>
> __________ NOD32 1.1723 (20060824) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>


--------------------------------------------------------------------------------


> <?xml version='1.0' encoding='UTF-8'?>
>    <!DOCTYPE owl [
>        <!ENTITY rdf  'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
>        <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
>        <!ENTITY owl  'http://www.w3.org/2002/07/owl#' >
>        <!ENTITY xsd  'http://www.w3.org/2001/XMLSchema#' >
>        <!ENTITY psys  'http://proton.semanticweb.org/2005/04/protons#'>
>        <!ENTITY ptop  'http://proton.semanticweb.org/2005/04/protont#'>
>        <!ENTITY protonkm 
> 'http://proton.semanticweb.org/2005/04/protonkm#'>
>    ]>
>    <rdf:RDF
>        xmlns:owl="&owl;"
>        xmlns:rdf="&rdf;"
>        xmlns:rdfs="&rdfs;"
>        xmlns:psys="&psys;"
>        xmlns:ptop="&ptop;"
>        xmlns:protonkm="&protonkm;"
>        xmlns="http://vbe#";
>        xml:base="http://vbe#";>
>
>    <owl:AnnotationProperty 
> rdf:about="http://www.w3.org/2000/01/rdf-schema#comment"/>
>    <owl:AnnotationProperty 
> rdf:about="http://www.w3.org/2000/01/rdf-schema#label"/>
>    <owl:AnnotationProperty 
> rdf:about="http://www.w3.org/2002/07/owl#versionInfo"/>
>
>    <owl:Ontology rdf:about="">
>        <rdfs:label 
> rdf:datatype="http://www.w3.org/2001/XMLSchema#string";>InSpace</rdfs:label>
>        <rdfs:comment>InSpace Ontology</rdfs:comment>
>        <owl:imports 
> rdf:resource="http://proton.semanticweb.org/2005/04/protonkm"/>
>        <owl:versionInfo>"0.1"</owl:versionInfo>
>    </owl:Ontology>
>
>    <owl:Class rdf:ID="VBE">
>        <rdfs:label>aa1111aaaaaVBEaaa</rdfs:label>
>        <rdfs:comment>
>        A mechanical or electronic device that resembles a living animal 
> and moves automatically or by remote control.
>        </rdfs:comment>
>        <rdfs:subClassOf rdf:resource="&protonkm;Device"/>
>    </owl:Class>
>
>    <owl:ObjectProperty rdf:about="#createdBy" rdfs:label="createdBy">
>        <rdfs:domain rdf:resource="#VBE"/>
>        <rdfs:range rdf:resource="&ptop;Person"/>
>    </owl:ObjectProperty>
>
>    </rdf:RDF>
>


--------------------------------------------------------------------------------


import java.net.URL;
import java.util.Iterator;
import java.util.Set;

import com.ontotext.kim.client.GetService;
import com.ontotext.kim.client.KIMService;
import com.ontotext.kim.client.corpora.CorporaAPI;
import com.ontotext.kim.client.corpora.KIMAnnotationSet;
import com.ontotext.kim.client.corpora.KIMDocument;
import com.ontotext.kim.client.corpora.KIMFeatureMap;
import com.ontotext.kim.client.corpora.KIMFeatureMapImpl;
import com.ontotext.kim.client.semanticannotation.SemanticAnnotationAPI;

public class SemanticAnnotation
{

    private static CorporaAPI apiCorpora = null;

    private static SemanticAnnotationAPI apiSemAnn = null;

    public static void main(String[] args)
    {
        try
        {
            KIMService serviceKim = GetService.from();
            spit("KIM Server connected.");
            // obtain CorporaAPI and SemanticAnnotationAPI components
            apiCorpora = serviceKim.getCorporaAPI();
            apiSemAnn = serviceKim.getSemanticAnnotationAPI();
            spit("CorporaAPI and SemanticAnnotationAPI obtained 
successfully.");

            // annotate from URL
            URL url = new URL("file:///home/kim/Software/Tool/any.txt");
            KIMDocument kdoc = apiCorpora.createDocument(url, "UTF-8");

            // annotate from text
            //String content = "VF Virtec Virfebras ";

            //spit(content);
            //KIMDocument kdoc = apiCorpora.createDocument(content, 
"UTF-8");

            apiSemAnn.execute(kdoc);
            spit("Text annotated.");

            // inspect document's annotations
            KIMAnnotationSet kimASet = kdoc.getAnnotations();
            Iterator annIterator = kimASet.iterator();
            spit("[ Document's Annotations (begin) ]");
            while (annIterator.hasNext())
            {
                spit(annIterator.next());
            }
            spit("[ Document's Annotations (end) ]");

            // inspect annotations of all types
            KIMAnnotationSet kimASet2 = kdoc.getAnnotations();
            Set typesSet = kimASet2.getAllTypes();
            Iterator iterator = typesSet.iterator();
            // show annotations of every type separately
            spit("[ Document's Typed Annotations (begin) ]");
            while (iterator.hasNext())
            {
                Object key = iterator.next();
                KIMAnnotationSet kimFilteredASet = 
kimASet2.get(String.valueOf(key));
                Iterator annIterator2 = kimFilteredASet.iterator();
                spit(" = Annotations of type [" + String.valueOf(key) + "] 
:");
                while (annIterator2.hasNext())
                {
                    spit(" -- " + annIterator2.next());
                }
            }

            // insert document's features
//            KIMFeatureMap features = new KIMFeatureMapImpl();
//            features.put("SENDER", "[EMAIL PROTECTED]");
//            features.put("SUBJECT", "Kim Feature Test.");
//            kdoc.setFeatures(features);

            // inspect document's features
            // 
----------------------------------------------------------------------------------
            KIMFeatureMap kimFeatures = kdoc.getFeatures();
            if (kimFeatures != null)
            {
                Iterator iterator2 = kimFeatures.keySet().iterator();
                spit("[ Document's Features (begin) ]");
                while (iterator2.hasNext())
                {
                    Object key = iterator2.next();
                    spit("[key: " + key + "] [feature: " + 
kimFeatures.get(key) + "]");
                }
                spit("[ Document's Features (end) ]");
            }

            // TODO: Fazer agora busca por "features", e trabalhar na 
interface
            // do serviço de K.S.

        }
        catch (Exception x)
        {
            x.printStackTrace();
        }
    }

    public static void spit(Object o)
    {
        System.out.println(o);
    }

}



--------------------------------------------------------------------------------


> <?xml version="1.0" encoding="ISO-8859-1"?>
> <system-conf>
> <!-- users -->
> <userlist>
> <!-- User ID's 1 and 2 are reserved for the ADMIN and ANONYMOUS
> accounts respectively. Uncomment these accounts if you need them
> -->
> <user login="admin" id="1">
> <fullname>Admin</fullname>
> <password>admin</password>
> </user>
> </userlist>
> <!-- Set enabled attribute to "true" to enable RMI access.  -->
> <rmi-factory enabled="true" class="com.ontotext.util.rmi.CustomFactory" 
> port="1098"/>
>
> <!-- Change value to "ARP" to use ARP for parsing RDF/XML data -->
> <systemprop key="nl.aidministrator.sesame.rdfXmlParser" value="Sesame"/>
>
> <log dir="/home/kim/Software/KIM/log/sesame" level="3"/>
>
> <!-- repositories -->
> <repositorylist>
>
> <repository id="kim">
>    <title>PROTON In-MemSail</title>
>    <sailstack>
> <sail class="org.openrdf.sesame.sailimpl.OWLIMSchemaRepository">
> <param name="file" value="populated/rkb.nt"/>
> <param name="dataFormat" value="ntriples"/>
> <param name="compressFile" value="no"/>
> <param name="new-triples-file" value="populated/new-temp-triples.nt"/>
> <param name="auto-write-time-minutes" value="15"/>
> <param name="base-URL" value="http://www.ontotext.com/kim/2005/04/wkb#"/>
>
> <!-- semicolon should be used as delimiter -->
> <param name="imports" value=
> "kb/owl/owl.rdfs;
> kb/owl/protons.owl;
> kb/owl/protont.owl;
> kb/owl/protonu.owl;
> kb/owl/protonkm.owl;
> kb/owl/kimso.owl;
> kb/owl/kimlo.owl;
> kb/owl/vbe.owl;
> kb/owl/in.space.owl;
> kb/vbe.nt;
> kb/in.space.nt;
> kb/wkb.nt;
> kb/wkbx.nt;
> kb/ignorelist.nt;
> kb/visibility.nt;"/>
> <param name="defaultNS" value=
> "http://www.w3.org/2002/07/owl#;
> http://proton.semanticweb.org/2005/04/protons#;
> http://proton.semanticweb.org/2005/04/protont#;
> http://proton.semanticweb.org/2005/04/protonu#;
> http://proton.semanticweb.org/2005/04/protonkm#;
> http://www.ontotext.com/kim/2005/04/kimso#;
> http://www.ontotext.com/kim/2005/04/kimlo#;
> http://www.ontotext.com/kim/2005/04/vbe#;
> http://www.ontotext.com/kim/2005/04/in.space#;
> http://www.ontotext.com/kim/2005/04/vbe#;
> http://www.ontotext.com/kim/2005/04/in.space#;
> http://www.ontotext.com/kim/2005/04/wkb#;
> http://www.ontotext.com/kim/2005/04/wkb#;
> http://www.ontotext.com/kim/2005/04/wkb#;
> http://www.ontotext.com/kim/2005/04/wkb#;"/>
>  <param name="concurentInference" value="true"/>
> </sail>
>    </sailstack>
>
>    <!--Access Control List can contain zero or more 'user' elements-->
>    <acl worldReadable="true" worldWritable="true">
>   <user login="admin" readAccess="true" writeAccess="true"/>
>    </acl>
> </repository>
>
> </repositorylist>
> </system-conf>
>


--------------------------------------------------------------------------------


> _______________________________________________
> 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.1723 (20060824) 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

Reply via email to