uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Lally (JIRA)" <...@uima.apache.org>
Subject [jira] Created: (UIMA-1965) XMI Delta CAS Serialization doesn't work when preexisting FS is indexed in a new View
Date Mon, 06 Dec 2010 03:58:10 GMT
XMI Delta CAS Serialization doesn't work when preexisting FS is indexed in a new View

                 Key: UIMA-1965
                 URL: https://issues.apache.org/jira/browse/UIMA-1965
             Project: UIMA
          Issue Type: Bug
          Components: Core Java Framework
    Affects Versions: 2.3
            Reporter: Adam Lally

I think I ran into a problem with XMI delta CAS serialization.  Here's my use case:  I start
with a CAS that has a FeatureStructure (not annotation) indexed in the InitialView.  I want
to send this to a remote service, wihch will create a new view and add the exisitng FeatureStructure
to the indexes of that view.  With delta XMI CAS serialization, this does not seem to work.
 The FeatureStructure is not present in the indexes of the new view.

Here is a unit test (to be added to XmiCasDeserializerTest.java) that illustrates the problem:

  public void testDeltaCasIndexExistingFsInNewView() throws Exception {
    CAS cas1 = CasCreationUtils.createCas(typeSystem, new TypePriorities_impl(),
    CAS cas2 = CasCreationUtils.createCas(typeSystem, new TypePriorities_impl(),
    cas1.setDocumentText("This is a test document in the initial view");
    Type referentType = cas1.getTypeSystem().getType("org.apache.uima.testTypeSystem.Referent");
    FeatureStructure fs1 = cas1.createFS(referentType);
    //serialize complete  
    XmiSerializationSharedData sharedData = new XmiSerializationSharedData();
    String xml = serialize(cas1, sharedData);
    int maxOutgoingXmiId = sharedData.getMaxXmiId();
    //deserialize into cas2
    XmiSerializationSharedData sharedData2 = new XmiSerializationSharedData();      
    this.deserialize(xml, cas2, sharedData2, true, -1);
    CasComparer.assertEquals(cas1, cas2);
    //create Marker, add/modify fs and serialize in delta xmi format.
    Marker marker = cas2.createMarker();
    //create View
    CAS view = cas2.createView("NewView");
    //add FS to index
    Type referentType2 = cas2.getTypeSystem().getType("org.apache.uima.testTypeSystem.Referent");
    Iterator<FeatureStructure> fsIter = cas2.getIndexRepository().getAllIndexedFS(referentType2);
    while (fsIter.hasNext()) {
      FeatureStructure fs = fsIter.next();
    AnnotationFS cas2newAnnot = view.createAnnotation(cas2.getAnnotationType(), 6, 8);
    // serialize cas2 in delta format 
    String deltaxml1 = serialize(cas2, sharedData2, marker);
    //deserialize delta xmi into cas1
    this.deserialize(deltaxml1, cas1, sharedData, true, maxOutgoingXmiId, AllowPreexistingFS.allow);
    //check that new View contains the FS 
    CAS deserView = cas1.getView("NewView");
    Iterator<FeatureStructure> deserFsIter = deserView.getIndexRepository().getAllIndexedFS(referentType);

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message