uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Eckart de Castilho <eckar...@tk.informatik.tu-darmstadt.de>
Subject Re: Attempted to copy a FeatureStructure of type "org.apache.uima.examples.SourceDocumentInformation:uri", which is not defined in the type system of the destination CAS.
Date Wed, 14 Sep 2011 06:20:16 GMT
Hi Harsha,

in my experience, an empty cas has no document meta data annotation (SourceDocumentInformation
or whatever else you are using). It's the feature structure you can get via CAS.getDocumentMetadata().
This feature structure only gets created when you call setDocumentLanguage(), setDocumentText()
or one of the likes - or if you set the info manually through setDocumentMetadata(). To my
knowledge, the CasCopier does not know how to deal with that information missing.

I think if you just add a 

	output.setDocumentLanguage("x-unspecified");

your code should run.

Cheers,

-- Richard

Am 13.09.2011 um 23:04 schrieb Harsha V. Krishnareddy:

> HI,
> 
> I am trying to use the CasCopier api to copy a cas into an other. I get a
> Exception.
> This is how I am Copying the CAS. next() is a method I am trying to
> over-ride that is in the "CasMultiplier_ImplBase"
> 
> Can some one help me figure out my mistake, if any ? I pasted the code
> snippet, and also the Exception from the console.
> 
> - Thanks
> Harsha
> 
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------
>    public AbstractCas next() throws AnalysisEngineProcessException {
>        // myCas guaranteed not to be null
> //        while(myCas.getTypeSystem().getFeatures().hasNext()){
> //            System.out.println("myCas TS Feature :
> "+myCas.getTypeSystem().getFeatures().next());
> //        }
> 
>        CAS output = null;
>        if (counter < target) {
>            // copy myCas
>            output = getEmptyCAS();
>            CasCopier.copyCas(myCas, output, true);
>            counter += 1;
>        } else {
>            // release myCas
>            output = myCas;
>            myCas = null;
>            counter = 0;
>        }
> 
>        // annotate indicator with integer value between 0 and count,
> inclusive
>        // 0 represents the original CAS, 1 to count represent respectively
> the
>        // 1st through count-th copy CASes released.
>        TypeSystem ts = output.getTypeSystem();
>        Type indicatorType = ts.getType(TRANSFER_TYPE);
>        Feature valueFeature =
> indicatorType.getFeatureByBaseName(TRANSFER_FEATURE);
>        FeatureStructure indicator = output.createFS(indicatorType);
>        indicator.setIntValue(valueFeature, counter);
>        output.addFsToIndexes(indicator);
> 
>        return output;
>    }
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------
> 
> 
> 
> Sep 13, 2011 4:53:55 PM
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl
> callAnalysisComponentNext(513)
> SEVERE: Exception occurred
> Throwable occurred: java.lang.NullPointerException
>    at org.apache.uima.cas.impl.CASImpl.ll_getFSForRef(CASImpl.java:3106)
>    at org.apache.uima.cas.impl.CASImpl.getSofa(CASImpl.java:667)
>    at org.apache.uima.cas.impl.CASImpl.setSofaDataString(CASImpl.java:4124)
>    at org.apache.uima.util.CasCopier.copyCasView(CasCopier.java:125)
>    at org.apache.uima.util.CasCopier.copyCas(CasCopier.java:101)
>    at
> com.kln.ryip.gwarel.webui.uima.PFMultiplier.next(PFMultiplier.java:64)
>    at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentNext(PrimitiveAnalysisEngine_impl.java:490)
>    at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl$AnalysisComponentCasIterator.next(PrimitiveAnalysisEngine_impl.java:603)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:569)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:409)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:342)
>    at
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:267)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:567)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:409)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:342)
>    at
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:267)
>    at
> org.apache.uima.analysis_engine.impl.PearAnalysisEngineWrapper.processAndOutputNewCASes(PearAnalysisEngineWrapper.java:339)
>    at
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
>    at
> org.apache.uima.collection.impl.cpm.engine.ProcessingUnit.processNext(ProcessingUnit.java:897)
>    at
> org.apache.uima.collection.impl.cpm.engine.ProcessingUnit.run(ProcessingUnit.java:577)
> Sep 13, 2011 4:53:55 PM
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl
> processAndOutputNewCASes(275)
> SEVERE: Exception occurred
> Throwable occurred:
> org.apache.uima.analysis_engine.AnalysisEngineProcessException
>    at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentNext(PrimitiveAnalysisEngine_impl.java:517)
>    at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl$AnalysisComponentCasIterator.next(PrimitiveAnalysisEngine_impl.java:603)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:569)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:409)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:342)
>    at
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:267)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:567)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:409)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:342)
>    at
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:267)
>    at
> org.apache.uima.analysis_engine.impl.PearAnalysisEngineWrapper.processAndOutputNewCASes(PearAnalysisEngineWrapper.java:339)
>    at
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
>    at
> org.apache.uima.collection.impl.cpm.engine.ProcessingUnit.processNext(ProcessingUnit.java:897)
>    at
> org.apache.uima.collection.impl.cpm.engine.ProcessingUnit.run(ProcessingUnit.java:577)
> Caused by: java.lang.NullPointerException
>    at org.apache.uima.cas.impl.CASImpl.ll_getFSForRef(CASImpl.java:3106)
>    at org.apache.uima.cas.impl.CASImpl.getSofa(CASImpl.java:667)
>    at org.apache.uima.cas.impl.CASImpl.setSofaDataString(CASImpl.java:4124)
>    at org.apache.uima.util.CasCopier.copyCasView(CasCopier.java:125)
>    at org.apache.uima.util.CasCopier.copyCas(CasCopier.java:101)
>    at
> com.kln.ryip.gwarel.webui.uima.PFMultiplier.next(PFMultiplier.java:64)
>    at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentNext(PrimitiveAnalysisEngine_impl.java:490)
>    ... 13 more
> Sep 13, 2011 4:53:55 PM
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl
> processAndOutputNewCASes(275)
> SEVERE: Exception occurred
> Throwable occurred:
> org.apache.uima.analysis_engine.AnalysisEngineProcessException
>    at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentNext(PrimitiveAnalysisEngine_impl.java:517)
>    at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl$AnalysisComponentCasIterator.next(PrimitiveAnalysisEngine_impl.java:603)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:569)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:409)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:342)
>    at
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:267)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:567)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:409)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:342)
>    at
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:267)
>    at
> org.apache.uima.analysis_engine.impl.PearAnalysisEngineWrapper.processAndOutputNewCASes(PearAnalysisEngineWrapper.java:339)
>    at
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
>    at
> org.apache.uima.collection.impl.cpm.engine.ProcessingUnit.processNext(ProcessingUnit.java:897)
>    at
> org.apache.uima.collection.impl.cpm.engine.ProcessingUnit.run(ProcessingUnit.java:577)
> Caused by: java.lang.NullPointerException
>    at org.apache.uima.cas.impl.CASImpl.ll_getFSForRef(CASImpl.java:3106)
>    at org.apache.uima.cas.impl.CASImpl.getSofa(CASImpl.java:667)
>    at org.apache.uima.cas.impl.CASImpl.setSofaDataString(CASImpl.java:4124)
>    at org.apache.uima.util.CasCopier.copyCasView(CasCopier.java:125)
>    at org.apache.uima.util.CasCopier.copyCas(CasCopier.java:101)
>    at
> com.kln.ryip.gwarel.webui.uima.PFMultiplier.next(PFMultiplier.java:64)
>    at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentNext(PrimitiveAnalysisEngine_impl.java:490)
>    ... 13 more
> org.apache.uima.analysis_engine.AnalysisEngineProcessException
>    at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentNext(PrimitiveAnalysisEngine_impl.java:517)
>    at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl$AnalysisComponentCasIterator.next(PrimitiveAnalysisEngine_impl.java:603)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:569)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:409)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:342)
>    at
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:267)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:567)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:409)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:342)
>    at
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:267)
>    at
> org.apache.uima.analysis_engine.impl.PearAnalysisEngineWrapper.processAndOutputNewCASes(PearAnalysisEngineWrapper.java:339)
>    at
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
>    at
> org.apache.uima.collection.impl.cpm.engine.ProcessingUnit.processNext(ProcessingUnit.java:897)
>    at
> org.apache.uima.collection.impl.cpm.engine.ProcessingUnit.run(ProcessingUnit.java:577)
> Caused by: java.lang.NullPointerException
>    at org.apache.uima.cas.impl.CASImpl.ll_getFSForRef(CASImpl.java:3106)
>    at org.apache.uima.cas.impl.CASImpl.getSofa(CASImpl.java:667)
>    at org.apache.uima.cas.impl.CASImpl.setSofaDataString(CASImpl.java:4124)
>    at org.apache.uima.util.CasCopier.copyCasView(CasCopier.java:125)
>    at org.apache.uima.util.CasCopier.copyCas(CasCopier.java:101)
>    at
> com.kln.ryip.gwarel.webui.uima.PFMultiplier.next(PFMultiplier.java:64)
>    at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentNext(PrimitiveAnalysisEngine_impl.java:490)
>    ... 13 more
> Sep 13, 2011 4:53:55 PM
> org.apache.uima.collection.impl.cpm.engine.ProcessingUnit process
> SEVERE: The container Fruit and Country returned the following error
> message: null (Thread Name: [Procesing Pipeline#1 Thread]::)
> Sep 13, 2011 4:53:55 PM
> org.apache.uima.collection.impl.cpm.engine.ProcessingUnit
> maybeLogSevereException(2502)
> SEVERE: Thread: [Procesing Pipeline#1 Thread]::, message: null
> Throwable occurred:
> org.apache.uima.analysis_engine.AnalysisEngineProcessException
>    at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentNext(PrimitiveAnalysisEngine_impl.java:517)
>    at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl$AnalysisComponentCasIterator.next(PrimitiveAnalysisEngine_impl.java:603)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:569)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:409)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:342)
>    at
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:267)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:567)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:409)
>    at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:342)
>    at
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:267)
>    at
> org.apache.uima.analysis_engine.impl.PearAnalysisEngineWrapper.processAndOutputNewCASes(PearAnalysisEngineWrapper.java:339)
>    at
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
>    at
> org.apache.uima.collection.impl.cpm.engine.ProcessingUnit.processNext(ProcessingUnit.java:897)
>    at
> org.apache.uima.collection.impl.cpm.engine.ProcessingUnit.run(ProcessingUnit.java:577)
> Caused by: java.lang.NullPointerException
>    at org.apache.uima.cas.impl.CASImpl.ll_getFSForRef(CASImpl.java:3106)
>    at org.apache.uima.cas.impl.CASImpl.getSofa(CASImpl.java:667)
>    at org.apache.uima.cas.impl.CASImpl.setSofaDataString(CASImpl.java:4124)
>    at org.apache.uima.util.CasCopier.copyCasView(CasCopier.java:125)
>    at org.apache.uima.util.CasCopier.copyCas(CasCopier.java:101)
>    at
> com.kln.ryip.gwarel.webui.uima.PFMultiplier.next(PFMultiplier.java:64)
>    at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentNext(PrimitiveAnalysisEngine_impl.java:490)
>    ... 13 more
> Sep 13, 2011 4:53:55 PM
> org.apache.uima.collection.impl.cpm.engine.ProcessingUnit process
> WARNING: The CAS is being dropped due to the CPM error handling
> configuration. (Thread Name: [Procesing Pipeline#1 Thread]::) Container
> Name: Fruit and Country Cas Processor:
> org.apache.uima.analysis_engine.impl.PearAnalysisEngineWrapper
> com.kln.ryip.gwarel.webui.exception.WebUIException: Error testing pear for
> project "Fruit and Country"
>    at
> com.kln.ryip.gwarel.webui.context.GenerationManager.testPear(GenerationManager.java:124)
>    at
> com.kln.ryip.gwarel.webui.controller.ServerController.handleRequest(ServerController.java:82)
>    at
> com.kln.ryip.gwarel.webui.controller.ControllerBase.handleGetRequest(ControllerBase.java:146)
>    at
> com.kln.ryip.gwarel.webui.controller.ControllerBase.doGet(ControllerBase.java:55)
>    at
> com.kln.ryip.gwarel.webui.controller.ServerController.doPost(ServerController.java:101)
>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
>    at
> com.kln.ryip.gwarel.webui.controller.LWWebUIServlet.service(LWWebUIServlet.java:83)
>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>    at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
>    at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>    at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
>    at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
>    at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
>    at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
>    at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
>    at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:851)
>    at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>    at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
>    at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:278)
>    at
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
>    at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
>    at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
>    at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
>    at java.lang.Thread.run(Thread.java:736)
> Caused by: com.kln.ryip.gwarel.webui.exception.WebUIException:
> WebUIException - Unable to find analysis output
>    at
> com.kln.ryip.gwarel.webui.peartesting.PearTester.testPear(PearTester.java:103)
>    at
> com.kln.ryip.gwarel.webui.context.GenerationManager.testPear(GenerationManager.java:122)
>    ... 23 more

Richard Eckart de Castilho

-- 
------------------------------------------------------------------- 
Richard Eckart de Castilho
Technical Lead
Ubiquitous Knowledge Processing Lab 
FB 20 Computer Science Department      
Technische Universit├Ąt Darmstadt 
Hochschulstr. 10, D-64289 Darmstadt, Germany 
phone [+49] (0)6151 16-7477, fax -5455, room S2/02/B117
eckartde@tk.informatik.tu-darmstadt.de 
www.ukp.tu-darmstadt.de 
Web Research at TU Darmstadt (WeRC) www.werc.tu-darmstadt.de
------------------------------------------------------------------- 





Mime
View raw message