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

Re: Opening a Cas.xmi file and using it to create a CAS object

Frank <fr...@...> writes:

> 
> Hi,
> 
> I am currently trying to load CAS xmi files and create CAS objects, but I
> can't see how to do it.



Have you managed to work it out?

I am trying to do exact the same thing, and i dont have any luck neither.


Re: Opening a Cas.xmi file and using it to create a CAS object

Posted by Frank <fr...@gmail.com>.
Timur,

Here is what I did to load an existing cas from its cas.xmi file, also using
its Type Description file.

         //get typeSystemDescription
         Object descriptor = UIMAFramework.getXMLParser().parse(new
XMLInputSource(inputTypeSystemFile));
         // instantiate CAS to get type system. Also build style. map file
if there is none.
         TypeSystemDescription tsDesc = (TypeSystemDescription) descriptor;
         tsDesc.resolveImports();
         CAS cas = CasCreationUtils.createCas(tsDesc, null, new
FsIndexDescription[0]);

         SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
         XmiCasDeserializer xmiCasDeserializer = new
XmiCasDeserializer(cas.getTypeSystem());
         parser.parse(inputCasFile, xmiCasDeserializer.getXmiCasHandler(cas,
true));

Frank,

On Sun, Dec 19, 2010 at 1:21 PM, Timur <ac...@gmail.com> wrote:

> Frank <fr...@...> writes:
>
> >
> > Hi,
> >
> > I am currently trying to load CAS xmi files and create CAS objects, but I
> > can't see how to do it.
>
>
>
> Have you managed to work it out?
>
> I am trying to do exact the same thing, and i dont have any luck neither.
>
>

Re: Opening a Cas.xmi file and using it to create a CAS object

Posted by Burn Lewis <bu...@gmail.com>.
This can be done with the XmiCollectionReader in the examples folder.  You
may just need to modify its descriptor to address your input files, or you
can copy the deserialization code from
examples/src/org/apache/uima/examples/xmi

~Burn