You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Timur <ac...@gmail.com> on 2010/12/19 21:35:32 UTC

UIMA XMI File to UIMA CAS

need to convert UIMA XMI File to UIMA CAS. Please point me in 
the right direction.

I am trying to do:

XmiCasDeserializer.deserialize (InputStream, CAS)

The Problem is i can't create an empty CAS that doesn't give me
a NullPointer Exception.


Re: UIMA XMI File to UIMA CAS

Posted by Burn Lewis <bu...@gmail.com>.
Have you copied the code from the XmiCollectionReader in the examples
project?  What's the stack trace?

~Burn

Re: UIMA XMI File to UIMA CAS

Posted by Diman Karagiozov <di...@tetracom.com>.
Hi there,

This is how I am doing the XMI deserialization:

                 // deserialize the type system
                 final XMLInputSource xmlIn = new XMLInputSource( new 
ByteArrayInputStream( ( byte[] ) someObejct ), null );
                 final TypeSystemDescription tsDesc = 
UIMAFramework.getXMLParser().parseTypeSystemDescription( xmlIn );

                 // deserialize the CAS
                 final CAS cas = CasCreationUtils.createCas( tsDesc, 
null, null );

                 XmiCasDeserializer.deserialize( new 
ByteArrayInputStream( ( byte[] ) someOtherObject ), cas, false );

                 return cas;

It is important to de-serialize the type system as well.

greetings
Diman

On 12/19/2010 10:35 PM, Timur wrote:
> need to convert UIMA XMI File to UIMA CAS. Please point me in
> the right direction.
>
> I am trying to do:
>
> XmiCasDeserializer.deserialize (InputStream, CAS)
>
> The Problem is i can't create an empty CAS that doesn't give me
> a NullPointer Exception.
>