You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Spico Florin <sp...@gmail.com> on 2011/12/12 15:22:44 UTC

How to declare external resources using relative paths (for UIMA AS deployment)

Hello!
   I'm using GATE annotator descriptor that is locate in *
<my_project>/desc/uima-gate/primitive* and has dependencies on two external
data files located at
 *<my_project>/resources/gate-apps/fuel-type/application.xgapp*;
*<my_project>/resources/gate-mapping/LargeKB_UIMAMapping.xml*
I have a script located in *<my_project>/  *that uses *deployAsyncService.cmd
*to deploy my AE (for UIMA AS) that incorporates the GATE Annotator. When
I'm running the script the following exception is thrown:

org.apache.uima.resource.ResourceInitializationException: Could not access
the resource data at *resources/gate-apps/fuel-type/application.xgapp*.
    at
org.apache.uima.resource.impl.DataResource_impl.initialize(DataResource_impl.java:126)

I've added the xgapp file in the UIMA_CLASSPATH variables, but the error
remains.

script.bat
@set UIMA_CLASSPATH=%UIMA_CLASSPATH%;lib;*
resources/gate-apps/fuel-type/application.xgapp*
deployAsyncService.cmd <my_uima_as_descriptor>.xml

Can you please give me an advice on how to set up the external resources
URL in a such way to avoid this kind of problems? It will be great if you
can give me the right configuration for my scenario.
Thank you.

Regards,
  Florin



<resourceManagerConfiguration>
    <externalResources>
      <externalResource>
        <name>gate.uima.org_application</name>
        <description/>
        <fileResourceSpecifier>
          <fileUrl>*resources/gate-apps/fuel-type/application.xgapp*
</fileUrl>
        </fileResourceSpecifier>AE
      </externalResource>
      <externalResource>
        <name>gate.uima.org_mapping</name>
        <description/>
        <fileResourceSpecifier>
          <fileUrl>*resources/gate-mapping/LargeKB_UIMAMapping.xml*
</fileUrl>
        </fileResourceSpecifier>
      </externalResource>
    </externalResources>
    <externalResourceBindings>
      <externalResourceBinding>
        <key>GateApplication</key>
        <resourceName>gate.uima.org_application</resourceName>
      </externalResourceBinding>
      <externalResourceBinding>
        <key>MappingDescriptor</key>
        <resourceName>gate.uima.org_mapping</resourceName>
      </externalResourceBinding>
    </externalResourceBindings>
  </resourceManagerConfiguration>

Re: How to declare external resources using relative paths (for UIMA AS deployment)

Posted by Spico Florin <sp...@gmail.com>.
Hello!
   Stupid mail was formatting the bold text with "*". There is no "*" in
paths. The bold text was there just to emphasize the paths.
I have read again the documentation regarding the "Declaring Resources and
Binding" from tutorials_and_user_guide.pdf (version 2.3.1). and at the page
31,
is stated:

"The first section of this XML declares an externalResource, the
UimaAcronymTableFile. With
this, the fileUrl element specifies the path to the data file. This can be
an absolute URL (e.g. one
that starts with file:/ or file:///, or file://my.host.org/), but that is
not recommended because it makes
installation of your component more difficult, as noted earlier. Better is
a relative URL, which will
be looked up within the classpath (and/or datapath), as used in this
example. In this case, the file
org/apache/uima/tutorial/ex6/uimaAcronyms.txt is located in
uimaj-examples.jar,
which is in the classpath"

    The interesting part is the one related with the relative path. In
order to use it, from my understanding, you have to pack the external
dependencies either in a different jar and add it to the classpath, either
add them into your project jar. The important thing is that those
dependencies should be in the classpath. I did this and and it worked.
  I hope that someone can confirm the above.
In my opinion, there should be a feature in the uima where you can define
the dependencies to external resources using the relative paths from where
you are executing the main script for starting the UIMA AS service.

  I look forward for your opinion and suggestions.
  Thank you,
  Florin




On Mon, Dec 12, 2011 at 5:20 PM, Marshall Schor <ms...@schor.com> wrote:

> hmmm, I don't think you can have a path that includes (or starts with) the
> character "*".
>
> Is that a typo?
>
> The path (as written) will be resolved as a relative path, against the
> current
> working directory I think...
>
> -Marshall
>
> On 12/12/2011 9:22 AM, Spico Florin wrote:
> > Hello!
> >    I'm using GATE annotator descriptor that is locate in *
> > <my_project>/desc/uima-gate/primitive* and has dependencies on two
> external
> > data files located at
> >  *<my_project>/resources/gate-apps/fuel-type/application.xgapp*;
> > *<my_project>/resources/gate-mapping/LargeKB_UIMAMapping.xml*
> > I have a script located in *<my_project>/  *that uses
> *deployAsyncService.cmd
> > *to deploy my AE (for UIMA AS) that incorporates the GATE Annotator. When
> > I'm running the script the following exception is thrown:
> >
> > org.apache.uima.resource.ResourceInitializationException: Could not
> access
> > the resource data at *resources/gate-apps/fuel-type/application.xgapp*.
> >     at
> >
> org.apache.uima.resource.impl.DataResource_impl.initialize(DataResource_impl.java:126)
> >
> > I've added the xgapp file in the UIMA_CLASSPATH variables, but the error
> > remains.
> >
> > script.bat
> > @set UIMA_CLASSPATH=%UIMA_CLASSPATH%;lib;*
> > resources/gate-apps/fuel-type/application.xgapp*
> > deployAsyncService.cmd <my_uima_as_descriptor>.xml
> >
> > Can you please give me an advice on how to set up the external resources
> > URL in a such way to avoid this kind of problems? It will be great if you
> > can give me the right configuration for my scenario.
> > Thank you.
> >
> > Regards,
> >   Florin
> >
> >
> >
> > <resourceManagerConfiguration>
> >     <externalResources>
> >       <externalResource>
> >         <name>gate.uima.org_application</name>
> >         <description/>
> >         <fileResourceSpecifier>
> >           <fileUrl>resources/gate-apps/fuel-type/application.xgapp
> > </fileUrl>
> >         </fileResourceSpecifier>AE
> >       </externalResource>
> >       <externalResource>
> >         <name>gate.uima.org_mapping</name>
> >         <description/>
> >         <fileResourceSpecifier>
> >           <fileUrl>resources/gate-mapping/LargeKB_UIMAMapping.xml*
> > </fileUrl>
> >         </fileResourceSpecifier>
> >       </externalResource>
> >     </externalResources>
> >     <externalResourceBindings>
> >       <externalResourceBinding>
> >         <key>GateApplication</key>
> >         <resourceName>gate.uima.org_application</resourceName>
> >       </externalResourceBinding>
> >       <externalResourceBinding>
> >         <key>MappingDescriptor</key>
> >         <resourceName>gate.uima.org_mapping</resourceName>
> >       </externalResourceBinding>
> >     </externalResourceBindings>
> >   </resourceManagerConfiguration>
> >
>

Re: How to declare external resources using relative paths (for UIMA AS deployment)

Posted by Marshall Schor <ms...@schor.com>.
hmmm, I don't think you can have a path that includes (or starts with) the
character "*".

Is that a typo?

The path (as written) will be resolved as a relative path, against the current
working directory I think...

-Marshall

On 12/12/2011 9:22 AM, Spico Florin wrote:
> Hello!
>    I'm using GATE annotator descriptor that is locate in *
> <my_project>/desc/uima-gate/primitive* and has dependencies on two external
> data files located at
>  *<my_project>/resources/gate-apps/fuel-type/application.xgapp*;
> *<my_project>/resources/gate-mapping/LargeKB_UIMAMapping.xml*
> I have a script located in *<my_project>/  *that uses *deployAsyncService.cmd
> *to deploy my AE (for UIMA AS) that incorporates the GATE Annotator. When
> I'm running the script the following exception is thrown:
>
> org.apache.uima.resource.ResourceInitializationException: Could not access
> the resource data at *resources/gate-apps/fuel-type/application.xgapp*.
>     at
> org.apache.uima.resource.impl.DataResource_impl.initialize(DataResource_impl.java:126)
>
> I've added the xgapp file in the UIMA_CLASSPATH variables, but the error
> remains.
>
> script.bat
> @set UIMA_CLASSPATH=%UIMA_CLASSPATH%;lib;*
> resources/gate-apps/fuel-type/application.xgapp*
> deployAsyncService.cmd <my_uima_as_descriptor>.xml
>
> Can you please give me an advice on how to set up the external resources
> URL in a such way to avoid this kind of problems? It will be great if you
> can give me the right configuration for my scenario.
> Thank you.
>
> Regards,
>   Florin
>
>
>
> <resourceManagerConfiguration>
>     <externalResources>
>       <externalResource>
>         <name>gate.uima.org_application</name>
>         <description/>
>         <fileResourceSpecifier>
>           <fileUrl>*resources/gate-apps/fuel-type/application.xgapp*
> </fileUrl>
>         </fileResourceSpecifier>AE
>       </externalResource>
>       <externalResource>
>         <name>gate.uima.org_mapping</name>
>         <description/>
>         <fileResourceSpecifier>
>           <fileUrl>*resources/gate-mapping/LargeKB_UIMAMapping.xml*
> </fileUrl>
>         </fileResourceSpecifier>
>       </externalResource>
>     </externalResources>
>     <externalResourceBindings>
>       <externalResourceBinding>
>         <key>GateApplication</key>
>         <resourceName>gate.uima.org_application</resourceName>
>       </externalResourceBinding>
>       <externalResourceBinding>
>         <key>MappingDescriptor</key>
>         <resourceName>gate.uima.org_mapping</resourceName>
>       </externalResourceBinding>
>     </externalResourceBindings>
>   </resourceManagerConfiguration>
>