You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Aaron Kaplan <Aa...@xrce.xerox.com> on 2008/06/24 15:53:47 UTC
null fsIndexRepository
My annotator's process method begins like this:
public void process(JCas jcas) throws AnalysisEngineProcessException {
FSIndexRepository repo = jcas.getFSIndexRepository();
I'm getting a NullPointerException at the line after that, because repo
is null. How can this happen?
Possibly relevant: the CAS I'm processing was loaded by the CVD from an
XMI file. In the CVD I see an index called
blah.blah.blah.MyType_GeneratedIndex, whereas I expected to see an index
called MyTypeIndex that we defined.
-Aaron
Re: null fsIndexRepository
Posted by Marshall Schor <ms...@schor.com>.
Aaron Kaplan wrote:
> My annotator's process method begins like this:
>
> public void process(JCas jcas) throws
> AnalysisEngineProcessException {
> FSIndexRepository repo = jcas.getFSIndexRepository();
>
> I'm getting a NullPointerException at the line after that, because
> repo is null. How can this happen?
>
> Possibly relevant: the CAS I'm processing was loaded by the CVD from
> an XMI file. In the CVD I see an index called
> blah.blah.blah.MyType_GeneratedIndex, whereas I expected to see an
> index called MyTypeIndex that we defined.
>
I'm a bit out of my area of expertise here, but I saw this in the
documentation for CVD:
Important: XMI CAS is a serialization format that serializes a CAS
without type system and index information. It is therefore impossible to
read in a stand-alone XMI CAS file. XMI CAS files can only be
interpreted in the context of an existing type system. Consequently, you
need to load the AE that was used to create the XMI file to be able to
load it.
Did you first load the Analysis Engine (that has the type system
specified that matches the type system of the saved XMI CAS), before
loading the XMI Cas?
-Marshall
Re: null fsIndexRepository
Posted by Aaron Kaplan <Aa...@xrce.xerox.com>.
Eddie Epstein wrote:
> By chance does the annotator descriptor declare Sofa input or output
> capabilities? If so, the CAS passed to process is a base CAS, which has no
> index repository.
Indeed, that was the problem.
Actually, what I described in my previous mail was actually two separate
problems. I introduced the bug you pointed out when constructing a
simplified test case for a different problem. The original problem was
that an index I was expecting to see wasn't there. That turned out to
be because I had failed to declare the index in the annotator's
descriptor, and as a result it wasn't getting created when the CAS was
deserialized.
Thanks once again for your quick and effective help.
-Aaron
Re: null fsIndexRepository
Posted by Eddie Epstein <ea...@gmail.com>.
Hi Aaron,
By chance does the annotator descriptor declare Sofa input or output
capabilities? If so, the CAS passed to process is a base CAS, which has no
index repository.
Here's some code from CasImpl.java
public FSIndexRepository getIndexRepository() {
if (this == this.svd.baseCAS) {
// BaseCas has no indexes for users
return null;
}
Eddie
On Tue, Jun 24, 2008 at 9:53 AM, Aaron Kaplan <Aa...@xrce.xerox.com>
wrote:
> My annotator's process method begins like this:
>
> public void process(JCas jcas) throws AnalysisEngineProcessException
> {
> FSIndexRepository repo = jcas.getFSIndexRepository();
>
> I'm getting a NullPointerException at the line after that, because repo is
> null. How can this happen?
>
> Possibly relevant: the CAS I'm processing was loaded by the CVD from an XMI
> file. In the CVD I see an index called
> blah.blah.blah.MyType_GeneratedIndex, whereas I expected to see an index
> called MyTypeIndex that we defined.
>
> -Aaron
>