google-code-export / uimafit

Automatically exported from code.google.com/p/uimafit
2 stars 1 forks source link

Type system throws CastExceptrion #136

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi!
We have received a strange Exception from the Type system of uimafit.

1. First we loaded the type system from different xml-files like this:
typeSystemDescription = 
TypeSystemDescriptionFactory.createTypeSystemDescriptionFromPath(
                    "app/models/linguistic/descriptors/LexicalUnits.xml",
                    "app/models/linguistic/descriptors/Punctuation.xml",
                    "app/models/linguistic/descriptors/Word.xml",
                    ...);

2. Then we loaded the pipeline through aggregator like this: 

AggregateBuilder builder = new AggregateBuilder();
        // create resource manager
        SimpleNamedResourceManager resourceManager = new SimpleNamedResourceManager();        resourceManager.setExtensionClassPath(Play.application().classloader(), "", true);
        // build pipeline
        builder.add(createPrimitiveDescription(LanguageAnnotator.class));

3. And then we wanted to iterate the annotations of the daugther type which was 
created in one of the annotators:
Collection<Word> col = JCasUtil.select(jCas, Word.class);
(*) for (Word word: col){...}

=> In this place (* ) the system threw the ClassCastException, that 
Annotation.class cannot be casted to Word.class.

Inside any annotator the same lines don't throw any exception, this happens in 
the main program only. 

What could we do wrong?
The problem may lay in the resource loading, since we use ResourceManager which 
loads the classes for the types from the PLAY (Web framework) Class loader. 
Maybe we have to set the ResourceManager also for JCas?

We use IntelliJ IDEA and MacOS.
Thank you for your help.     

Original issue reported on code.google.com by faina...@gmail.com on 9 Sep 2013 at 9:10

GoogleCodeExporter commented 9 years ago
Apache uimaFIT 2.0.0 has been released. This marks the end of active 
development on this project. Further versions of uimaFIT will be released under 
the umbrella of the Apache UIMA project. Please direct any questions to the 
UIMA users mailing list and any issue reports to the Apache issue tracker.

When you re-post the question, please indicate how the typeSystemDescription 
enters into the pipeline. A slightly larger part of your code would be helpful.

Original comment by richard.eckart on 9 Sep 2013 at 9:26