You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by Frank <fr...@gmail.com> on 2011/01/12 03:36:06 UTC

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

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.
>
>