Package org.apache.uima.cas.impl
Class XmiCasDeserializer
java.lang.Object
org.apache.uima.cas.impl.XmiCasDeserializer
XMI CAS deserializer. Used to read in a CAS from XML Metadata Interchange (XMI) format.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final boolean
private static final boolean
private static final int
private TypeSystemImpl
private static final Pattern
-
Constructor Summary
ConstructorsConstructorDescriptionXmiCasDeserializer
(TypeSystem ts, UimaContext uimaContext) Create a new deserializer from a type system. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
static void
deserialize
(InputStream aStream, CAS aCAS) Deserializes a CAS from XMI.static void
deserialize
(InputStream aStream, CAS aCAS, boolean aLenient) Deserializes a CAS from XMI.static void
deserialize
(InputStream aStream, CAS aCAS, boolean aLenient, XmiSerializationSharedData aSharedData) Deserializes a CAS from XMI.static void
deserialize
(InputStream aStream, CAS aCAS, boolean aLenient, XmiSerializationSharedData aSharedData, int aMergePoint) Deserializes a CAS from XMI.static void
deserialize
(InputStream aStream, CAS aCAS, boolean aLenient, XmiSerializationSharedData aSharedData, int aMergePoint, AllowPreexistingFS allowPreexistingFS) Deserializes a CAS from XMI.getXmiCasHandler
(CAS cas) Create a default handler for deserializing a CAS from XMI.getXmiCasHandler
(CAS cas, boolean lenient) Create a default handler for deserializing a CAS from XMI.getXmiCasHandler
(CAS cas, boolean lenient, XmiSerializationSharedData sharedData) Create a default handler for deserializing a CAS from XMI.getXmiCasHandler
(CAS cas, boolean lenient, XmiSerializationSharedData sharedData, int mergePoint) Create a default handler for deserializing a CAS from XMI.getXmiCasHandler
(CAS cas, boolean lenient, XmiSerializationSharedData sharedData, int mergePoint, AllowPreexistingFS allow) Create a default handler for deserializing a CAS from XMI.private void
private String
xmiElementName2uimaTypeName
(String nsUri, String localName) Converts an XMI element name to a UIMA-style dotted type name.
-
Field Details
-
IS_NEW_FS
private static final boolean IS_NEW_FS- See Also:
-
IS_EXISTING_FS
private static final boolean IS_EXISTING_FS- See Also:
-
sofaTypeCode
private static final int sofaTypeCode- See Also:
-
whiteSpace
-
ID_ATTR_NAME
- See Also:
-
ts
-
xmiNamespaceToUimaNamespaceMap
-
-
Constructor Details
-
XmiCasDeserializer
Create a new deserializer from a type system.Note: all CAS arguments later supplied to
getXCASHandler()
must have this type system as their type system.- Parameters:
ts
- The type system of the CASes to be deserialized.uimaContext
- the UIMA Context to use for the deserialization
-
XmiCasDeserializer
-
-
Method Details
-
getXmiCasHandler
Create a default handler for deserializing a CAS from XMI.- Parameters:
cas
- This CAS will be used to hold the data deserialized from the XMI- Returns:
- The
DefaultHandler
to pass to the SAX parser.
-
getXmiCasHandler
Create a default handler for deserializing a CAS from XMI. By default this is not lenient, meaning that if the XMI references Types that are not in the Type System, an Exception will be thrown. UsegetXmiCasHandler(CAS,boolean)
to turn on lenient mode and ignore any unknown types.- Parameters:
cas
- This CAS will be used to hold the data deserialized from the XMIlenient
- if true, unknown Types will be ignored. If false, unknown Types will cause an exception. The default is false.- Returns:
- The
DefaultHandler
to pass to the SAX parser.
-
deserialize
Deserializes a CAS from XMI.- Parameters:
aStream
- input stream from which to read the XMI documentaCAS
- CAS into which to deserialize. This CAS must be set up with a type system that is compatible with that in the XMI- Throws:
SAXException
- if an XML Parsing error occursIOException
- if an I/O failure occurs
-
deserialize
public static void deserialize(InputStream aStream, CAS aCAS, boolean aLenient) throws SAXException, IOException Deserializes a CAS from XMI.- Parameters:
aStream
- input stream from which to read the XMI documentaCAS
- CAS into which to deserialize. This CAS must be set up with a type system that is compatible with that in the XMIaLenient
- if true, unknown Types will be ignored. If false, unknown Types will cause an exception. The default is false.- Throws:
SAXException
- if an XML Parsing error occursIOException
- if an I/O failure occurs
-
xmiElementName2uimaTypeName
Converts an XMI element name to a UIMA-style dotted type name.- Parameters:
nsUri
- the namespace URI of the XMI elementlocalName
- the local name of the XMI element- Returns:
- the UIMA type name corresponding to the XMI element name
- Throws:
SAXException
-
report0xmiId
private void report0xmiId()
-