uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Burn Lewis <burnle...@gmail.com>
Subject Re: Change an <externalResource> <fileResourceSpecifier> <fileUrl> at run-time
Date Mon, 21 Mar 2016 20:22:41 GMT
The link Richard provided indicates that the substitution may be used for a
<fileResourceSpecifier> so use:
<fileUrl><envVarRef>DictionaryUrl</envVarRef></fileUrl>
with
-DDictionaryUrl=com/gnoetics/resources/dictionary/ConceptMapperRoots_dict

(I verified that it works with a file: URL)

For arbitrary modification of descriptors you can use -Duima.framework_impl
to provide an implementation of  UIMAFramework_impl that supports an
XMLParser that modifies the XML before passing it to the UIMA parser.

~Burn

On Sat, Mar 19, 2016 at 5:25 PM, Richard Eckart de Castilho <rec@apache.org>
wrote:

> Hi,
>
> you might find this interesting (although I haven't used that in a long
> time):
>
>
> https://uima.apache.org/d/uimaj-current/references.html#ugr.ref.xml.component_descriptor.aes.environment_variable_references
>
> Also, after you a have parser the specifier in the last line of your code,
> you can traverse it, locate the element you wish to change and simply
> change
> it at runtime. In that case it doesn't matter what the XML file contains.
>
> The Java object structure is very similar to the XML structure. It may be a
> bit verbose to actually get to the point where you want to go and *maybe*
> you'll have to cast some interfaces to their implementations to get access
> to setters, but in general it should work.
>
> Cheers,
>
> -- Richard
>
> > On 16.03.2016, at 23:46, D. Heinze <dheinze@gnoetics.com> wrote:
> >
> > I have separate xml engine descriptor files for set of ConceptMapper
> > engines, each using a distinct compiled dictionary file that is
> specified in
> > <fileUrl> as shown below.
> > The ConceptMapper engines are configured and run programmatically by one
> of
> > the engines in the overall UIMA pipeline, where the engines are run
> > selectively on data that is constructed on the fly.
> > Because all the descriptor files are alike (with stop word definitions,
> > etc.) except for the <fileUrl> that specifies the dictionary, I would
> like
> > to be able to have only one xml descriptor and be able to set a version
> > number as a Java -D parameter when starting the engine and then add it to
> > the <fileUrl> name after the ResourceSpecifier is created and before
> > produceAnalysisEngine is called.
> >
> > Is this possible?  Or, can <fileUrl> somehow be omitted from the
> descriptor
> > file and specified at run-time as a configuration parameter?
> > Thanks / Dan
> >
> > ENGINE INITIALIZATION CODE:
> >      is = cls.getClassLoader().getResourceAsStream( desc);
> >      XMLInputSource source = new XMLInputSource( is,  null);
> >      ResourceSpecifier specifier =
> > UIMAFramework.getXMLParser().parseResourceSpecifier( source);
> >      ae = UIMAFramework.produceAnalysisEngine(specifier);
> >
> > DESCRIPTOR (desc):
> > <?xml version="1.0" encoding="UTF-8"?>
> > <analysisEngineDescription xmlns="
> http://uima.apache.org/resourceSpecifier">
> >  <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
> >  <primitive>true</primitive>
> >
> >
> <annotatorImplementationName>org.apache.uima.conceptMapper.ConceptMapper</an
> > notatorImplementationName>
> > ...
> >  <resourceManagerConfiguration>
> >    <externalResources>
> >      <externalResource>
> >        <name>DictionaryFileName</name>
> >        <description>A file containing the dictionary. Modify this URL to
> > use a different dictionary.</description>
> >        <fileResourceSpecifier>
> >
> >
> <fileUrl>com/gnoetics/resources/dictionary/ConceptMapperRoots_dict</fileUrl>
> >         </fileResourceSpecifier>
> >
> >
> <implementationName>org.apache.uima.conceptMapper.support.dictionaryResource
> > .CompiledDictionaryResource_impl</implementationName>
> >      </externalResource>
> >    </externalResources>
> >    <externalResourceBindings>
> >      <externalResourceBinding>
> >        <key>DictionaryFile</key>
> >        <resourceName>DictionaryFileName</resourceName>
> >      </externalResourceBinding>
> >    </externalResourceBindings>
> >  </resourceManagerConfiguration>
> > </analysisEngineDescription>
> >
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message