public class XmiSerializationSharedData extends Object
XmiCasSerializer
and the XmiCasDeserializer
.
This has a number of uses:
XmiSerializationSharedData
instance to the deserializer, the deserializer will store information about the incoming xmi:id values. If you then pass
the same XmiSerializationSharedData
object to the serializer when you attempt to serialize the same CAS,
all of the incoming FS will be serialized using the same xmi:id value that they had when they were deserialized.lenient
parameter set to true,
whenever it encounters an XMI element that doesn't correspond to a type in the type system, it will populate the
XmiSerializationSharedData
with information about these elements. If you then pass the same
XmiSerializationSharedData
object to the serializer when you attempt to serialize the same CAS, these
out-of-typesystem FS will be reserialized without loss of information.
References between in-typesystem and out-of-typesystem
FS (in either direction) are maintained as well.XmiSerializationSharedData
, you can call the
getMaxXmiId()
method to get the maximum xmi:id value in the serialized CAS. This feature, along with the consistency of
xmi:id values, allows merging multiple XMI documents into a single CAS. See TODO.Inner classes are used to hold information about Feature Structure elements, both for out-of-typesystem data, and also when deserializing pre V3 xmi serializations where the Sofa FS are not guaranteed to come before other Feature Structures that depend on them.
Modifier and Type | Class and Description |
---|---|
static class |
XmiSerializationSharedData.NameMultiValue |
static class |
XmiSerializationSharedData.OotsElementData
Data structure holding all information about an XMI element
containing an out-of-typesystem FS.
|
static class |
XmiSerializationSharedData.XmiArrayElement
Data structure holding the index and the xmi:id of an array or list element that
is a reference to an out-of-typesystem FS.
|
Constructor and Description |
---|
XmiSerializationSharedData() |
Modifier and Type | Method and Description |
---|---|
void |
addNonsharedRefToFSMapping(TOP nonsharedFS,
TOP fs)
Add mapping between the address of FS that is the value of a non-shared multi-valued
feature of a FeatureStructure.
|
void |
addOutOfTypeSystemArrayElement(FSArray fsarray,
int index,
int xmiId)
Records an out-of-typesystem array element in the XmiSerializationSharedData.
|
void |
addOutOfTypeSystemAttribute(TOP fs,
String featName,
String featVal)
Records an out-of-typesystem attribute that belongs to an in-typesystem FS.
|
void |
addOutOfTypeSystemChildElements(TOP fs,
String featName,
ArrayList<String> featVals)
Records out-of-typesystem child elements that belong to an in-typesystem FS.
|
void |
addOutOfTypeSystemElement(XmiSerializationSharedData.OotsElementData elemData)
Records information about an XMI element that was not an instance of any type in the type system.
|
static void |
addOutOfTypeSystemFeature(XmiSerializationSharedData.OotsElementData oed,
String featName,
ArrayList<String> featVals) |
void |
addOutOfTypeSystemViewMember(String sofaXmiId,
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.
|
TOP[] |
getAndSortByIdAllFSsInIdMap()
Get all FS Addresses that have been added to the id map.
|
TOP |
getEncompassingFS(TOP nonsharedFS) |
TOP |
getFsForXmiId(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.
|
TOP[] |
getNonsharedMulitValuedFSs() |
List<XmiSerializationSharedData.XmiArrayElement> |
getOutOfTypeSystemArrayElements(FSArray fsarray)
Gets information about out-of-typesystem array elements.
|
List<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. |
XmiSerializationSharedData.OotsElementData |
getOutOfTypeSystemFeatures(TOP fs)
Gets information about out-of-typesystem features that belong to an
in-typesystem FS.
|
List<String> |
getOutOfTypeSystemViewMembers(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.
|
String |
getXmiId(TOP fs) |
boolean |
hasOutOfTypeSystemArrayElements() |
String |
toString()
For debugging purposes only.
|
public TOP getFsForXmiId(int xmiId)
xmiId
- an xmi:id from the most recent XMI CAS that was serialized
or deserialized.public int getMaxXmiId()
public void clearIdMap()
public void addOutOfTypeSystemElement(XmiSerializationSharedData.OotsElementData elemData)
elemData
- information about the out-of-typesystem XMI elementpublic List<XmiSerializationSharedData.OotsElementData> getOutOfTypeSystemElements()
XmiSerializationSharedData.OotsElementData
objects, each of which describes an
incoming XMI element that did not correspond to a Type in the TypeSystem.XmiSerializationSharedData.OotsElementData
objectspublic void addOutOfTypeSystemViewMember(String sofaXmiId, String memberXmiId)
sofaXmiId
- xmi:id of a SofamemberXmiId
- xmi:id of an out-of-typesystem element that should be
a member of the view for the given Sofapublic List<String> getOutOfTypeSystemViewMembers(String sofaXmiId)
sofaXmiId
- xmi:id of a Sofapublic void addOutOfTypeSystemAttribute(TOP fs, String featName, String featVal)
fs
- the FSfeatName
- name of the featurefeatVal
- value of the feature, as a stringpublic void addOutOfTypeSystemChildElements(TOP fs, String featName, ArrayList<String> featVals)
fs
- the FSfeatName
- name of the feature (element tag name)featVals
- values of the feature, as a List of stringspublic static void addOutOfTypeSystemFeature(XmiSerializationSharedData.OotsElementData oed, String featName, ArrayList<String> featVals)
public XmiSerializationSharedData.OotsElementData getOutOfTypeSystemFeatures(TOP fs)
fs
- the FSpublic TOP[] getAndSortByIdAllFSsInIdMap()
public List<XmiSerializationSharedData.XmiArrayElement> getOutOfTypeSystemArrayElements(FSArray fsarray)
fsarray
- an FSArrayXmiSerializationSharedData.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.public boolean hasOutOfTypeSystemArrayElements()
public void addOutOfTypeSystemArrayElement(FSArray fsarray, int index, int xmiId)
fsarray
- The FSArrayindex
- index into arrayxmiId
- xmi:id of the out-of-typesystem element that is the value at the given indexpublic void addNonsharedRefToFSMapping(TOP nonsharedFS, TOP fs)
nonsharedFS
- - The non-shared Feature Structure having a multi-valued feature valuefs
- - the encompassing Feature Structurepublic TOP[] getNonsharedMulitValuedFSs()
public TOP getEncompassingFS(TOP nonsharedFS)
nonsharedFS
- a nonsharedFSCopyright © 2006–2018 The Apache Software Foundation. All rights reserved.