You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ctakes.apache.org by "Halgrim, Scott" <ha...@ghc.org> on 2013/03/13 20:00:48 UTC

SHARPKnowtatorXMLReader borked?

I cannot seem to run SHARPKnowtatorXMLReader.process() as part of the assertion eval launch. I've done a bit of investigative work, but found myself too far down the rabbit hole to want to make any changes myself. So I'll present what I found here and maybe you can let me know if I'm doing something wrong or if something else needs to be fixed.

That method throws an IllegalArgumentException at line 198 (rev 1454310) where it tries to create a File from knowtatorURI. Which is just, for example, rec001.knowtator.xml. And it is only that value because the private File member textDirectory is null. And I can't find anywhere in that class that textDirectory is assigned.

The textDirectory member seems to replace the public static member textURIDirectory from the previous rev (1454297). In addition to being public, that member was assigned in the initialize() method of that rev, which no longer exists in the current rev.

So I don't see any way that textDirectory can ever get assigned with the current code, so I don't see any way that line 198 can create a File from the knowtatorURI.

Am I missing something?

Thanks,

Scott

________________________________

GHC Confidentiality Statement

This message and any attached files might contain confidential information protected by federal and state law. The information is intended only for the use of the individual(s) or entities originally named as addressees. The improper disclosure of such information may be subject to civil or criminal penalties. If this message reached you in error, please contact the sender and destroy this message. Disclosing, copying, forwarding, or distributing the information by unauthorized individuals or entities is strictly prohibited by law.

RE: SHARPKnowtatorXMLReader borked?

Posted by "Halgrim, Scott" <ha...@ghc.org>.
Thanks, Steve. Yeah, at the point of creation via AnalysisEngineFactory, the config parameters being sent in were still using the old name of the parameter.

I'm trying to commit my fix now.

Thanks,

Scott

-----Original Message-----
From: Steven Bethard [mailto:steven.bethard@Colorado.EDU]
Sent: Wednesday, March 13, 2013 12:11 PM
To: ctakes-dev@incubator.apache.org
Subject: Re: SHARPKnowtatorXMLReader borked?

On Mar 13, 2013, at 8:00 PM, "Halgrim, Scott" <ha...@ghc.org> wrote:
> I cannot seem to run SHARPKnowtatorXMLReader.process() as part of the assertion eval launch. I've done a bit of investigative work, but found myself too far down the rabbit hole to want to make any changes myself. So I'll present what I found here and maybe you can let me know if I'm doing something wrong or if something else needs to be fixed.
>
> That method throws an IllegalArgumentException at line 198 (rev 1454310) where it tries to create a File from knowtatorURI. Which is just, for example, rec001.knowtator.xml. And it is only that value because the private File member textDirectory is null. And I can't find anywhere in that class that textDirectory is assigned.
>
> The textDirectory member seems to replace the public static member textURIDirectory from the previous rev (1454297). In addition to being public, that member was assigned in the initialize() method of that rev, which no longer exists in the current rev.

>
> So I don't see any way that textDirectory can ever get assigned with the current code, so I don't see any way that line 198 can create a File from the knowtatorURI.
>
> Am I missing something?

You just need to use UIMA configuration parameters. I don't know where/how you're creating an AnalysisEngine from SHARPKnowtatorXMLReader, but just specify SHARPKnowtatorXMLReader.PARAM_TEXT_DIRECTORY=<your-text-directory> (a.k.a. "TextDirectory"=<your-text-directory>) when you create it.

To help you get out of the rabbit hole - they way you would realize that there are UIMA configuration parameters is to look for the @ConfigurationParameter annotations. Since SHARPKnowtatorXMLReader inherits from org.uimafit.component.JCasAnnotator_ImplBase, uimaFIT will automatically fill in those @ConfigurationParameter variables from the UIMA context in (the superclass's) initialize method.

And as to the implied question of why I removed the public static textURIDirectory, that's because public static non-final members are a Really Bad Idea((tm)), and are the wrong way to initialize UIMA components. They're a sure way to get nasty thread-unsafety and synchronization problems. So I got rid of the static variable and made it a configuration parameter like it should be for a UIMA component.

Steve

________________________________

GHC Confidentiality Statement

This message and any attached files might contain confidential information protected by federal and state law. The information is intended only for the use of the individual(s) or entities originally named as addressees. The improper disclosure of such information may be subject to civil or criminal penalties. If this message reached you in error, please contact the sender and destroy this message. Disclosing, copying, forwarding, or distributing the information by unauthorized individuals or entities is strictly prohibited by law.

Re: SHARPKnowtatorXMLReader borked?

Posted by Steven Bethard <st...@Colorado.EDU>.
On Mar 13, 2013, at 8:00 PM, "Halgrim, Scott" <ha...@ghc.org> wrote:
> I cannot seem to run SHARPKnowtatorXMLReader.process() as part of the assertion eval launch. I've done a bit of investigative work, but found myself too far down the rabbit hole to want to make any changes myself. So I'll present what I found here and maybe you can let me know if I'm doing something wrong or if something else needs to be fixed.
> 
> That method throws an IllegalArgumentException at line 198 (rev 1454310) where it tries to create a File from knowtatorURI. Which is just, for example, rec001.knowtator.xml. And it is only that value because the private File member textDirectory is null. And I can't find anywhere in that class that textDirectory is assigned.
> 
> The textDirectory member seems to replace the public static member textURIDirectory from the previous rev (1454297). In addition to being public, that member was assigned in the initialize() method of that rev, which no longer exists in the current rev.
> 
> So I don't see any way that textDirectory can ever get assigned with the current code, so I don't see any way that line 198 can create a File from the knowtatorURI.
> 
> Am I missing something?

You just need to use UIMA configuration parameters. I don't know where/how you're creating an AnalysisEngine from SHARPKnowtatorXMLReader, but just specify SHARPKnowtatorXMLReader.PARAM_TEXT_DIRECTORY=<your-text-directory> (a.k.a. "TextDirectory"=<your-text-directory>) when you create it.

To help you get out of the rabbit hole - they way you would realize that there are UIMA configuration parameters is to look for the @ConfigurationParameter annotations. Since SHARPKnowtatorXMLReader inherits from org.uimafit.component.JCasAnnotator_ImplBase, uimaFIT will automatically fill in those @ConfigurationParameter variables from the UIMA context in (the superclass's) initialize method.

And as to the implied question of why I removed the public static textURIDirectory, that's because public static non-final members are a Really Bad Idea(™), and are the wrong way to initialize UIMA components. They're a sure way to get nasty thread-unsafety and synchronization problems. So I got rid of the static variable and made it a configuration parameter like it should be for a UIMA component.

Steve