Return-Path: Delivered-To: apmail-incubator-uima-user-archive@locus.apache.org Received: (qmail 80583 invoked from network); 10 Oct 2008 01:06:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Oct 2008 01:06:20 -0000 Received: (qmail 48046 invoked by uid 500); 10 Oct 2008 01:06:18 -0000 Delivered-To: apmail-incubator-uima-user-archive@incubator.apache.org Received: (qmail 48018 invoked by uid 500); 10 Oct 2008 01:06:18 -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 48007 invoked by uid 99); 10 Oct 2008 01:06:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Oct 2008 18:06:18 -0700 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=DNS_FROM_SECURITYSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of aleks_d@gmx.de designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 10 Oct 2008 01:05:14 +0000 Received: (qmail invoked by alias); 10 Oct 2008 01:04:48 -0000 Received: from g226200229.adsl.alicedsl.de (EHLO localhost) [92.226.200.229] by mail.gmx.net (mp021) with SMTP; 10 Oct 2008 03:04:48 +0200 X-Authenticated: #14782887 X-Provags-ID: V01U2FsdGVkX18tApppz7stlo0QlpQ1Tu75UiTglUGJmX381c0yHn FAwz+F726ctRLE Date: Fri, 10 Oct 2008 03:03:04 +0200 From: =?utf-8?B?0JDQu9C10LrRgdCw0L3QtNGK0YAg0JsuINCU0LjQvNC40YLRgNC+0LI=?= To: uima-user@incubator.apache.org Subject: .addToIndexes() on subtype while iterating over supertype Message-ID: <20081010010304.GA27153@localhost> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="n8g4imXOkfNTN/H1" Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.63 X-Virus-Checked: Checked by ClamAV on apache.org --n8g4imXOkfNTN/H1 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, I have the following design issue with one of my AnalysisEngines. I searche= d the documentation, but not exhaustively, so pardon me if I'm doing something fundamentally wrong or there is an easy obvious solution. I have a type T1 and its subtype T2. They would both span the same text in = the CAS, and while T1 represents a general data structure, T2 represents a more specific one. Say, T1 represents a sentence and T2 a sentence of a certain = kind. In order to find out about all T2's in the text, I first have to find all T= 1's, then declare some T1's as T2's. Currently, I first mark up all T1's in an A= E, then, in the next step and another AE, iterate over all T1's, look at their features and decide whether or not a T1 is a T2. In my particular example, I have to first do sentence boundary detection, then, after a few other AE's = have done additional work, decide whether a particular sentence contains a trigg= er. So, I iterate over T1: final AnnotationIndex ai =3D cas.getAnnotationIndex(T1.class); for (final Iterator i =3D ai.iterator(); ai.hasNext(); ) { final T1 t1 =3D ai.next(); // throws ConcurrentModificationException = =E2=80=A6 if (matchesDescription(t1)) { final T2 t2 =3D new T2(cas); doStuff(t2) t2.addToIndexes(); // =E2=80=A6 because we modified T1's indexes by adding= a T2 // to them } } As you can see, this code won't work, the Iterator's domain will be changed because the subclass shares an index 'pool' (or so) with the superclass. This means that the AnnotationIndex of cas.getAnnotationIndex(Foo.class) wi= ll always contain all instances of Foo.class in the CAS, *and* all instances o= f all the subclasses? Apart from just caching all T2's I want to add to the indexes in an ArrayLi= st and then adding them after the iteration of T1's is finished, are there any other solutions? I wouldn't like to break up the semantic tie of inheritance between T1 and T2. Thanks in advance, Aleks --n8g4imXOkfNTN/H1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkjuqcgACgkQrljAdGQVWuDE5gCeJqnNFo3bsiJP5hhKrfLBRTzh X6EAnjNYP/4m8ImcqsPqIf/oKLlE2iQR =3RLd -----END PGP SIGNATURE----- --n8g4imXOkfNTN/H1--