Package org.apache.uima.cas.impl
Class XCASSerializer.XCASDocSerializer
java.lang.Object
org.apache.uima.cas.impl.XCASSerializer.XCASDocSerializer
- Enclosing class:
XCASSerializer
Use an inner class to hold the data for serializing a CAS. Each call to serialize() creates its
own instance.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CASImplprivate static final Stringprivate ContentHandlerAny FS indexed in more than one IR goes in here, the value is the associated duplicate key, Key is used to index into dupVectorslist of IntVectors holding lists of repo numbers.private final AttributesImplprivate intlist of FSs that are in an index somewhere.private final IntVectorSpecific IndexRepository for indexed FSsprivate static final intprivate static final intprivate static final intprivate static final intprivate OutOfTypeSystemDataprivate static final intprivate static final int(package private) intA key identifying a particular FS indexed in multiple indexes.The current queue for FSs to write out.Any FS reference we've touched goes in here.private AttributesImpl -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddAttribute(AttributesImpl attrs, String attrName, String attrValue) private voidprivate final intclassifyType(TypeImpl ti) classify the type, without distinguishng list typesprivate voidencodeFeatures(TOP fs, AttributesImpl attrs) private voidEncode an individual FS.private voidencodeFSArray(FSArray fs, AttributesImpl attrs) private voidprivate voidencodeOutOfTypeSystemFeatures(TOP fs, AttributesImpl attrs) private voidencodePrimitiveTypeArrayFS(String[] data, String typeName, AttributesImpl attrs) private voidprivate voidendElement(String tag) private booleanAdd an address to the queue.private voidenqueueArray(TOP[] fss, int sofaNum) private voidenqueueCollection(Collection<TOP> fss, int sofaNum) private voidenqueueFeatures(TOP fs, int heapValue) private voidprivate voidprivate voidPush the indexed FSs onto the queue.private voidenqueueIndexed(TOP fs, int indexRep) Same as enqueue, but for indexed FSs.private voidprivate voidprivate final StringgetTypeName(TOP fs) private intBad name; check if we've seen this (address, value) before.private booleanisValidXmlChar(char c) private StringreplaceInvalidXmlChars(String aString) private voidserialize(boolean encodeDoc, OutOfTypeSystemData outOfTypeSystemData) private voidprivate voidstartElement(String tag, Attributes attrs, int num)
-
Field Details
-
ch
-
cas
-
queued
Any FS reference we've touched goes in here. value is index repo (first one?), or MULTIPLY_INDEXED -
NOT_INDEXED
private static final int NOT_INDEXED- See Also:
-
MULTIPLY_INDEXED
private static final int MULTIPLY_INDEXED- See Also:
-
INVALID_INDEX
private static final int INVALID_INDEX- See Also:
-
duplicates
Any FS indexed in more than one IR goes in here, the value is the associated duplicate key, Key is used to index into dupVectors -
numDuplicates
int numDuplicatesA key identifying a particular FS indexed in multiple indexes. Starts a 0, incr by 1 for each new FS discovered to be indexed in more than one IR -
dupVectors
list of IntVectors holding lists of repo numbers. Indexed by the key above, for fss that are in multiple index repos -
indexedFSs
list of FSs that are in an index somewhere. -
indexReps
Specific IndexRepository for indexed FSs -
queue
The current queue for FSs to write out. -
emptyAttrs
-
workAttrs
-
cdataType
- See Also:
-
fsCount
private int fsCount -
mOutOfTypeSystemData
-
KEY_AND_VALUE_MATCH
private static final int KEY_AND_VALUE_MATCH- See Also:
-
KEY_ONLY_MATCH
private static final int KEY_ONLY_MATCH- See Also:
-
KEY_NOT_FOUND
private static final int KEY_NOT_FOUND- See Also:
-
-
Constructor Details
-
XCASDocSerializer
-
-
Method Details
-
enqueue
Add an address to the queue.- Parameters:
fs_id- The address.- Returns:
falseiff we've seen this address before.
-
enqueueIndexed
Same as enqueue, but for indexed FSs.- Parameters:
fs_id- The address to enqueue.
-
isQueued
Bad name; check if we've seen this (address, value) before.- Parameters:
fs- The Feature Structure.value- The index repository- Returns:
- KEY_AND_VALUE_MATCH iff we've seen (address, value) before. KEY_NOT_FOUND iff the address has not been seen before. KEY_ONLY_MATCH iff the address has been seen before with a different value.
-
serialize
private void serialize(boolean encodeDoc, OutOfTypeSystemData outOfTypeSystemData) throws IOException, SAXException - Throws:
IOExceptionSAXException
-
addText
- Throws:
SAXException
-
replaceInvalidXmlChars
-
isValidXmlChar
private boolean isValidXmlChar(char c) -
addAttribute
-
startElement
- Throws:
SAXException
-
endElement
- Throws:
SAXException
-
encodeIndexed
- Throws:
IOExceptionSAXException
-
enqueueIndexed
private void enqueueIndexed()Push the indexed FSs onto the queue. -
enqueueArray
-
enqueueCollection
-
enqueueFeaturesOfIndexed
private void enqueueFeaturesOfIndexed() -
encodeQueued
- Throws:
IOExceptionSAXException
-
encodeFS
Encode an individual FS.- Parameters:
fs_id- The address to be encoded.isIndexed- If the FS is indexed or not.- Throws:
IOException- passthruSAXException- passthru
-
encodePrimitiveTypeArrayFS
private void encodePrimitiveTypeArrayFS(String[] data, String typeName, AttributesImpl attrs) throws SAXException - Throws:
SAXException
-
encodeFSArray
- Throws:
SAXException
-
enqueueFSArray
-
encodeFeatures
-
enqueueFeatures
-
encodeOutOfTypeSystemFeatures
-
enqueueOutOfTypeSystemFeatures
-
getTypeName
-
classifyType
classify the type, without distinguishng list types- Parameters:
ti- the type- Returns:
- the classification
-
enqueueOutOfTypeSystemData
-
serializeOutOfTypeSystemData
- Throws:
SAXException
-