Return-Path: Delivered-To: apmail-incubator-uima-user-archive@minotaur.apache.org Received: (qmail 33087 invoked from network); 5 Mar 2010 12:43:30 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 Mar 2010 12:43:30 -0000 Received: (qmail 93644 invoked by uid 500); 5 Mar 2010 12:43:17 -0000 Delivered-To: apmail-incubator-uima-user-archive@incubator.apache.org Received: (qmail 93621 invoked by uid 500); 5 Mar 2010 12:43:17 -0000 Mailing-List: contact uima-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: uima-user@incubator.apache.org Delivered-To: mailing list uima-user@incubator.apache.org Received: (qmail 93613 invoked by uid 99); 5 Mar 2010 12:43:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Mar 2010 12:43:17 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [193.52.101.145] (HELO smtp-tls.univ-nantes.fr) (193.52.101.145) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Mar 2010 12:43:13 +0000 Received: from localhost (debian [127.0.0.1]) by smtp-tls.univ-nantes.fr (Postfix) with ESMTP id 38C732CBDE for ; Fri, 5 Mar 2010 13:42:51 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at univ-nantes.fr Received: from smtp-tls.univ-nantes.fr ([127.0.0.1]) by localhost (SMTP-TLS.univ-nantes.fr [127.0.0.1]) (amavisd-new, port 10024) with LMTP id u+8bDIo3BG6S for ; Fri, 5 Mar 2010 13:42:51 +0100 (CET) Received: from pnix (ipcop.lina.sciences.univ-nantes.fr [193.52.105.131]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by smtp-tls.univ-nantes.fr (Postfix) with ESMTPSA id 21F062CBD9 for ; Fri, 5 Mar 2010 13:42:51 +0100 (CET) Date: Fri, 5 Mar 2010 13:42:50 +0100 From: =?UTF-8?B?SsOpcsO0bWU=?= Rocheteau To: uima-user@incubator.apache.org Subject: Re: FeaturePath's built-in function "coveredText()" Message-ID: <20100305134250.7c6c8cb8@pnix> In-Reply-To: <20100128144214.3224798b@pnix> References: <20100128144214.3224798b@pnix> Organization: =?UTF-8?B?VW5pdmVyc2l0w6k=?= de Nantes X-Mailer: Claws Mail 3.7.2 (GTK+ 2.18.3; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, I reply to my own mail; it could be useful for others.=20 I don't use the built-in function of the FeaturePath interface. Instead, I define a class CoveredTextConstraint that inherits=20 from FSMatchConstraint as follows:=20 import org.apache.uima.cas.FSMatchConstraint; import org.apache.uima.cas.FeatureStructure; import org.apache.uima.jcas.tcas.Annotation; public class CoveredTextConstraint implements FSMatchConstraint { =09 private String coveredText; private void setCoveredText(String coveredText) { this.coveredText =3D coveredText; } =09 private String getCoveredText() { return this.coveredText; } =09 public CoveredTextConstraint(String coveredText) { this.setCoveredText(coveredText); } public boolean match(FeatureStructure fs) { if (fs instanceof Annotation) { Annotation a =3D (Annotation) fs; String coveredText =3D a.getCoveredText(); return coveredText.equals(this.getCoveredText()); } return false; } } An instance of this class is created by defining the required covered text = within its constructor. The method 'boolean match(FeatureStructure)' checks if this fe= ature structure is an instance of the class uima.tcas.Annotation, then gets its c= overed text and=20 return true if and only if the latter is exactly the same as that of the re= quired one. That's all. You can use this class as follows: CoveredTextConstraint aCoveredTextConstraint =3D new CoveredTextConstraint(= " ... "); FSIterator anIterator =3D cas.getAnnotationIndex().iterator(); FSIterator anotherIterator =3D aCas.createFilteredIterator(anIterator,aCoveredTextConstraint); ... HTH J=C3=A9r=C3=B4me Thu, 28 Jan 2010 14:42:14 +0100, J=C3=A9r=C3=B4me Rocheteau a =C3=A9crit : > Hello, >=20 > I'd like to known how to use the built-in function "coveredText()" descri= bed in the > API of the FeaturePath interface? For example, I'd like to select annotat= ions of > type uima.tcas.Annotation covering the text "UIMA". How can I do that? >=20 > Thanks in advance, > J=C3=A9r=C3=B4me