ctakes-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Bethard <steven.beth...@Colorado.EDU>
Subject Re: SHARPKnowtatorXMLReader borked?
Date Wed, 13 Mar 2013 19:10:49 GMT
On Mar 13, 2013, at 8:00 PM, "Halgrim, Scott" <halgrim.s@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
Mime
View raw message