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 CASImpl
private static final String
private ContentHandler
Any 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 AttributesImpl
private int
list of FSs that are in an index somewhere.private final IntVector
Specific IndexRepository for indexed FSsprivate static final int
private static final int
private static final int
private static final int
private OutOfTypeSystemData
private static final int
private static final int
(package private) int
A 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 void
addAttribute
(AttributesImpl attrs, String attrName, String attrValue) private void
private final int
classifyType
(TypeImpl ti) classify the type, without distinguishng list typesprivate void
encodeFeatures
(TOP fs, AttributesImpl attrs) private void
Encode an individual FS.private void
encodeFSArray
(FSArray fs, AttributesImpl attrs) private void
private void
encodeOutOfTypeSystemFeatures
(TOP fs, AttributesImpl attrs) private void
encodePrimitiveTypeArrayFS
(String[] data, String typeName, AttributesImpl attrs) private void
private void
endElement
(String tag) private boolean
Add an address to the queue.private void
enqueueArray
(TOP[] fss, int sofaNum) private void
enqueueCollection
(Collection<TOP> fss, int sofaNum) private void
enqueueFeatures
(TOP fs, int heapValue) private void
private void
private void
Push the indexed FSs onto the queue.private void
enqueueIndexed
(TOP fs, int indexRep) Same as enqueue, but for indexed FSs.private void
private void
private final String
getTypeName
(TOP fs) private int
Bad name; check if we've seen this (address, value) before.private boolean
isValidXmlChar
(char c) private String
replaceInvalidXmlChars
(String aString) private void
serialize
(boolean encodeDoc, OutOfTypeSystemData outOfTypeSystemData) private void
private void
startElement
(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:
false
iff 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:
IOException
SAXException
-
addText
- Throws:
SAXException
-
replaceInvalidXmlChars
-
isValidXmlChar
private boolean isValidXmlChar(char c) -
addAttribute
-
startElement
- Throws:
SAXException
-
endElement
- Throws:
SAXException
-
encodeIndexed
- Throws:
IOException
SAXException
-
enqueueIndexed
private void enqueueIndexed()Push the indexed FSs onto the queue. -
enqueueArray
-
enqueueCollection
-
enqueueFeaturesOfIndexed
private void enqueueFeaturesOfIndexed() -
encodeQueued
- Throws:
IOException
SAXException
-
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
-