You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Alexander Klenner <al...@scai.fraunhofer.de> on 2011/08/30 16:27:40 UTC

cpe descriptor import locations in a jar file

Hi,

is there a way to change the import locations of CpeCasProcessors in a cpeDescriptor during the runtime of this descriptor? My code looks like this:

URL myURL=this.getClass().getResource("/desc/cpe_descriptor.xml");  //this folder is inide a jar file	 
CpeDescription cpeDesc = UIMAFramework.getXMLParser().parseCpeDescription(new XMLInputSource(myURL));
			
myURL=this.getClass().getResource("/desc/annotator/annotator1Descriptor.xml"); //this annotator's location is found inside the jar and URL is returned
		
cpeDesc.getCpeCasProcessors().getAllCpeCasProcessors()[0].setSourceUrl(myURL); 

But that doesn't help. I came up with this problem when I tried to deliver some code completely packed in a jar file. The import locations are not valid anymore, they have to be replaced by URLs from getResource() for all the descriptors that are inside the jar file. I had the same problem with input parameters but those could be set by: 

cpeDesc.getAllCollectionCollectionReaders()[0]
				.getConfigurationParameterSettings().setParameterValue(
						"InputDirectory", args[0]);
	

I am looking for something similar for the import locations, but didn't find anything so far.

Thanks,

Alex




--
Dipl. Bioinformatiker Alexander G. Klenner
Fraunhofer-Institute for Algorithms and Scientific Computing (SCAI)
Schloss Birlinghoven, D-53754 Sankt Augustin
Tel.: +49 - 2241 - 14 - 2736
E-mail: alexander.garvin.klenner@scai.fraunhofer.de
Internet: http://www.scai.fraunhofer.de



Re: cpe descriptor import locations in a jar file

Posted by Richard Eckart de Castilho <ec...@tk.informatik.tu-darmstadt.de>.
Hi Alex,

I'll send it to you off-list.

-- Richard

Am 31.08.2011 um 08:54 schrieb Alexander Klenner:

> Hi Richard,
> 
> if you can provide me with this code earlier that will help us a lot with our initial testing.
> 
> Thanks and regards,
> 
> Alex
> 
> 
> 
> ----- Original Message -----
> From: "Richard Eckart de Castilho" <ec...@tk.informatik.tu-darmstadt.de>
> To: user@uima.apache.org
> Sent: Tuesday, August 30, 2011 4:47:57 PM
> Subject: Re: cpe descriptor import locations in a jar file
> 
> Hi Alex,
> 
>> is there a way to change the import locations of CpeCasProcessors in a cpeDescriptor during the runtime of this descriptor? 
> 
> we solve this problem by generating the CpeDescription at runtime. Basically the procedure is this:
> 
> - locate the Analysis Engine Descriptions in the classpath
> - copy them to the filesystem (temporary files, delete on exit)
> - create a CPE description programmatically and add the Analysis Engine Descriptors to it
> - crate an CPE from the CPE description
> - run it
> 
> If you are interested, I can provide you with the code that does this. It's scheduled for a release within the next few weeks anyway.
> 
> -- Richard
> 

-- 
------------------------------------------------------------------- 
Richard Eckart de Castilho
Technical Lead
Ubiquitous Knowledge Processing Lab 
FB 20 Computer Science Department      
Technische Universität Darmstadt 
Hochschulstr. 10, D-64289 Darmstadt, Germany 
phone [+49] (0)6151 16-7477, fax -5455, room S2/02/B117
eckartde@tk.informatik.tu-darmstadt.de 
www.ukp.tu-darmstadt.de 
Web Research at TU Darmstadt (WeRC) www.werc.tu-darmstadt.de
------------------------------------------------------------------- 





Re: cpe descriptor import locations in a jar file

Posted by Alexander Klenner <al...@scai.fraunhofer.de>.
Hi Richard,

if you can provide me with this code earlier that will help us a lot with our initial testing.

Thanks and regards,

Alex



----- Original Message -----
From: "Richard Eckart de Castilho" <ec...@tk.informatik.tu-darmstadt.de>
To: user@uima.apache.org
Sent: Tuesday, August 30, 2011 4:47:57 PM
Subject: Re: cpe descriptor import locations in a jar file

Hi Alex,

> is there a way to change the import locations of CpeCasProcessors in a cpeDescriptor during the runtime of this descriptor? 

we solve this problem by generating the CpeDescription at runtime. Basically the procedure is this:

- locate the Analysis Engine Descriptions in the classpath
- copy them to the filesystem (temporary files, delete on exit)
- create a CPE description programmatically and add the Analysis Engine Descriptors to it
- crate an CPE from the CPE description
- run it

If you are interested, I can provide you with the code that does this. It's scheduled for a release within the next few weeks anyway.

-- Richard

-- 
------------------------------------------------------------------- 
Richard Eckart de Castilho
Technical Lead
Ubiquitous Knowledge Processing Lab 
FB 20 Computer Science Department      
Technische Universität Darmstadt 
Hochschulstr. 10, D-64289 Darmstadt, Germany 
phone [+49] (0)6151 16-7477, fax -5455, room S2/02/B117
eckartde@tk.informatik.tu-darmstadt.de 
www.ukp.tu-darmstadt.de 
Web Research at TU Darmstadt (WeRC) www.werc.tu-darmstadt.de
------------------------------------------------------------------- 





Re: cpe descriptor import locations in a jar file

Posted by Richard Eckart de Castilho <ec...@tk.informatik.tu-darmstadt.de>.
Hi Alex,

> is there a way to change the import locations of CpeCasProcessors in a cpeDescriptor during the runtime of this descriptor? 

we solve this problem by generating the CpeDescription at runtime. Basically the procedure is this:

- locate the Analysis Engine Descriptions in the classpath
- copy them to the filesystem (temporary files, delete on exit)
- create a CPE description programmatically and add the Analysis Engine Descriptors to it
- crate an CPE from the CPE description
- run it

If you are interested, I can provide you with the code that does this. It's scheduled for a release within the next few weeks anyway.

-- Richard

-- 
------------------------------------------------------------------- 
Richard Eckart de Castilho
Technical Lead
Ubiquitous Knowledge Processing Lab 
FB 20 Computer Science Department      
Technische Universität Darmstadt 
Hochschulstr. 10, D-64289 Darmstadt, Germany 
phone [+49] (0)6151 16-7477, fax -5455, room S2/02/B117
eckartde@tk.informatik.tu-darmstadt.de 
www.ukp.tu-darmstadt.de 
Web Research at TU Darmstadt (WeRC) www.werc.tu-darmstadt.de
-------------------------------------------------------------------