feixiangcq wrote: > Hello, > I have problems about using SourceDocumentInformation in AE. This object > stores detailed information about the original source document. For example, > I want to indentify the last file that client sends by the method > getLastSegment(). However,when I deploy a AE in server, and client sends > files using FileCollectionReader, I print information about the method > getLastSegment(). It > always displays false even it is the last file. I check the files produced > by the AE. > In the last file, it contains: > <examples:SourceDocumentInformation xmi:id="13" sofa="1" begin="0" end="0" > uri="file:/G:/Project/UIMAAS/apache-uima- > as/data/input/New_IBM_Fellows.txt" > offsetInSource="0" documentSize="3665" lastSegment="true"/> > The lastSegment is true. I print the method geturi(),it is null. Obviously, > it doesn't store information. Can anyone help me? > I use SourceDocumentInformation in AE like this: > SourceDocumentInformation srcDocInfo = new > SourceDocumentInformation(aJCas); >
This asks UIMA to create a new instance of SourceDocumentInformation in the CAS. The new instance is initialized with default values for all the features. In particular, the new instance's uri is null, and the lastSegment is initialized to false. > System.out.println(srcDocInfo.getLastSegment()); > This prints out the values of that feature on the new instance you just created. I think you mean to fetch the particular instance that was put into the CAS by the FileCollectionReader. To do that, please read in the tutorial and user's guide manual, this part which describes how you access the results of previous Annotators: http://incubator.apache.org/uima/downloads/releaseDocs/2.2.2-incubating/docs/html/tutorials_and_users_guides/tutorials_and_users_guides.html#ugr.tug.aae.reading_results_previous_annotators Basically, the idea is that you get an iterator over the type SourceDocumentInformation, and then ask the iterator for the first instance, and use that as the value of the local Java variable "srcDocInfo", instead of creating a new one. > Is there something wrong. I am really appreciated if you give me a help.Thank > you! > No problem. -Marshall > feixiang > >From China > > > > >
