org.apache.uima.cas.impl
Class XmiSerializationSharedData

java.lang.Object
  extended by org.apache.uima.cas.impl.XmiSerializationSharedData

public class XmiSerializationSharedData
extends java.lang.Object

A container for data that is shared between the XmiCasSerializer and the XmiCasDeserializer. This has a number of uses:


Constructor Summary
XmiSerializationSharedData()
           
 
Method Summary
 void addNonsharedRefToFSMapping(int nonsharedFSAddr, int fsAddr)
          Add mapping between the address of FS that is the value of a non-shared multi-valued feature of a FeatureStructure.
 void addOutOfTypeSystemArrayElement(int addr, int index, int xmiId)
          Records an out-of-typesystem array element in the XmiSerializationSharedData.
 void addOutOfTypeSystemAttribute(int addr, java.lang.String featName, java.lang.String featVal)
          Records an out-of-typesystem attribute that belongs to an in-typesystem FS.
 void addOutOfTypeSystemChildElements(int addr, java.lang.String featName, java.util.List<java.lang.String> featVals)
          Records out-of-typesystem child elements that belong to an in-typesystem FS.
 void addOutOfTypeSystemElement(org.apache.uima.cas.impl.XmiSerializationSharedData.OotsElementData elemData)
          Records information about an XMI element that was not an instance of any type in the type system.
 void addOutOfTypeSystemViewMember(java.lang.String sofaXmiId, java.lang.String memberXmiId)
          Records that an out-of-typesystem XMI element should be a member of the specified view.
 void clearIdMap()
          Clears the ID mapping information that was populated in previous serializations or deserializations.
 int[] getAllFsAddressesInIdMap()
          Get all FS Addresses that have been added to the id map.
 int getEncompassingFS(int nonsharedFS)
           
 int getFsAddrForXmiId(int xmiId)
          Gets the FS address that corresponds to the given xmi:id, in the most recent serialization or deserialization.
 int getMaxXmiId()
          Gets the maximum xmi:id that has been generated or read so far.
 int[] getNonsharedMulitValuedFSs()
           
 java.util.List<org.apache.uima.cas.impl.XmiSerializationSharedData.XmiArrayElement> getOutOfTypeSystemArrayElements(int addr)
          Gets information about out-of-typesystem array elements.
 java.util.List<org.apache.uima.cas.impl.XmiSerializationSharedData.OotsElementData> getOutOfTypeSystemElements()
          Gets a List of XmiSerializationSharedData.OotsElementData objects, each of which describes an incoming XMI element that did not correspond to a Type in the TypeSystem.
 org.apache.uima.cas.impl.XmiSerializationSharedData.OotsElementData getOutOfTypeSystemFeatures(int addr)
          Gets information about out-of-typesystem features that belong to an in-typesystem FS.
 java.util.List<java.lang.String> getOutOfTypeSystemViewMembers(java.lang.String sofaXmiId)
          Gets a List of xmi:id's (Strings) of all out-of-typesystem XMI elements that are members of the view with the given id.
 java.lang.String toString()
          For debugging purposes only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmiSerializationSharedData

public XmiSerializationSharedData()
Method Detail

getMaxXmiId

public int getMaxXmiId()
Gets the maximum xmi:id that has been generated or read so far.

Returns:
the maximum xmi:id

getFsAddrForXmiId

public int getFsAddrForXmiId(int xmiId)
Gets the FS address that corresponds to the given xmi:id, in the most recent serialization or deserialization.

Parameters:
xmiId - an xmi:id from the most recent XMI CAS that was serialized or deserialized.
Returns:
the FS address of the FeatureStructure corresponding to that xmi:id, -1 if none.

clearIdMap

public void clearIdMap()
Clears the ID mapping information that was populated in previous serializations or deserializations. TODO: maybe a more general reset that resets other things?


addOutOfTypeSystemElement

public void addOutOfTypeSystemElement(org.apache.uima.cas.impl.XmiSerializationSharedData.OotsElementData elemData)
Records information about an XMI element that was not an instance of any type in the type system.

Parameters:
elemData - information about the out-of-typesystem XMI element

getOutOfTypeSystemElements

public java.util.List<org.apache.uima.cas.impl.XmiSerializationSharedData.OotsElementData> getOutOfTypeSystemElements()
Gets a List of XmiSerializationSharedData.OotsElementData objects, each of which describes an incoming XMI element that did not correspond to a Type in the TypeSystem.

Returns:
List of XmiSerializationSharedData.OotsElementData objects

addOutOfTypeSystemViewMember

public void addOutOfTypeSystemViewMember(java.lang.String sofaXmiId,
                                         java.lang.String memberXmiId)
Records that an out-of-typesystem XMI element should be a member of the specified view.

Parameters:
sofaXmiId - xmi:id of a Sofa
memberXmiId - xmi:id of an out-of-typesystem element that should be a member of the view for the given Sofa

getOutOfTypeSystemViewMembers

public java.util.List<java.lang.String> getOutOfTypeSystemViewMembers(java.lang.String sofaXmiId)
Gets a List of xmi:id's (Strings) of all out-of-typesystem XMI elements that are members of the view with the given id.

Parameters:
sofaXmiId - xmi:id of a Sofa
Returns:
List of xmi:id's of members of the view for the given Sofa.

addOutOfTypeSystemAttribute

public void addOutOfTypeSystemAttribute(int addr,
                                        java.lang.String featName,
                                        java.lang.String featVal)
Records an out-of-typesystem attribute that belongs to an in-typesystem FS. This will be added to the attributes when that FS is reserialized.

Parameters:
addr - CAS address of the FS
featName - name of the feature
featVal - value of the feature, as a string

addOutOfTypeSystemChildElements

public void addOutOfTypeSystemChildElements(int addr,
                                            java.lang.String featName,
                                            java.util.List<java.lang.String> featVals)
Records out-of-typesystem child elements that belong to an in-typesystem FS. These will be added to the child elements when that FS is reserialized.

Parameters:
addr - CAS address of the FS
featName - name of the feature (element tag name)
featVals - values of the feature, as a List of strings

getOutOfTypeSystemFeatures

public org.apache.uima.cas.impl.XmiSerializationSharedData.OotsElementData getOutOfTypeSystemFeatures(int addr)
Gets information about out-of-typesystem features that belong to an in-typesystem FS.

Parameters:
addr - CAS address of the FS
Returns:
object containing information about out-of-typesystem features (both attributes and child elements)

getAllFsAddressesInIdMap

public int[] getAllFsAddressesInIdMap()
Get all FS Addresses that have been added to the id map.

Returns:
an array containing all the FS addresses

getOutOfTypeSystemArrayElements

public java.util.List<org.apache.uima.cas.impl.XmiSerializationSharedData.XmiArrayElement> getOutOfTypeSystemArrayElements(int addr)
Gets information about out-of-typesystem array elements.

Parameters:
addr - the CAS address of an FSArray
Returns:
a List of XmiSerializationSharedData.XmiArrayElement objects, each of which holds the index and xmi:id of an array element that is a reference to an out-of-typesystem FS.

addOutOfTypeSystemArrayElement

public void addOutOfTypeSystemArrayElement(int addr,
                                           int index,
                                           int xmiId)
Records an out-of-typesystem array element in the XmiSerializationSharedData.

Parameters:
addr - CAS address of FSArray
index - index into array
xmiId - xmi:id of the out-of-typesystem element that is the value at the given index

addNonsharedRefToFSMapping

public void addNonsharedRefToFSMapping(int nonsharedFSAddr,
                                       int fsAddr)
Add mapping between the address of FS that is the value of a non-shared multi-valued feature of a FeatureStructure.

Parameters:
nonsharedFSAddr - - fs address of non-shared multi-valued feature value
fsAddr - - fs address of encompassing featurestructure

getNonsharedMulitValuedFSs

public int[] getNonsharedMulitValuedFSs()
Returns:
the non-shared featureId to FS Id key set

getEncompassingFS

public int getEncompassingFS(int nonsharedFS)
Parameters:
nonsharedFS - an id of a nonsharedFS
Returns:
the int handle to the encompassing FS or -1 if not found

toString

public java.lang.String toString()
For debugging purposes only.

Overrides:
toString in class java.lang.Object


Copyright © 2006–2014 The Apache Software Foundation. All rights reserved.