Return-Path: X-Original-To: apmail-uima-user-archive@www.apache.org Delivered-To: apmail-uima-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8348BF155 for ; Mon, 25 Mar 2013 23:09:40 +0000 (UTC) Received: (qmail 83782 invoked by uid 500); 25 Mar 2013 23:09:40 -0000 Delivered-To: apmail-uima-user-archive@uima.apache.org Received: (qmail 83741 invoked by uid 500); 25 Mar 2013 23:09:39 -0000 Mailing-List: contact user-help@uima.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@uima.apache.org Delivered-To: mailing list user@uima.apache.org Received: (qmail 83730 invoked by uid 99); 25 Mar 2013 23:09:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Mar 2013 23:09:39 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of richard.eckart@gmail.com designates 209.85.215.170 as permitted sender) Received: from [209.85.215.170] (HELO mail-ea0-f170.google.com) (209.85.215.170) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Mar 2013 23:09:32 +0000 Received: by mail-ea0-f170.google.com with SMTP id a15so2680418eae.29 for ; Mon, 25 Mar 2013 16:09:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=nDiNgFZT9Iz8YW/Dd1l203AgsDcaGTVmXHq1+ybilEE=; b=InSchMvkmG9WsC9a56v7cUL5W9z1w9WqMAOR6ivi6W5aE454iM+73S20alV3b4zeaS 743HDjOpIeldcRAZjr6iHhEV5++at0Z0L4gzkmDSnR9ZK7ixgQYxSvNy5pAf9mxWwEr4 8aW27P+qKock44BVEScPZm3Hj0xmqBFY8X29o4bC5L22z4tatUbZGoOWMpQRmSuIj2Fs +VE9Q1aVBZfnnO4xSy21MjgP3XNp4PaR473fzARGpiqw5ME2teT+VMztQC85SvY3DFoP ZP6IJb5TYqbDoK7/d/22HvXqig3SETOVCm8H2jUKLGVnMxYm2ieaUKOM8aXg1HtGM2yP Zy/Q== X-Received: by 10.14.207.200 with SMTP id n48mr10734377eeo.4.1364252951931; Mon, 25 Mar 2013 16:09:11 -0700 (PDT) Received: from [10.0.1.20] (ip-178-200-235-87.unitymediagroup.de. [178.200.235.87]) by mx.google.com with ESMTPS id 3sm21820277eej.6.2013.03.25.16.09.10 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Mar 2013 16:09:10 -0700 (PDT) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: Re: Using UIMA within an existing application From: Richard Eckart de Castilho In-Reply-To: Date: Tue, 26 Mar 2013 00:09:08 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <621A6854-7632-4C2C-AFA1-CA765D0F62E8@gmail.com> References: To: user@uima.apache.org X-Mailer: Apple Mail (2.1503) X-Virus-Checked: Checked by ClamAV on apache.org Hi, I'm trying to give some general hints. Using these with CPEs, though, may not work out. For embedding, you might want to have a look at (the internals of) uimaFIT.=20 Am 25.03.2013 um 09:12 schrieb James Baker : > I'm writing an extension to an existing application. The idea is that = the > user will select a CPE descriptor and do some configuration, then the > application will run the CPE through UIMA and load the results into = the > application. >=20 > I've got a lot of the parts of the code working individually, but I'm > having a few issues: >=20 > 1) The CPE may include annotators that aren't on the classpath. I can = find > the bin directory that contains the class files (based on the location = of > each annotators descriptor file), and create a URLClassLoader that > references that directory (and hence finds the annotators) - but I = can't > figure out how to get UIMA to use that classloader. >=20 > Any ideas how I'd do this, or is there a better way of loading in > annotators that aren't on the classpath? (And no, it isn't feasible to = add > the directories to the classpath before hand) The place to look at is the ResourceManager. Either you can set the = classloader there or you can implement your own ResourceManager that provides a = suitable classloader. It likely requires manually instantiating components = through the methods provided by the UIMAFramework factory class. > 2) In order to do the configuration (primarily mapping the UIMA = outputs > from UIMA to my application), I need to know the type system the CPE = will > produce so the user can do the mapping. I can't find a way of getting = the > type system before running the pipeline though. >=20 > Is this achievable through UIMA, or am I going to have to parse the = XML > files myself to build the type system? You can load the XMLs using the UIMAFramework.getParser (or something = like this) and then work on the parsed descriptor objects. =46rom there it should = be fairly straight to resolve and access the type system descriptors. Then there = is a utility method somewhere to merge them to get the full type system.=20 > 3) A much simpler question (I hope). Once I've run the process() = method on > the CPE, how do I get the output? Do I have to have a Consumer in the > pipeline that will somehow pass the CAS objects to my application, or = can I > get at them directly? If you instantiate the components yourself, then you can create a CAS = using e.g. using CasCreationUtils (UIMA) or JCasFactory (from uimaFIT), fill it = with your data and then pass it to the process() methods of your components. In the end you have all the data in the CAS and can extract it from there. That = should=20 be convenient enough for an embedded pipeline. Cheers, -- Richard=