You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Baptiste Gaillard <b_...@hotmail.com> on 2009/03/31 16:51:55 UTC

Instatiate an aggregate AE having reference to a UriSpecifier

Hi, 

On our project we are currently trying to create OSGI Bundle to integrate UIMA components. 
For the moment it works well but I have an instantiation problem using an aggregate AE which reference a Vinci descriptor. 

He is what i'm doing: 

-- Main descriptor of the aggregate AE (X.xml) --
<?xml version="1.0" encoding="UTF-8"?>
  <taeDescription xmlns="http://uima.apache.org/resourceSpecifier">
  <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
  <primitive>false</primitive>

  <delegateAnalysisEngineSpecifiers>
    <delegateAnalysisEngine key="A">
      <import location="A.xml"/>
    </delegateAnalysisEngine>
    <delegateAnalysisEngine key="B">
      <import location="B.xml"/>
    </delegateAnalysisEngine>                        
  </delegateAnalysisEngineSpecifiers>
  
  <analysisEngineMetaData>

  <name>XXX</name>

  <description>slmkjhsqldkjfhldfjkh</description>
  <version>1.0</version>
  <vendor>XXX</vendor>
  <configurationParameters/>
  <configurationParameterSettings/>
  
  <flowConstraints>
    <fixedFlow>
      <node>B</node>
      <node>A</node>
    </fixedFlow>
  </flowConstraints>

  <typePriorities/>
  <fsIndexCollection/>

  <capabilities>
    <capability>
      <inputs/>
      <outputs/>
      <languagesSupported/>
    </capability>
  </capabilities>

  <operationalProperties>
    <modifiesCas>true</modifiesCas>
    <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
    <outputsNewCASes>false</outputsNewCASes>
    </operationalProperties>
  </analysisEngineMetaData>

  <resourceManagerConfiguration/>

</taeDescription>

-- Descriptor B.xml describes a UriSpecifier --
<?xml version="1.0" encoding="UTF-8"?>
<uriSpecifier xmlns="http://uima.apache.org/resourceSpecifier">
    <resourceType>AnalysisEngine</resourceType>
    <uri>XXX</uri>
    <protocol>Vinci</protocol>
</uriSpecifier>


Then in Java i'm using this code to instantiate the Aggregate AE (uimaComponentDescriptorPath is the path to the main component descriptor, uima) :


        ConfigurationManager configurationManager = UIMAFramework.newConfigurationManager();

        try
        {
            // uimaComponentDescriptorPath is the path to the main component descriptor of the aggregate (X.xml)
            ResourceSpecifier uimaComponentDescription = UIMAFramework.getXMLParser().parseResourceSpecifier(new File(uimaComponentDescriptorPath));

            // uimaComponentRootPath is the path to the root directory of the aggregate AE
            ResourceManager resourceManager = UIMAFramework.newDefaultResourceManager();
            resourceManager.setDataPath(uimaComponentRootPath);

            // Component classPath is computed using an utility function
            String uimaComponentClassPath = this.buildUimaComponentClassPath(uimaComponentRootPath);
            resourceManager.setExtensionClassPath(this.getClass().getClassLoader(), uimaComponentClassPath, true);
                    
            AnalysisEngine analysisEngine = UIMAFramework.produceAnalysisEngine(this.uimaComponentDescription, resourceManager, null);
        }
        catch (Exception e)
        {

        }

The line AnalysisEngine analysisEngine = UIMAFramework.produceAnalysisEngine(this.uimaComponentDescription, resourceManager, null); throws an exception : 

org.apache.uima.resource.ResourceInitializationException: The Resource Factory does not know how to create a resource of class org.apache.uima.analysis_engine.AnalysisEngine from the given ResourceSpecifier. (Descriptor: file:/D:/workspace_npf/component/desc/B.xml)
    at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:261)
    at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:352)
    at org.apache.uima.analysis_engine.asb.impl.ASB_impl.setup(ASB_impl.java:243)
    at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initASB(AggregateAnalysisEngine_impl.java:413)
    at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initializeAggregateAnalysisEngine(AggregateAnalysisEngine_impl.java:361)
    at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initialize(AggregateAnalysisEngine_impl.java:183)
    at org.apache.uima.impl.AnalysisEngineFactory_impl.produceResource(AnalysisEngineFactory_impl.java:94)
    at org.apache.uima.impl.CompositeResourceFactory_impl.produceResource(CompositeResourceFactory_impl.java:62)
    at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:258)
    at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:303)
    at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:383)

So this error indicate that UIMA can't find the a ResourceFactory to create an AnalysisEngine from a <uriSpecifier>....</uriSpecifier> descriptor. 
What is the problem in the source code ? I think i've missed a step because this Aggregate AE is working in a CPE. 

Thanks, 

Baptiste Gaillard



_________________________________________________________________
Inédit ! Des Emoticônes Déjantées! Installez les dans votre Messenger ! 
http://www.ilovemessenger.fr/Emoticones/EmoticonesDejantees.aspx

RE: User configuration params in CPE descriptor

Posted by "Duan, Nick" <Ni...@ManTech.com>.
Marshall, I realized there wasn't any need for specifying additional
user parameters, as you indicated, there isn't any coding required for
modifying CPE at the manager level.  Please consider the matter as
closed.

Thanks!

Nick

-----Original Message-----
From: Marshall Schor [mailto:msa@schor.com] 
Sent: Thursday, April 02, 2009 4:00 PM
To: uima-user@incubator.apache.org
Subject: Re: User configuration params in CPE descriptor

Duan, Nick wrote:
> Is there any way to specify a user-defined parameter in CPE descriptor
> (like what you can do in CPE components' descriptors)?
>   
I don't think I quite understand what you're asking for.  The CPE
descriptor has a place for specifying user-defined parameters, within
each component (which you may be acknowledging with your parenthesized
remark).  If you''re asking about other user-defined parameters - what
would be "user" of these?  (There's no user-written code other than what
is in the components.)  

Please say more details if this doesn't address your question. -Marshall
> Thanks!
>
> Nick
> This communication, along with any attachments, is covered by federal
and state law governing electronic communications and may contain
company proprietary and legally privileged information.  
> If the reader of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution, use or copying of
this message is strictly prohibited.  
> If you have received this in error, please reply immediately to the
sender and delete this message.  Thank you.
>
>
>
>   
This communication, along with any attachments, is covered by federal and state law governing electronic communications and may contain company proprietary and legally privileged information.  
If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, use or copying of this message is strictly prohibited.  
If you have received this in error, please reply immediately to the sender and delete this message.  Thank you.


Re: User configuration params in CPE descriptor

Posted by Marshall Schor <ms...@schor.com>.
I now see another thread has picked up on this.  Let's keep the
discussion (if there is anymore) on the other thread.

-Marshall

Marshall Schor wrote:
> Duan, Nick wrote:
>   
>> Is there any way to specify a user-defined parameter in CPE descriptor
>> (like what you can do in CPE components' descriptors)?
>>   
>>     
> I don't think I quite understand what you're asking for.  The CPE
> descriptor has a place for specifying user-defined parameters, within
> each component (which you may be acknowledging with your parenthesized
> remark).  If you''re asking about other user-defined parameters - what
> would be "user" of these?  (There's no user-written code other than what
> is in the components.)  
>
> Please say more details if this doesn't address your question. -Marshall
>   
>> Thanks!
>>
>> Nick
>> This communication, along with any attachments, is covered by federal and state law governing electronic communications and may contain company proprietary and legally privileged information.  
>> If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, use or copying of this message is strictly prohibited.  
>> If you have received this in error, please reply immediately to the sender and delete this message.  Thank you.
>>
>>
>>
>>   
>>     
>
>
>   

Re: User configuration params in CPE descriptor

Posted by Marshall Schor <ms...@schor.com>.
Duan, Nick wrote:
> Is there any way to specify a user-defined parameter in CPE descriptor
> (like what you can do in CPE components' descriptors)?
>   
I don't think I quite understand what you're asking for.  The CPE
descriptor has a place for specifying user-defined parameters, within
each component (which you may be acknowledging with your parenthesized
remark).  If you''re asking about other user-defined parameters - what
would be "user" of these?  (There's no user-written code other than what
is in the components.)  

Please say more details if this doesn't address your question. -Marshall
> Thanks!
>
> Nick
> This communication, along with any attachments, is covered by federal and state law governing electronic communications and may contain company proprietary and legally privileged information.  
> If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, use or copying of this message is strictly prohibited.  
> If you have received this in error, please reply immediately to the sender and delete this message.  Thank you.
>
>
>
>   

User configuration params in CPE descriptor

Posted by "Duan, Nick" <Ni...@ManTech.com>.
Is there any way to specify a user-defined parameter in CPE descriptor
(like what you can do in CPE components' descriptors)?

Thanks!

Nick
This communication, along with any attachments, is covered by federal and state law governing electronic communications and may contain company proprietary and legally privileged information.  
If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, use or copying of this message is strictly prohibited.  
If you have received this in error, please reply immediately to the sender and delete this message.  Thank you.


Re: Instatiate an aggregate AE having reference to a UriSpecifier

Posted by Adam Lally <al...@alum.rpi.edu>.
On Tue, Mar 31, 2009 at 10:51 AM, Baptiste Gaillard
<b_...@hotmail.com> wrote:
> org.apache.uima.resource.ResourceInitializationException: The Resource Factory does not know how to create a resource of class org.apache.uima.analysis_engine.AnalysisEngine from the given ResourceSpecifier. (Descriptor: file:/D:/workspace_npf/component/desc/B.xml)
>    at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:261)
>    at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:352)
> <snip/>
> So this error indicate that UIMA can't find the a ResourceFactory to create an AnalysisEngine from a <uriSpecifier>....</uriSpecifier> descriptor.
> What is the problem in the source code ? I think i've missed a step because this Aggregate AE is working in a CPE.
>

I suggest checking to make sure that uima_adapter_vinci.jar is in your
classpath.  Usually that's the cause of this error message.
  -Adam