Package org.apache.uima.cas_data.impl
Class CasDataToXCas
- java.lang.Object
-
- org.apache.uima.cas_data.impl.CasDataToXCas
-
public class CasDataToXCas extends java.lang.ObjectTakes a CasData and generates XCAS SAX events.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classCasDataToXCas.DocTextHolder
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringmDocumentTextFeatureNameprivate java.lang.StringmDocumentTextTypeNameprivate org.xml.sax.ContentHandlermHandlerprivate booleanmIncludeAnnotationSpannedTextprivate java.util.List<java.lang.String>mTypesToFilterprivate java.lang.StringmXCasDocTextTag
-
Constructor Summary
Constructors Constructor Description CasDataToXCas()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void_generate(FeatureStructure aFS, CasDataToXCas.DocTextHolder aDocTextHolder)private void_generateDocFS(FeatureStructure aFS, CasDataToXCas.DocTextHolder aDocTextHolder)voidgenerateXCas(CasData aCasData)Generates XCAS for a CasData.voidgenerateXCas(CasData aCasData, java.lang.String aUEID)Special form ofgenerateXCas(CasData)that allows a UEID (Universal Entity ID) element to be added as the first element in the XCAS.voidgenerateXCas(CasData aCasData, java.lang.String aUEID, boolean aSendStartAndEndDocEvents)Special form ofgenerateXCas(CasData)that allows a UEID (Universal Entity ID) element to be added as the first element in the XCAS and also allows start/end document SAX calls to be supressed.java.lang.StringgetDocumentTextFeatureName()Gets the name of the CASData Feature that stores the document text.java.lang.StringgetDocumentTextTypeName()Gets the name of the CASData FeatureStructure Type that stores the document text.private java.lang.StringgetXCasElementName(FeatureStructure aFS)Gets the XCAS element name for a FS.voidsetContentHandler(org.xml.sax.ContentHandler aHandler)Sets the ContentHandler to receive the SAX events.voidsetDocumentTextFeatureName(java.lang.String aDocumentTextFeatureName)Sets the name of the CASData Feature that stores the document text.voidsetDocumentTextTypeName(java.lang.String aDocumentTextTypeName)Sets the name of the CASData FeatureStructure Type that stores the document text.voidsetIncludeAnnotationSpannedText(boolean aIncludeAnnotationSpannedText)voidsetTypesToFilter(java.lang.String[] aTypesToFilter)Specifies names of types that will not be included in the XCASvoidsetXCasDocumentTextTagName(java.lang.String aXCasDocTextTag)Sets the name of the XCAS tag that will contain the document text.
-
-
-
Field Detail
-
mDocumentTextTypeName
private java.lang.String mDocumentTextTypeName
-
mDocumentTextFeatureName
private java.lang.String mDocumentTextFeatureName
-
mXCasDocTextTag
private java.lang.String mXCasDocTextTag
-
mIncludeAnnotationSpannedText
private boolean mIncludeAnnotationSpannedText
-
mTypesToFilter
private java.util.List<java.lang.String> mTypesToFilter
-
mHandler
private org.xml.sax.ContentHandler mHandler
-
-
Method Detail
-
getDocumentTextTypeName
public java.lang.String getDocumentTextTypeName()
Gets the name of the CASData FeatureStructure Type that stores the document text.- Returns:
- the document text type name
-
setDocumentTextTypeName
public void setDocumentTextTypeName(java.lang.String aDocumentTextTypeName)
Sets the name of the CASData FeatureStructure Type that stores the document text.- Parameters:
aDocumentTextTypeName- the document text type name
-
getDocumentTextFeatureName
public java.lang.String getDocumentTextFeatureName()
Gets the name of the CASData Feature that stores the document text.- Returns:
- the document text feature name
-
setDocumentTextFeatureName
public void setDocumentTextFeatureName(java.lang.String aDocumentTextFeatureName)
Sets the name of the CASData Feature that stores the document text.- Parameters:
aDocumentTextFeatureName- the document text feature name
-
setXCasDocumentTextTagName
public void setXCasDocumentTextTagName(java.lang.String aXCasDocTextTag)
Sets the name of the XCAS tag that will contain the document text.- Parameters:
aXCasDocTextTag- the document text tag
-
setIncludeAnnotationSpannedText
public void setIncludeAnnotationSpannedText(boolean aIncludeAnnotationSpannedText)
- Parameters:
aIncludeAnnotationSpannedText- -
-
setTypesToFilter
public void setTypesToFilter(java.lang.String[] aTypesToFilter)
Specifies names of types that will not be included in the XCAS- Parameters:
aTypesToFilter- -
-
setContentHandler
public void setContentHandler(org.xml.sax.ContentHandler aHandler)
Sets the ContentHandler to receive the SAX events.- Parameters:
aHandler- -
-
generateXCas
public void generateXCas(CasData aCasData) throws org.xml.sax.SAXException
Generates XCAS for a CasData. SAX events representing the XCAS will be sent to the ContentHandler registered viasetContentHandler(ContentHandler).- Parameters:
aCasData- the CasData from which XCAS will be generated- Throws:
org.xml.sax.SAXException- if the ContentHandler throws a SAX Exception
-
generateXCas
public void generateXCas(CasData aCasData, java.lang.String aUEID) throws org.xml.sax.SAXException
Special form ofgenerateXCas(CasData)that allows a UEID (Universal Entity ID) element to be added as the first element in the XCAS.- Parameters:
aCasData- the CasData from which XCAS will be generatedaUEID- the UEID to add to the XCAS- Throws:
org.xml.sax.SAXException- if the ContentHandler throws a SAX Exception
-
generateXCas
public void generateXCas(CasData aCasData, java.lang.String aUEID, boolean aSendStartAndEndDocEvents) throws org.xml.sax.SAXException
Special form ofgenerateXCas(CasData)that allows a UEID (Universal Entity ID) element to be added as the first element in the XCAS and also allows start/end document SAX calls to be supressed.- Parameters:
aCasData- the CasData from which XCAS will be generatedaUEID- the UEID to add to the XCASaSendStartAndEndDocEvents- true to send SAX events for start and end of document, false to supress them.- Throws:
org.xml.sax.SAXException- if the ContentHandler throws a SAX Exception
-
_generate
private void _generate(FeatureStructure aFS, CasDataToXCas.DocTextHolder aDocTextHolder) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
getXCasElementName
private java.lang.String getXCasElementName(FeatureStructure aFS)
Gets the XCAS element name for a FS. This is usually the same as the type name, but the sequences _colon_ and _dash_ are translated to the characters : and -, respectively.- Parameters:
aFS- feature structures- Returns:
- XCAS element name for this feature structure
-
_generateDocFS
private void _generateDocFS(FeatureStructure aFS, CasDataToXCas.DocTextHolder aDocTextHolder) throws org.xml.sax.SAXException
- Parameters:
aFS-- Throws:
org.xml.sax.SAXException
-
-