<div dir="ltr"><div><div><div><div>Dear Lida,<br><br></div>There are many GATE applications, including these two:<br><a href="https://gate.ac.uk/">https://gate.ac.uk/</a> (General architecture for text engineering)<br><a href="http://www.opengatecollaboration.org/">http://www.opengatecollaboration.org/</a> (Tomography simulator)<br><br></div>The first one you are looking for.<br></div>But this e-mail list belongs to the second one. <br></div><div><br>I think you need this email list: <a href="https://gate.ac.uk/mail/">https://gate.ac.uk/mail/</a><br></div><div><div><div><br></div><div>Best,<br></div><div> David<br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 5, 2015 at 2:07 PM, Lida Ghahremanlou <span dir="ltr"><<a href="mailto:lida.ghahremanlou@gmail.com" target="_blank">lida.ghahremanlou@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote">---------- Forwarded message ----------<br>From: "Lida Ghahremanlou" <<a href="mailto:lida.ghahremanlou@gmail.com" target="_blank">lida.ghahremanlou@gmail.com</a>><br>Date: 5 Oct 2015 7:43 pm<br>Subject: Populating Ontologies in Java using Gate Application Pipeline<br>To: <<a href="mailto:gate-users-request@lists.opengatecollaboration.org" target="_blank">gate-users-request@lists.opengatecollaboration.org</a>><br>Cc: <br><br type="attribution"><div dir="ltr"><div>Hi,<br><br></div>I have two queries (Question A and Question B) for
populating Ontologies using Gate application in Java. Here is the steps
that I have successfully implemented in my java program: <br><br><ol><li>I
created a customized pipeline with mylist.def and my own gazetteers,
which successfully annotated the sample corpus ( a list of tweets)
loaded in GUI.</li><li> I then extracted the application pipeline and
used it in the BatchGate program (given from this code) which also
successfully annotated and extract the buildin xml file. <br></li><li>Next,
I wanted to populate my ontology using the annotation text, following
the code explain in the jape rule and 46 and 47 slides(<a href="https://gate.ac.uk/wiki/TrainingCourseJune2012/track-2/module-6-code.html" target="_blank">https://gate.ac.uk/wiki/TrainingCourseJune2012/track-2/module-6-code.html</a>). <br></li><li>However,
my java program can read and populate and write the ontology file
successfully but, the program does not exit. Tracing the code gave me
the impression that loading the existing ontology causes this issue:</li><li><pre>// init GATE and load plugin as before...
URL owl = new File("ontology.owl").toURI().toURL();
FeatureMap params = Factory.newFeatureMap();
params.put("rdfXmlURL", owl);
<span style="color:rgb(255,0,0)">Ontology theOntology = (Ontology)Factory.createResource(
"gate.creole.ontology.impl.sesame.OWLIMOntology",
params);</span></pre></li><li><pre><span style="color:rgb(0,0,255)"><b>Question A:</b> How can I solve this? I read something about Ontology URL mappings.Can anyone give me more details?</span></pre></li><li>After that I pass this problem, I want to populate my ontology per annotation. Each annotation is a class. Meaning that I annotated each tweets as a sentence and then within each sentence, I want the other annotations. e.g. </li></ol><p style="margin-left:40px"><b>Tweet: #Ausopen Rafa won Rajor! Such a match<br></b></p><div style="margin-left:40px"><i><b><Sentence> AusOpen <Player> Rafa </Player> won
<Player>Rajor</Player> ! Such a match </Sentence></b> <br><br></i></div><div style="margin-left:40px"><span style="background-color:rgb(255,255,255)">I have written the code from the Jape example, however I still cannot get the annotation within each sentence tag.<br></span></div><div style="margin-left:40px"><span style="color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255)"><b>Question B: How I can get the annotation within another annotation to populate my ontology? </b></span></span><br></div><div style="margin-left:40px"><i><br></i></div><div style="margin-left:40px"> /find the annotation matched by LHS<br> //we know the annotation set returned<br> //will always contain a single annotation<br> Annotation mentionAnn = mentionAnnots.iterator().next();<br> //System.err.println("Annotation lenght : " + mentionAnn.lenght);<br> <br> //find the class of the mention<br> String className = (String)mentionAnn.getFeatures().<br> get(gate.creole.ANNIEConstants.LOOKUP_CLASS_FEATURE_NAME);<br> // should normalize class name and avoid invalid class names here!<br> //OClass aClass = ontology.getOClass(ontology.createOURIForName(className));<br> OClass aClass = ontology.getOClass(ontology.createOURIForName("Player"));<br> if(aClass == null) { <br> System.err.println("Error class \"" + className + "\" does not exist!");<br> return; <br> } <br> <br> //find the text covered by the annotation<br> String theMentionText = gate.Utils.stringFor(doc, mentionAnn);<br> <br> // when creating a URI from text that came from a document you must take care<br> // to ensure that the name does not contain any characters that are illegal<br> // in a URI. The following method does this nicely for English but you may<br> // want to do your own normalization instead if you have non-English text.<br> String mentionName = OUtils.toResourceName(theMentionText);<br><br> // get the property to store mention texts for mention instances<br> DatatypeProperty prop =<br> ontology.getDatatypeProperty(ontology.createOURIForName("mentionText"));<br><br> OURI mentionURI = ontology.createOURIForName(mentionName);<br> // if that mention instance does not already exist, add it<br> if (!ontology.containsOInstance(mentionURI)) {<br> OInstance inst = ontology.addOInstance(mentionURI, aClass);<br><br></div>Thank you for your help!<div><div><img></div></div></div>
</div>
<br>_______________________________________________<br>
Gate-users mailing list<br>
<a href="mailto:Gate-users@lists.opengatecollaboration.org">Gate-users@lists.opengatecollaboration.org</a><br>
<a href="http://lists.opengatecollaboration.org/mailman/listinfo/gate-users" rel="noreferrer" target="_blank">http://lists.opengatecollaboration.org/mailman/listinfo/gate-users</a><br></blockquote></div><br></div>